Набор инструментов Wix: пути UNC и выпадающие списки - PullRequest
0 голосов
/ 01 октября 2019

Мой установщик настраивает службу для управления роботом, заполняющим лекарства. Робот представляет UNC-ресурс для выполнения заданий и один для возврата данных о выполненных заданиях. В локальной сети может быть несколько роботов, и я хочу, чтобы пользователь мог выбрать одного из них во время установки, используя свой путь UNC. Роботы не идентифицируют себя каким-либо другим способом, поэтому поиск и выбор общих ресурсов - это единственный способ, которым я вижу, что они могут быть выбраны.

Я могу получить общие ресурсы, о которых рабочая станция знает, с помощью настраиваемого действия ниже (примечание: вы можете получить библиотеку Gong Solution Shell Здесь ).

using GongSolutions.Shell;
using GongSolutions.Shell.Interop;

public sealed class ShellNetworkComputers : IEnumerable<string>
{
    public IEnumerator<string> GetEnumerator()
    {
        ShellItem folder = new ShellItem((Environment.SpecialFolder)CSIDL.NETWORK);
        IEnumerator<ShellItem> e = folder.GetEnumerator(SHCONTF.FOLDERS);

        while (e.MoveNext())
        {
            Debug.Print(e.Current.ParsingName);
            yield return e.Current.ParsingName;
        }
    }

    IEnumerator IEnumerable.GetEnumerator()
    {
        return GetEnumerator();
    }
}

[CustomAction]
public static ActionResult EnumerateShares(Session session)
{
    try
    {
        session.Log("Begin Enumerate Shares CA");

        var shell = new ShellNetworkComputers();
        var enumerator = shell.GetEnumerator();

        // Fill some property here, for the meantime just
        // log it to prove it works …
        while (enumerator.MoveNext())
        {
            session.Log(enumerator.Current);
        }

        return ActionResult.Success;
    }
    catch (Exception ex)
    {
        session.Log($"Failed to Enumerate Shares ; {ex.Message}");
        return ActionResult.Failure;
    }
}

Мой вопрос заключается в том, как включить ее в раскрывающийся список в форме. Прямо сейчас я делаю пользователя мимо пути в поле для редактирования. Использование pathedit и т. Д. Не удается, потому что они могут решить UNC. Вот форма:

<UI>
      <Dialog Id="SdsNetworkShareDirDlg" Width="370" Height="270" Title="!(loc.DialogTitle)">
        <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="18" Default="yes" Text="!(loc.WixUINext)"/>        
        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="18" Text="!(loc.WixUIBack)" />
        <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="18" Cancel="yes" Text="!(loc.WixUICancel)">
          <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
        </Control>
        <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="18" Transparent="yes" NoPrefix="yes" Text="!(loc.NetworkDlgDescription)" />
        <Control Id="Title" Type="Text" X="19" Y="4" Width="200" Height="18" Transparent="yes" NoPrefix="yes" Text="!(loc.NetworkDlgTitle)" />
        <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
        <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
        <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />

        <!-- Controls -->
        <Control Id="IncomingFoFolderLabel" Type="Text" X="20" Y="86" Width="80" Height="17" NoPrefix="yes" Text="!(loc.FillOnly)" />
        <Control Id="FolderFo" Type="Edit" X="20" Y="101" Width="250" Height="15" Property="FILLONLY" />
        <Control Id="IncomingFpFolderLabel" Type="Text" X="22" Y="128" Width="80" Height="17" NoPrefix="yes" Text="!(loc.FillPrint)" />
        <Control Id="FolderFp" Type="Edit" X="22" Y="146" Width="250" Height="15" Property="FILLANDPRINT" />
        <Control Id="OutgoingPrFolderLabel" Type="Text" X="20" Y="172" Width="80" Height="17" NoPrefix="yes" Text="!(loc.Produced)" />
        <Control Id="FolderPr" Type="Edit" X="22" Y="191" Width="250" Height="15" Property="PRODUCED" />
        <Control Id="SendToSynMed"  Type="CheckBox"  Width="80" Height="17" X="250" Y="56" Text="Monitor Only" CheckBoxValue="0" Property="ENABLE_SYNMED" />
        <Control Id="Debug"  Type="CheckBox"  Width="80" Height="17" X="250" Y="70" Text="Debug Mode" CheckBoxValue="0" Property="DEBUG" />
      </Dialog>
    </UI>

Я бы хотел изменить Правку на выпадающий список и сделать так, чтобы при нажатии кнопки в раскрывающемся меню вызывался ЦС и заполнялся раскрывающийся список. Я почесал голову некоторое время, и мой сильный Google / Bing-Fu никуда меня не привел.

Будем благодарны за любые советы, которые вы можете дать!

-) -------------------

ПитJenney

...