public MainWindow() { bool existed; // получаем GIUD приложения string guid = Marshal.GetTypeLibGuidForAssembly(System.Reflection.Assembly.GetExecutingAssembly()).ToString(); Mutex mutexObj = new Mutex(true, guid, out existed); if (!existed) { System.Windows.MessageBox.Show("Уже есть запущенная копия " + guid); this.Close(); } header = this; this.Title = NameServer; InitializeComponent(); SETTING.ReadFromXML(); data.getTickers(); //Подписки ViewModelMain.winadd += ViewModelMain_winadd; ViewModelMain.winerr += ViewModelMain_winerr; mes.Event_Print += new Action <string, object>(add); //QUIKSHARPconnector.Event_CMD += new Action<int, int, int, string>(cmd); //Pipe.Event_Print += new Action<string, object>(add); //Pipe.Event_CMD += new Action<int, int, int, string>(cmd); // use a timer to periodically update the memory usage DispatcherTimer timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 0, 0, 1000); timer.Tick += Timer_Tick; timer.Start(); // use a timer to periodically update the memory usage DispatcherTimer timer2 = new DispatcherTimer(); timer2.Interval = new TimeSpan(1, 0, 0); timer2.Tick += Timer_TickHOUR; timer2.Start(); var path = System.IO.Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName); //Install - Package Serilog //Install - Package Serilog.Sinks.Literate //Install - Package Serilog.Sinks.RollingFile Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .WriteTo.LiterateConsole() .WriteTo.RollingFile(path + "\\logs\\{Date} Cobra Data Server.txt", fileSizeLimitBytes: 100000000) .CreateLogger(); Log.Debug("Start Cobra Data Server"); }
private void Button_Click_2(object sender, RoutedEventArgs e) { SETTING.SaveInXmlFormat(); }