void client_GetUpDateFileCompleted(object sender, ConferenceVersionWebservice.GetUpDateFileCompletedEventArgs e)
        {
            try
            {
                //获取需要关闭的进程
                var ProceList = this.Split(this.CutProcess, SplitString);

                foreach (var item in ProceList)
                {
                    var processList = Process.GetProcessesByName(item);
                    foreach (var item2 in processList)
                    {
                        item2.Kill();
                    }
                }

                this.UpdateFile     = e.Result.UpdateFile;
                this.UpdateRootFile = e.Result.UpdateRootFile;


                DispatcherTimer timer = new DispatcherTimer();
                timer.Interval = TimeSpan.FromMilliseconds(1000);
                timer.Tick    += (object e1, EventArgs args) =>
                {
                    //获取需要关闭的进程
                    var       ProceList2             = this.Split(this.CutProcess, SplitString);
                    Process[] processConferenceArray = null;
                    if (ProceList2.Count() >= 1)
                    {
                        processConferenceArray = Process.GetProcessesByName(ProceList2[1]);
                    }

                    if (processConferenceArray.Count() == 0)
                    {
                        UpdateInit();
                        timer.Stop();
                    }
                };
                timer.Start();
            }
            catch (Exception ex)
            {
            }
        }
Example #2
0
        /// <summary>
        /// 获取版本更新文件完成事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void client_GetUpDateFileCompleted(object sender, ConferenceVersionWebservice.GetUpDateFileCompletedEventArgs e)
        {
            try
            {
                //获取需要关闭的进程
                var ProceList = this.Split(this.CutProcess, SplitString);
                //通过遍历去关闭需要关闭的进程
                foreach (var item in ProceList)
                {
                    //获取遍历中的进程(通过进程名称)
                    var processList = Process.GetProcessesByName(item);
                    //遍历干掉对应的进程
                    foreach (var item2 in processList)
                    {
                        //结束进程
                        item2.Kill();
                    }
                }
                //获取需要更新的文件
                this.UpdateFile = e.Result.UpdateFile;
                //获取需要更新的目录
                this.UpdateRootFile = e.Result.UpdateRootFile;

                this.Dispatcher.BeginInvoke(new Action(() =>
                {
                    System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
                    timer.Interval = 1000;
                    timer.Tick    += ((object obj1, EventArgs e1) =>
                    {
                        //更新初始化
                        UpdateInit();
                        timer.Stop();
                    });
                    timer.Start();
                }));
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
        }