private void AppendMessage(object sender, MessageEventArgs args) { try { string message = Log.TimeStamp + " " + args.Message; if (!OutputRTB.Dispatcher.CheckAccess()) { OutputRTB.Dispatcher.Invoke( DispatcherPriority.Normal, new Action( delegate { OutputRTB.AppendText(message + Environment.NewLine); OutputRTB.ScrollToEnd(); } )); } else { OutputRTB.AppendText(message + Environment.NewLine); OutputRTB.ScrollToEnd(); } } catch (Exception ex) { Logging.Log(ex); } }
private void MetroWindow_Loaded_1(object sender, RoutedEventArgs e) { Log.Initialize(); Logging.Instance = new Logging(); Logging.OnWrite += AppendMessage; OutputRTB.AppendText(Updater.GetNews() + Environment.NewLine); OutputRTB.ScrollToEnd(); Logging.Log("CoolFish Version: " + Utilities.Utilities.Version); BotManager.StartUp(); UpdateControlSettings(); Utilities.Utilities.SetLanguage(this); _timer = new Timer(Callback, null, 0, 30 * 60 * 1000); if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1) { FontSize = 3; BackgroundColorObj.Color = Color.FromArgb(0xFF, 0xFF, 0x5C, 0xCD); GradientStopObj.Color = Color.FromArgb(0xFF, 0xFF, 0xFF, 0xFF); MessageBox.Show("Happy April 1st! :)"); } BotBaseCB_DropDownOpened(null, null); BotBaseCB.SelectedIndex = 0; new Task(Updater.Update).Start(); _processes = GetWowProcesses(); if (_processes.Length == 1) { BotManager.AttachToProcess(_processes[0]); } }