private void pbxLog_Click(object sender, EventArgs e) { LogForm logForm = new LogForm(); logForm.Show(); this.Hide(); }
public TrayIcon() { Application.ApplicationExit += OnApplicationExit; InitializeComponent(); _configuration = new Configuration(); _configurationSerializer = new Utilities.ConfigurationSerializer <Configuration>("configuration.json", _configuration); _configuration = _configurationSerializer.Deserialize(); // Todo visibility dependent on configuration. If not, only show config form on 2nd startup _logForm = new LogForm() { Visible = false }; _mainForm = new MainForm(); _trayIcon.Visible = _configuration.ShowTrayIcon; InitializeApplication(); //Debug.WriteLine(Reboot.GetUptime()); //Debug.WriteLine(Reboot.GetUptime2()); //Reboot.Shutdown(ShutdownType.Reboot, ForceExit.Force,ShutdownReason.MinorOther); }
public MainForm() { InitializeComponent(); _logFormFirst = new LogForm { Text = "First", }; _logFormSecond = new LogForm { Text = "Second", }; var logFirst = new LoggerConfiguration() .WriteTo.TextWriter(_logFormFirst.TextWriter, outputTemplate: "{Timestamp:HH:mm} [{Level}] ({Name:l}) {Message}{NewLine}{Exception}") .CreateLogger(); FirstHelper.SetLogger( name => new SerilogDebugWrapper <Keeker.Test.DemoFirst.Logging.LogLevel>(logFirst).Log, message => LogContext.PushProperty("NDC", message), (key, value) => LogContext.PushProperty(key, value, false)); var logSecond = new LoggerConfiguration() .WriteTo.TextWriter(_logFormSecond.TextWriter, outputTemplate: "{Timestamp:HH:mm} [{Level}] ({Name:l}) {Message}{NewLine}{Exception}") .CreateLogger(); SecondHelper.SetLogger( name => new SerilogDebugWrapper <Keeker.Test.DemoSecond.Logging.LogLevel>(logSecond).Log, message => LogContext.PushProperty("NDC", message), (key, value) => LogContext.PushProperty(key, value, false)); _first = new FirstComponent(); _second = new SecondComponent(); }
private void LogFormInit() { logForm = new LogForm(); logForm.completeDidClick += NewLogAvailable; logForm.MdiParent = this; logForm.Show(); }
public MainForm(UIMain uiMain, LogForm logForm, GraphForm graphForm, JsonEditForm jsonEditForm, SettingsForm settingsForm) { InitializeComponent(); m_originalTitle = Text; m_uiMain = uiMain; LogForm = logForm; LogForm.Show(dockPanel, DockState.DockBottom); //GraphForm = graphForm; //GraphForm.Show(dockPanel, DockState.Document); // TODO(HonzaS): The blueprint should be in the Designer later. //GraphForm.AgentBlueprint = m_uiMain.AgentBlueprint; JsonEditForm = jsonEditForm; JsonEditForm.Show(dockPanel, DockState.Document); SettingsForm = settingsForm; SettingsForm.Show(dockPanel, DockState.DockRight); SubscribeToUiMain(); UpdateButtons(); }
private void OnFIleMenuExportClick(object sender, EventArgs e) { var result = exportHostDialog.ShowDialog(this); if (result != DialogResult.Yes && result != DialogResult.OK) { return; } try { using var stream = exportHostDialog.OpenFile(); using var writer = new StreamWriter(stream, Encoding.UTF8); writer.Write(JsonConvert.SerializeObject(Settings.Default.hosts)); MessageBox.Show( string.Format(Resources.StrExportFileAt, exportHostDialog.FileName), Resources.StrExportSuccess, MessageBoxButtons.OK, MessageBoxIcon.Information ); } catch (Exception exception) { LogForm.Error("导出文件出现错误:" + exception.Message); MessageBox.Show( exception.Message, Resources.StrExportFileError, MessageBoxButtons.OK, MessageBoxIcon.Error ); } }
private void button2_Click(object sender, EventArgs e) { this.FixedSingle(); appSetting = (AppSetting)propertyGrid1.SelectedObject; appSetting.SaveSelf(appSetting); LogForm.Info(appSetting.ToJson()); var c = 0; var x5 = 0; for (int i = 1; i <= 10; i++) { c += i * i; x5 += i * 5; LogForm.Successful($"**:{c} +%=:{x5}"); } var res = RetryHelper.RetryOnAny <string>(times: 0, () => { return(SayHello()); }, (i, ex) => { MessageBox.Show($"出现异常_{i}_{ex.Message}"); }); MessageBox.Show(res); }
/// <summary> /// 写日志 /// </summary> /// <param name="logType">日志类型</param> /// <param name="logSource">日志源(模块名)</param> /// <param name="logContent">日志信息</param> /// <returns></returns> bool ILogService.Log(object logContent, LogType logType, object logSource) { if (!f_Enable) { return(false); } if (logType > f_LogLevel) { return(false); } SwitchLogFile(); string logMsg = string.Format(LOG_MSG_FORMAT, LogTypeToStr(logType), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"), logSource, logContent); if (IsDebug) { while (LogForm == null) { Thread.Sleep(50); } LogForm?.WriteLog(logMsg); WriteLog(logMsg); } else { WriteLog(logMsg); } return(true); }
private void buttonEvent() { if (parentName != null) { // 弹出加载提示框 //DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(typeof(WaitingForm)); if (parentName.Equals("UserForm")) { UserForm form = this.Parent as UserForm; form.SearchData(CurrentPage); } else if (parentName.Equals("DictForm")) { DictForm form = this.Parent as DictForm; form.SearchData(false, CurrentPage); } else if (parentName.Equals("LogForm")) { LogForm form = this.Parent as LogForm; form.SearchData(false, CurrentPage); } else if (parentName.Equals("ClientVersionForm")) { ClientVersionForm form = this.Parent as ClientVersionForm; form.SearchData(false, CurrentPage); } } }
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) { progressBar1.Value = e.ProgressPercentage; LogForm.changePercentageProgress(e.ProgressPercentage); logLabel.Text = tempLog; LogForm.appendLog(tempLog); }
public MainForm() { InitializeComponent(); _logForm = new LogForm(); _lock = new object(); }
private void logItem_Click(object sender, EventArgs e) { if (mLogForm == null || mLogForm.IsDisposed) { mLogForm = new LogForm(); } mLogForm.Show(); }
private void btnLog_Click(object sender, EventArgs e) { CatchText(); return; LogForm form1 = new LogForm(); form1.ShowDialog(this); }
public void Show() { if (Form == null || Form.IsDisposed) { Form = new LogForm(); } Form.Messages = Messages; Form.Show(); Form.Activate(); }
/// <summary> /// Show the LocoIO inspector form /// </summary> private void ShowLog() { if (logForm == null) { logForm = new LogForm(); logForm.FormClosed += (s, x) => logForm = null; } logForm.Initialize(appState.RailwayState); logForm.Show(this); }
public void ShowInfo(LogForm form) { form.lblPlayer.Text = $"X = {_objects.Player.X}, Y = {_objects.Player.Y}"; AddItems(form.lbTanks, _objects.Tanks.Select(i => i as GameObject).ToList()); AddItems(form.lbBullets, _objects.Bullets.Select(i => i as GameObject).ToList()); AddItems(form.lbApples, _objects.Apples.Select(i => i as GameObject).ToList()); AddItems(form.lbWalls, _objects.Walls.Select(i => i as GameObject).ToList()); AddItems(form.lbBangs, _objects.Bangs.Select(i => i as GameObject).ToList()); }
private void SaveAs() { SaveFileDialog dialog = new SaveFileDialog(); dialog.RestoreDirectory = true; dialog.AddExtension = true; if (ActiveMdiChild is Browser) { Browser child = (Browser)this.ActiveMdiChild; dialog.DefaultExt = "dcm"; dialog.Filter = "All files|*.*|Dicom Files (*.dcm)|*.dcm|Text Files (*.txt)|*.txt"; if (child.FileName == null || child.FileName.Length == 0) { DataSet dicom = child.Dicom; dialog.FileName = (dicom.Contains(t.SOPInstanceUID)) ? (string)dicom[t.SOPInstanceUID].Value + ".dcm" : "untitled.dcm"; } } else if (ActiveMdiChild is LogForm) { dialog.DefaultExt = "log"; dialog.Filter = "All files|*.*|Log Files (*.log)|*.log"; dialog.FileName = String.Format("{0}", DateTime.Now.ToString("yyyyMMddHHmmss")); } else { return; } if (dialog.ShowDialog() == DialogResult.OK) { if (ActiveMdiChild is Browser) { Browser child = (Browser)this.ActiveMdiChild; FileInfo info = new FileInfo(dialog.FileName); if (info.Extension.ToLower() == ".txt") { BatchEditor.Save(child.Dicom, dialog.FileName); } else { child.FileName = dialog.FileName; child.Save(); } } else if (ActiveMdiChild is LogForm) { LogForm child = (LogForm)this.ActiveMdiChild; child.Save(dialog.FileName); } } }
public void KeyDown(Keys key) { if (!isGame) { StartGame(); return; } switch (key) { case Keys.A: case Keys.Left: _objects.Player.ChangeDirection(MobileObject.left); break; case Keys.W: case Keys.Up: _objects.Player.ChangeDirection(MobileObject.up); break; case Keys.D: case Keys.Right: _objects.Player.ChangeDirection(MobileObject.right); break; case Keys.S: case Keys.Down: _objects.Player.ChangeDirection(MobileObject.down); break; case Keys.Space: CreateBullet(_objects.Player); break; case Keys.R: StartGame(); break; case Keys.P: // Ставим на паузу _view.ActiveTimer = false; timer.Stop(); // Запускаем форму лога LogForm form = new LogForm(); ShowInfo(form); form.ShowDialog(); // продолжаем игру timer.Start(); _view.ActiveTimer = true; break; } }
public static void Log(object messages, LogForm form, int size) { if (isOpenLog()) { switch (form) { case LogForm.Default: if (messages != null) { Debug.Log("<size=" + size + ">" + messages.ToString() + "</size>"); } else { #if UNITY_EDITOR Debug.LogError("<size=" + size + ">Please Check Your Params, It's null</size>"); #else Debug.Log("<size=" + size + ">Please Check Your Params, It's null</size>"); #endif } break; case LogForm.Waring: if (messages != null) { Debug.LogWarning("<size=" + size + ">" + messages.ToString() + "</size>"); } else { #if UNITY_EDITOR Debug.LogError("<size=" + size + ">Please Check Your Params, It's null</size>"); #else Debug.Log("<size=" + size + ">Please Check Your Params, It's null</size>"); #endif } break; case LogForm.Error: if (messages != null) { Debug.LogError("<size=" + size + ">" + messages.ToString() + "</size>"); } else { #if UNITY_EDITOR Debug.LogError("<size=" + size + ">Please Check Your Params, It's null</size>"); #else Debug.Log("<size=" + size + ">Please Check Your Params, It's null</size>"); #endif } break; } } }
private void CloseMenuItem_Click(object sender, EventArgs e) { if (this.ActiveMdiChild is LogForm) { logging.Close(); logging.Dispose(); logging = null; } else if (this.ActiveMdiChild != null) { this.ActiveMdiChild.Close(); } }
private void m_settings_SettingChanged(object sender, SettingChangedEventArgs e) { if (e.SettingName == EventViewerSettings.SettingDisplayTimeZone) { m_timeZone = m_settings.DisplayTimeZone; if (m_timePropertyWrapper != null) { m_timePropertyWrapper.SetValue(LogForm.GetEventMessageTime(m_eventMessage, m_timeZone)); panes.gridDetails.Invalidate(true); // Must be called to refresh the grid immediately. } } }
public void SaveAs() { try { SaveFileDialog dialog = new SaveFileDialog(); dialog.RestoreDirectory = true; dialog.AddExtension = true; if (ActiveMdiChild is Viewer) { Viewer child = (Viewer)this.ActiveMdiChild; dialog.DefaultExt = "dcm"; dialog.Filter = Viewer.Filter; if (child.FileName == null || child.FileName.Length == 0) { DataSet dicom = child.Dicom; dialog.FileName = (dicom.Contains(t.SOPInstanceUID)) ? (string)dicom[t.SOPInstanceUID].Value + ".dcm" : "untitled.dcm"; } } else if (ActiveMdiChild is LogForm) { dialog.DefaultExt = "log"; dialog.Filter = "All files|*.*|Log Files (*.log)|*.log"; dialog.FileName = String.Format("{0}", DateTime.Now.ToString("yyyyMMddHHmmss")); } else { return; } if (dialog.ShowDialog() == DialogResult.OK) { if (ActiveMdiChild is Viewer) { Viewer child = (Viewer)this.ActiveMdiChild; child.SaveAs(dialog.FileName); } else if (ActiveMdiChild is LogForm) { LogForm child = (LogForm)this.ActiveMdiChild; child.Save(dialog.FileName); } } } catch (Exception ex) { MessageBox.Show(Logging.Log(ex)); } }
public GuiLogger() { form = new LogForm(); form.FormClosing += delegate(object sender, FormClosingEventArgs e) { form.Clear(); form.Hide(); e.Cancel = true; }; NewLogEntry += OnNewLogEntry; }
private void ShowLog(object sender, LogEventArgs e) { if (LogForm.InvokeRequired) { Action <LogEventArgs> action = (ev) => { LogForm.AppendText(string.Format("[{0}] {1}", ev.level, ev.message)); LogForm.AppendText(a); }; this.LogForm.Invoke(action, e); } else { LogForm.Text += string.Format("[{0}] {1}", e.level, e.message) + a; } }
private MemberWrappers GetMessageProperties(EventMessage eventMessage) { MemberWrappers properties = new MemberWrappers(); // Handle exceptions from individual members to give the user a chance to see the rest of the details. try { // Convert the time to the user-configured time zone. DateTime time = LogForm.GetEventMessageTime(eventMessage, m_timeZone); m_timePropertyWrapper = new ConstantMemberWrapper("Time", time); properties.Add(m_timePropertyWrapper); properties.Add(new ConstantMemberWrapper("Event", eventMessage.Event)); properties.Add(new ConstantMemberWrapper("Source", eventMessage.Source)); properties.Add(new ConstantMemberWrapper("Type", eventMessage.Type)); properties.Add(new ConstantMemberWrapper("Method", eventMessage.Method)); try { properties.Add(new ExceptionWrapper(eventMessage.Exception)); } catch (System.Exception ex) { ((MainForm)MdiParent).HandleException(ex); } foreach (IEventDetail detail in eventMessage.Details) { try { properties.Add(new EventDetailMemberWrapper(detail)); } catch (System.Exception ex) { ((MainForm)MdiParent).HandleException(ex); } } } catch (System.Exception ex) { ((MainForm)MdiParent).HandleException(ex); } return(properties); }
private void ConnectToLog(string readerName, string initialisationString) { string displayString; IMessageReader reader; try { if (initialisationString == null) { initialisationString = _modules.GetInitialisationString(readerName); } displayString = initialisationString ?? readerName; // Create the message reader and set its initialisation string, prompting the user if necessary. reader = _modules.CreateMessageReader(readerName, initialisationString); } catch (Exception ex) { throw new ApplicationException(string.Format("Failed to initialise a '{0}' message reader" + " using configuration string '{1}'.", readerName, initialisationString), ex); } // Not found - create and show a new log form for the message reader. var form = new LogForm { MdiParent = this }; #if DEBUG form.Closed += logForm_Closed; #endif string displayText = displayString + " (" + _modules.GetDisplayName(readerName) + ")"; string fullConfigurationString = readerName + "|" + displayString + "|" + initialisationString; form.ConfigurationString = fullConfigurationString; form.Initialise(reader, displayText); form.Show(); _recentlyUsed.ItemUsed(fullConfigurationString, displayText); using (new LongRunningMonitor(this)) { form.AutoStart(); // Now that the form is visible populate it with messages. } }
private void ToggleLogging() { if (logging == null) { logging = new LogForm(); logging.MdiParent = this; logging.WindowState = FormWindowState.Maximized; logging.Show(); } else { logging.Close(); logging.Dispose(); logging = null; } LoggingMenuItem.Checked = (logging != null); }
private void simpleButtonLog_Click(object sender, EventArgs e) { var sp = DevExpressHelper.GetSelectedRecord <SalePoint>(gridViewSalePoints); if (sp != null) { try { var clientService = Protocol.CreateClientProxy(sp.IP); LogForm.Show(this, sp, clientService.GetLog()); } catch (Exception ex) { ErrorHelper.ShowError <ErrorForm>(null, ex); } } }
public static void Main(string[] args) { string v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new Form1()); form = new Form1(); logform = new LogForm(); form.logform = logform; logform.Show(); form.Statusbar = "Ready.."; form.Text = "Usenet Speedtest " + v; Application.Run(form); }
private void OnAccept(object socket) { var client = (Socket)socket; LogForm.Notice($"收到请求:{client}"); var buffer = new byte[4096]; int count; while ((count = client.Receive(buffer)) > 0) { var str = Encoding.UTF8.GetString(buffer, 0, count); LogForm.Notice($"收到消息:{str}"); } client.Send(Encoding.UTF8.GetBytes("Hello From Server")); client.Close(); }
public static void ShowLogWindow(Form mainform, SktSkype skype) { if (logWindow == null) { logWindow = new LogForm() { Width = 480, Height = 720, Text = "Wrapper log" }; logWindow.logBox = new TextBox() { Top = 1, Left = 1, Width = logWindow.ClientSize.Width, Height = logWindow.ClientSize.Height, Multiline = true, WordWrap = false, ScrollBars = System.Windows.Forms.ScrollBars.Vertical, Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom }; logWindow.Controls.Add(logWindow.logBox); mainform.FormClosing += CloseLogWindow; skype.events.OnLog += OnLog; } logWindow.Show(); }
public static void ShowLog() { if (frm == null) { frm = new LogForm(); frm.Show(); } else { if (!frm.Visible) { frm.Visible = true; frm.Activate(); } } lock (TextLog) { frm.LogText = TextLog.ToString(); } }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Idle += ApplicationIdle; ActiveClientForm = new ClientForm(); ActiveLogForm = new LogForm(); Log.Reporter = ActiveLogForm; ApplicationContext = new ApplicationContext(); ApplicationContext.MainForm = new LoginForm(); ChatManager = new ChatManager(); DiceManager = new DiceManager(); Socket = new Network(); ActiveLogForm.Show(); Application.Run(ApplicationContext); }