private void Window_Closed(object sender, EventArgs e) { try { CloseLogFiles(); if (_isUpdate) { ManagerFs.Update(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Button_Click() Exception", MessageBoxButton.OK, MessageBoxImage.Error); } }
private bool isActualVersion() { bool isActual = true; try { DateTime currentFileDate = ManagerFs.GetCurrentFileDate(); DateTime actualFileDate = ManagerFs.GetActualFileDate(); isActual = (currentFileDate >= actualFileDate); } catch (Exception ex) { MessageBox.Show(ex.Message, "isActualVersion() Exception", MessageBoxButton.OK, MessageBoxImage.Error); } return(isActual); }
private void Proc_Exited(object sender, EventArgs e) { try { if (MediatorSema.CurrentFileType == FileType.Bat) { string ctlName = ManagerFs.GetCtlFromBat(MediatorSema.CurrentBat); string logName = ManagerFs.GetLogName(ctlName); RunTxtFile(logName); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Proc_Exited() Exception", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void CheckAndUpdateState() { try { string tableName = ManagerFs.GetTableNameFromCtl(); if (tableName == "Не найден файл контрола") { MessageBox.Show(tableName); this.Close(); return; } string curDir = ManagerFs.GetCurrentDir().FullName; string version = Assembly.GetExecutingAssembly().GetName().Version.ToString(); this.Title = curDir.Substring(curDir.IndexOf('\\') + 1) + " (" + tableName + ") v." + version; bool isTableFree = ManagerDb.IsTableFree(tableName); if (isTableFree) { ManagerDb.InsertToTable(tableName); MediatorSema.CurrentFileType = FileType.Bat; GetFiles(); } else { AskWindow askWin = new AskWindow(); askWin.Title = tableName; askWin.label_ask.Content = String.Format("Таблица занята пользователем {0} c {1}.", MediatorSema.UsingTable.UserName, MediatorSema.UsingTable.StartTime); askWin.EventExit += AskWin_EventExit; askWin.EventPickUpTable += AskWin_EventPickUpTable; askWin.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "CheckAndUpdateState() Exception", MessageBoxButton.OK, MessageBoxImage.Error); } }