Пример #1
0
 public ManagedUI(string prefabName, GameObject gameObject, IManagedUI uiComponent)
 {
     PrefabName    = prefabName;
     GameObject    = gameObject;
     UIComponent   = uiComponent;
     ComponentType = UIComponent?.GetType();
 }
Пример #2
0
 public ManagedUI([NotNull] string name, [NotNull] GameObject gameObject, [NotNull] IManagedUI uiComponent)
 {
     Name          = name;
     GameObject    = gameObject;
     UIComponent   = uiComponent;
     ComponentType = UIComponent.GetType();
 }
Пример #3
0
        string[] GetUiDialogsDependencies(IManagedUI ui)
        {
            var dependsOnWpfDialogsBase = ui.InstallDialogs
                                          .Combine(ui.ModifyDialogs)
                                          .SelectMany(x => x.Assembly.GetReferencedAssemblies())
                                          .Any(a => a.Name.StartsWith("WixSharp.UI.WPF"));

            var usngWpfStockDialogs = ui.InstallDialogs
                                      .Combine(ui.ModifyDialogs)
                                      .Any(a => a.Assembly.GetName().Name == "WixSharp.UI.WPF");

            if (usngWpfStockDialogs || dependsOnWpfDialogsBase)
            {
                return new[]
                       {
                           System.Reflection.Assembly.Load("Caliburn.Micro").Location,
                           System.Reflection.Assembly.Load("Caliburn.Micro.Platform").Location,
                           System.Reflection.Assembly.Load("Caliburn.Micro.Platform.Core").Location,
                           System.Reflection.Assembly.Load("System.Windows.Interactivity").Location
                       }
            }
            ;
            else
            {
                return(new string[0]);
            }
        }
Пример #4
0
        /// <summary>
        /// Shows the modal window of the MSI UI. This method is called by the <see cref="T:Microsoft.Deployment.WindowsInstaller.IEmbeddedUI" />
        /// when it is initialized at runtime.
        /// </summary>
        /// <param name="msiRuntime">The MSI runtime.</param>
        /// <param name="ui">The MSI external/embedded UI.</param>
        public void ShowModal(MsiRuntime msiRuntime, IManagedUI ui)
        {
            //Debug.Assert(false);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            UI         = ui;
            MsiRuntime = msiRuntime;

            ActionResult result = ManagedProject.InvokeClientHandlers(MsiRuntime.Session, "UIInitialized");

            MsiRuntime.Data.MergeReplace(MsiRuntime.Session["WIXSHARP_RUNTIME_DATA"]); //data may be changed in the client handler

            if (result == ActionResult.Success)
            {
                if (MsiRuntime.Session.IsInstalling())
                {
                    Dialogs = ui.InstallDialogs;
                }
                else if (MsiRuntime.Session.IsRepairing())
                {
                    Dialogs = ui.ModifyDialogs;
                }

                if (Dialogs.Any())
                {
                    shellView       = new ShellView();
                    shellView.Load += (s, e) =>
                    {
                        MsiRuntime.Session["WIXSHARP_MANAGED_UI_HANDLE"]  =
                            MsiRuntime.Data["WIXSHARP_MANAGED_UI_HANDLE"] = shellView.Handle.ToString();
                        try
                        {
                            var data = MsiRuntime.Session.GetEmbeddedData("ui_shell_icon");
                            using (var stream = new System.IO.MemoryStream(data))
                                shellView.Icon = new Icon(stream);
                        }
                        catch { }
                        ManagedProject.InvokeClientHandlers(MsiRuntime.Session, "UILoaded", (IShellView)shellView);
                        MsiRuntime.Data.MergeReplace(MsiRuntime.Session["WIXSHARP_RUNTIME_DATA"]);;  //data may be changed in the client handler
                    };
                    GoNext();
                    shellView.ShowDialog();
                }
                else
                {
                    this.StartExecute();
                    while (!finished)
                    {
                        Thread.Sleep(1000);
                    }
                }
            }
            else
            {
                MsiRuntime.Session.Log("UIInitialized returned " + result);
            }
        }
Пример #5
0
 public virtual void RemoveBlockingUI(IManagedUI ui)
 {
     if (!blockingUIs.ContainsKey(ui))
     {
         return;
     }
     blockingUIs.Remove(ui);
     ui.OnVisibilityChanged -= HandleBlockingUIVisibilityChanged;
     HandleBlockingUIVisibilityChanged(ui.Visible);
 }
Пример #6
0
 public virtual void AddBlockingUI(IManagedUI ui, params string[] allowedSamplers)
 {
     if (blockingUIs.ContainsKey(ui))
     {
         return;
     }
     blockingUIs.Add(ui, allowedSamplers);
     ui.OnVisibilityChanged += HandleBlockingUIVisibilityChanged;
     HandleBlockingUIVisibilityChanged(ui.Visible);
 }
