コード例 #1
0
        public WaitForProcces(IEnumerable <string> prs)
        {
            InitializeComponent();

            Title             = UIStrings.Str("UPDATER");
            BtnRetry.Content  = UIStrings.Str("RETRY");
            BtnCancel.Content = UIStrings.Str("CANCEL");
            LblMessage.Text   = UIStrings.Str("WAIT_MSG");

            LBProccesses.ItemsSource = prs;
        }
コード例 #2
0
ファイル: MainWorkItem.cs プロジェクト: hummerd/AppManager
        public void Run()
        {
            try
            {
#if DEBUG
                CommonLib.Windows.MsgBox.Show(null, "AttachDebug", "");
#endif

                string installerPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

                var installInfo = XmlSerializeHelper.DeserializeItem(
                    typeof(InstallInfo),
                    Path.Combine(installerPath, InstallInfo.InstallInfoFileName)
                    ) as InstallInfo;

                bool notAlredyRunning;
                _UpdatingFlag = new Mutex(true, InstallInfo.InstallInfoMutexPrefix + installInfo.AppName, out notAlredyRunning);
                if (!notAlredyRunning)
                {
                    //RunExecutables(installInfo.InstallPath, installInfo.ExecutePaths, null);
                    Application.Current.Shutdown();
                    return;
                }
                //_UpdatingFlag.WaitOne();

                var downloadManifest = XmlSerializeHelper.DeserializeItem(
                    typeof(VersionManifest),
                    Path.Combine(installInfo.TempPath, VersionManifest.DownloadedVersionManifestFileName)
                    ) as VersionManifest;

                //VersionItem badItem;
                //if (!CheckHash(installInfo.TempPath, downloadManifest.VersionItems, out badItem))
                //{
                //    ErrorBox.Show(
                //        UIStrings.Str("UPDATER"),
                //        UIStrings.Str("BAD_VERSION"),
                //        badItem == null ? String.Empty : badItem.InstallAction + " - " + badItem.Location);
                //    RunExecutables(installInfo.InstallPath, installInfo.ExecutePaths, null);
                //    CleanUp(installInfo.TempPath);
                //    Application.Current.Shutdown();
                //    return;
                //}

                WaitForProccesses(installInfo.LockProcess);
                InstallUpdate(installInfo.TempPath, installInfo.InstallPath, downloadManifest.VersionItems);
                RunExecutables(installInfo.InstallPath, installInfo.ExecutePaths, downloadManifest.VersionItems);
                CleanUp(installInfo.TempPath);
            }
            catch (Exception exc)
            {
                ErrorBox.Show(UIStrings.Str("UPDATER"), exc);
            }

            if (_UpdatingFlag != null)
            {
                //_UpdatingFlag.ReleaseMutex();
                _UpdatingFlag.Close();
            }

            Application.Current.Shutdown();
        }