/// <summary> /// Show tracer window with thread. /// Tracer window works busy, then this function is threading. /// </summary> /// <param name="sender">object(MenuItem)</param> /// <param name="e">EventArgs</param> void ShowTracerWindow(Object sender, EventArgs e) { m_win = new TraceWindow(this); m_win.Disposed += new EventHandler(FormDisposed); m_win.Text = MessageResources.TracerWindow + m_winCount; m_win.Name = MessageResources.TracerWindow + m_winCount; m_win.TabText = m_win.Text; m_win.DataFormat = m_dataformat; m_winCount++; // Set Dock settings DockPanel panel = m_pManager.DockPanel; m_win.DockHandler.DockPanel = panel; m_win.DockHandler.FloatPane = panel.DockPaneFactory.CreateDockPane(m_win, DockState.Float, true); FloatWindow fw = panel.FloatWindowFactory.CreateFloatWindow( panel, m_win.FloatPane, new Rectangle(m_win.Left, m_win.Top, m_win.Width, m_win.Height)); m_win.Pane.DockTo(fw); SetDockContentDelegate dlg = m_env.PluginManager.GetDelegate(Constants.delegateSetDockContents) as SetDockContentDelegate; if (dlg != null) dlg(m_win); m_winList.Add(m_win); m_win.Show(); m_win.SetDefaultSetting(m_setting); }
/// <summary> /// The action of disposing tracer window. /// </summary> /// <param name="sender">Tracer Window.</param> /// <param name="e">EventArgs.</param> void FormDisposed(object sender, EventArgs e) { TraceWindow tmp = sender as TraceWindow; if (tmp == null) return; m_winList.Remove(tmp); if (m_win == tmp) m_win = null; if (m_win == null && m_winList.Count > 0) { m_win = m_winList[m_winList.Count - 1]; } }
/// <summary> /// Import the log data from the file to the selected window. /// </summary> /// <param name="fileName">the log file name.</param> /// <param name="win">the window displayed the log.</param> public void ImportLog(string fileName, TraceWindow win) { try { if (fileName == null) { m_openFileDialog.FileName = ""; m_openFileDialog.Filter = Constants.FilterLogFile; if (m_openFileDialog.ShowDialog() != DialogResult.OK) return; fileName = m_openFileDialog.FileName; } if (m_logList.ContainsKey(fileName)) { if (win != null) { m_owner.ChangeDisplayStatus(m_logList[fileName], win.Name, true); } return; } LogData log = m_owner.DataManager.LoadSimulationResult(fileName); if (log.logValueList.Count <= 0) { Util.ShowWarningDialog(string.Format(MessageResources.WarnNoLog, fileName)); return; } string[] ele = log.propName.Split(new char[] { ':' }); string propName = "Log:" + log.key + ":" + ele[ele.Length - 1]; LoggerEntry entry = new LoggerEntry(log.model, log.key, log.type, propName); entry.IsLoaded = true; entry.FileName = fileName; m_logList.Add(fileName, entry); m_owner.LoggerManager_LoggerAddEvent(null, new LoggerEventArgs(entry.FullPN, entry)); } catch (Exception) { Util.ShowErrorDialog(String.Format(MessageResources.ErrInvalidFile, fileName)); } }