private void StartMenu_Closed(object sender, EventArgs e) { try {//Выключаем потом обновления локальной БД UpdateLocalBdBool = false; UpdateLocalBd.Abort(); } catch { } if (!set.Emulator) { DisposeScaner(); } BufferToBD.StopReadBuffer(); CLog.WriteInfo("StartMenu.cs", "Close UI Form"); }
private void InitCheckVersion() { try { Thread.Sleep(2000); CheckVersion = false; WebReference.WebSDataBrCode BrServer = new WebReference.WebSDataBrCode(); BrServer.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap12; BrServer.BrHeaderValue = CBrHeader.GetHeader(); BrServer.Credentials = new NetworkCredential(CBrHeader.Login, CBrHeader.Password); BrServer.Url = set.AdressAppServer; Double CStableVer = BrServer.GET_ACTUAL_VERSION_CLIENT(); Double ClientVer = Double.Parse(CBrHeader.ClientVersion.Replace('.', ',')); if (ClientVer < CStableVer) {//Необходимо обновить ПО if (MessageBox.Show("Необходимо обновить ПО, запустить обновление?", "Обновление", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) == DialogResult.OK) { ProcessStartInfo processStartInfo = new ProcessStartInfo(); processStartInfo.FileName = @"DataBrCode\DataBrUpdater.exe"; processStartInfo.WorkingDirectory = @"DataBrCode\"; processStartInfo.Arguments = "/AutoUpdate"; try { Process.Start(processStartInfo); try {//Выключаем потом обновления локальной БД UpdateLocalBdBool = false; UpdateLocalBd.Abort(); } catch { } if (!set.Emulator) { DisposeScaner(); } BufferToBD.StopReadBuffer(); Application.Exit(); } catch (Exception f) { MessageBox.Show(f.ToString()); } } } else if (ClientVer == CStableVer) { labelBD.BeginInvoke(new Action(() => { labelBD.Text = "Актуальная версия"; })); Thread.Sleep(5000); } else { labelBD.BeginInvoke(new Action(() => { labelBD.Text = "Используется версия для разработчиков"; labelBD.ForeColor = Color.Yellow; })); Thread.Sleep(5000); } CheckVersion = true; } catch (Exception) { } timerUpdateRelise.Enabled = true; }