Пример #7
0
        /// <summary>
        /// Shows the modal window of the MSI UI. This method is called by the <see cref="T:Microsoft.Deployment.WindowsInstaller.IEmbeddedUI" />
        /// when it is initialized at runtime.
        /// </summary>
        /// <param name="msiRuntime">The MSI runtime.</param>
        /// <param name="ui">The MSI external/embedded UI.</param>
        public void ShowModal(MsiRuntime msiRuntime, IManagedUI ui)
        {
            //Debug.Assert(false);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            UI         = ui;
            MsiRuntime = msiRuntime;


            ActionResult result = ManagedProject.InvokeClientHandlers(MsiRuntime.Session, "UIInitialized");

            if (result == ActionResult.Success)
            {
                if (MsiRuntime.Session.IsInstalling())
                {
                    Dialogs = ui.InstallDialogs;
                }
                else if (MsiRuntime.Session.IsRepairing())
                {
                    Dialogs = ui.ModifyDialogs;
                }

                if (Dialogs.Any())
                {
                    shellView       = new ShellView();
                    shellView.Load += (s, e) =>
                    {
                        ManagedProject.InvokeClientHandlers(MsiRuntime.Session, "UILoaded", (IShellView)shellView);
                    };
                    GoNext();
                    shellView.ShowDialog();
                }
                else
                {
                    this.StartExecute();
                    while (!finished)
                    {
                        Thread.Sleep(1000);
                    }
                }
            }
            else
            {
                MsiRuntime.Session.Log("UIInitialized returned " + result);
            }
        }
Пример #8
0
        public void ShowModal(MsiRuntime msiRuntime, IManagedUI ui)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            shellView = new ShellView();

            UI = ui;
            MsiRuntime = msiRuntime;

            if (MsiRuntime.Session.IsInstalling())
            {
                Dialogs = ui.InstallDialogs;
            }
            else if (MsiRuntime.Session.IsRepairing())
            {
                Dialogs = ui.ModifyDialogs;
            }

            GoNext();

            shellView.ShowDialog();
        }
Пример #9
0
        /// <summary>
        /// Shows the modal window of the MSI UI. This method is called by the <see cref="T:Microsoft.Deployment.WindowsInstaller.IEmbeddedUI" />
        /// when it is initialized at runtime.
        /// </summary>
        /// <param name="msiRuntime">The MSI runtime.</param>
        /// <param name="ui">The MSI external/embedded UI.</param>
        public void ShowModal(MsiRuntime msiRuntime, IManagedUI ui)
        {
            // Debug.Assert(false);
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            UI               = ui;
            MsiRuntime       = msiRuntime;
            Tasks.UILocalize = text => text.LocalizeWith(msiRuntime.Localize);

            UACRevealer.Enabled = !MsiRuntime.Session.Property("UAC_REVEALER_ENABLED").IsEmpty();

            if (MsiRuntime.Session.IsInstalling())
            {
                Dialogs = ui.InstallDialogs;
            }
            else if (MsiRuntime.Session.IsRepairing())
            {
                Dialogs = ui.ModifyDialogs;
            }

            if (Dialogs.Any())
            {
                shellView = new ShellView {
                    Shell = this
                }
            }
            ;

            try
            {
                int culture = msiRuntime.Session.Property("ProductLanguage").ToInt();
                if (culture != 0)
                {
                    Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);
                }
            }
            catch { }

            ActionResult result = ManagedProject.InvokeClientHandlers(MsiRuntime.Session, "UIInitialized", shellView as IShellView);

            MsiRuntime.Data.MergeReplace(MsiRuntime.Session["WIXSHARP_RUNTIME_DATA"]); //data may be changed in the client handler

            if (result != ActionResult.Failure)
            {
                if (shellView != null)
                {
                    shellView.Load += (s, e) =>
                    {
                        MsiRuntime.Session["WIXSHARP_MANAGED_UI_HANDLE"]  =
                            MsiRuntime.Data["WIXSHARP_MANAGED_UI_HANDLE"] = shellView.Handle.ToString();
                        try
                        {
                            var data = MsiRuntime.Session.GetEmbeddedData("ui_shell_icon");
                            using (var stream = new System.IO.MemoryStream(data))
                                shellView.Icon = new Icon(stream);
                        }
                        catch { }

                        result = ManagedProject.InvokeClientHandlers(MsiRuntime.Session, "UILoaded", (IShellView)shellView);
                        if (result != ActionResult.Success)
                        {
                            // aborting UI dialogs sequence from here is not possible as this event is
                            // simply called when Shell is loaded but not when dialogs are progressing in the sequence.
                            MsiRuntime.Session.Log("UILoaded returned " + result);
                        }
                        MsiRuntime.Data.MergeReplace(MsiRuntime.Session["WIXSHARP_RUNTIME_DATA"]);;  //data may be changed in the client handler
                    };

                    if (result == ActionResult.SkipRemainingActions)
                    {
                        result = ActionResult.Success;
                        if (Dialogs.Contains(typeof(UI.Forms.ProgressDialog)))
                        {
                            GoTo <UI.Forms.ProgressDialog>();
                        }
                        else
                        {
                            GoToLast();
                        }
                    }
                    else if (result == ActionResult.UserExit)
                    {
                        GoToLast();
                    }
                    else
                    {
                        GoNext();
                    }

                    shellView.ShowDialog();
                }
                else
                {
                    this.StartExecute();
                    while (!finished)
                    {
                        Thread.Sleep(1000);
                    }
                }
            }
            else
            {
                MsiRuntime.Session.Log("UIInitialized returned " + result);
            }
        }
Пример #10
0
 /// <summary>
 /// Hides the UI gradually over default duration by invoking <see cref="IManagedUI.ChangeVisibilityAsync"/> in "fire and forget" fashion.
 /// </summary>
 public static void Hide(this IManagedUI ui) => ui.ChangeVisibilityAsync(false).Forget();
Пример #11
0
 /// <summary>
 /// Shows the UI gradually over default duration by invoking <see cref="IManagedUI.ChangeVisibilityAsync"/> in "fire and forget" fashion.
 /// </summary>
 public static void Show(this IManagedUI ui) => ui.ChangeVisibilityAsync(true).Forget();