Beispiel #1
0
        private void PipeServer_PipeMessage(object sender, PipeEventArg e)
        {
            try
            {
                if (e.Message.Contains("IPUSUCCESS"))
                {
                    IpuSuccess();
                    return;
                }

                if (e.Message.Contains("IPUERROR"))
                {
                    IpuError();
                    return;
                }

                if (e.Message.Contains("STARTPROGRESS"))
                {
                    UnsafeNativeMethods.Run(_progressApp, string.Empty, false);
                    return;
                }

                var cmd = JsonConvert.DeserializeObject <PipeCommand>(e.Message);

                switch (cmd.Action)
                {
                case "ResetAutoEnforceFlag":
                    ResetAutoEnforceFlag();
                    break;

                case "InstallIpuApplication":
                    InstallIpuApplication(new CMApplication {
                        Id = cmd.AppId, Revision = cmd.AppRevision
                    });
                    break;
                }
            }
            catch (Exception ex)
            {
                Globals.Log.Error(ex.Message);
            }
        }
Beispiel #2
0
        private void PipeServer_PipeMessage(object sender, PipeEventArg e)
        {
            switch (e.Message.TrimEnd('\0').Trim())
            {
            case "SetBlue":
                Dispatcher.Invoke(() =>
                {
                    Globals.NotifyIcon.IconSource = new BitmapImage(new Uri("pack://application:,,,/Icons/product.ico"));
                });
                break;

            case "SetRed":
                Dispatcher.Invoke(() =>
                {
                    Globals.NotifyIcon.IconSource = new BitmapImage(new Uri("pack://application:,,,/Icons/red.ico"));
                });
                break;

            case "Close":
                Environment.Exit(0);
                break;
            }
        }