public static void InitMonitorMainForm(MonitorForm form) { ControlHelper.FreezeControl(form, true); MainForm = form; mediator = new Mediator(form); mediator.DockPanel = form.dockPanel; mediator.parent = form; mediator = new Mediator(form); mediator.DockPanel = form.dockPanel; //读取发布工程的数据库 form.WindowState = FormWindowState.Maximized; form.FormClosed += Form_FormClosed; mediator.OpenLogForm(); mediator.OpenIOStatusForm(); mediator.OpenIOPropertiesForm(); mediator.OpenIOMonitorForm(); //加载IO树 mediator.IOStatusForm.LoadTreeStatus(); //开启日志功能 Scada.Logger.Logger.GetInstance().Run(); //将系统监视的事件和日志输出到日志窗体 IOMonitorManager.OnMonitorException += Monitor_ExceptionHanped; IOMonitorManager.OnMonitorLog += IOMonitor_MakeLog; MonitorDataBaseModel.OnDataBaseExceptionHanped += Monitor_ExceptionHanped; MonitorDataBaseModel.OnDataBaseLoged += IOMonitor_MakeLog; }
public void OpenSshSessionWindow(SessionConfig sessionConfig) { FATabStripItem page = new FATabStripItem(); MonitorForm form = new MonitorForm(sessionConfig); form.FormBorderStyle = FormBorderStyle.None; form.TopLevel = false; form.Dock = DockStyle.Fill; form.Show(); page.Tag = sessionConfig; page.Name = "page-" + TAB_INDEX; page.Title = string.Format("{0} {1}", faTab.Items.Count + 1, sessionConfig.Name); page.Controls.Add(form); TAB_MONITOR.Add(page, form); faTab.Items.Add(page); faTab.SelectedItem = page; page.ContextMenuStrip = contextMenuStrip1; TAB_INDEX++; tsl_info1.Text = sessionConfig.Host + "@" + sessionConfig.UserName; }
private void monitorButton_Click(object sender, EventArgs e) { MonitorForm form = new MonitorForm(); Hide(); form.Show(); }
public void ShowTagDesignerForm() { var frm = new MonitorForm(PLCAddressValue); frm.OnTagSelected_Clicked += tagName => { SetProperty(_SevenSegment, "PLCAddressValue", tagName); }; frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(); }
public void ShowTagDesignerForm() { var frm = new MonitorForm(TagName); frm.OnTagSelected_Clicked += tagName => { SetProperty(_HMILinearMeter, "TagName", tagName); }; frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(); }
private void ShowTagList() { var frm = new MonitorForm(PLCAddressValue); frm.OnTagSelected_Clicked += tagName => { SetProperty(_HMIbutton, "PLCAddressValue", tagName); }; frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(); }
private void ShowTagListForm() { var frm = new MonitorForm(PLCAddressValue); frm.OnTagSelected_Clicked += tagName => { var pd = TypeDescriptor.GetProperties(_HMIEditor)["TagName"]; pd.SetValue(_HMIEditor, tagName); }; }
private void tool_fullscreen_Click(object sender, EventArgs e) { FATabStripItem tab = (FATabStripItem)faTab.SelectedItem; if (tab != null && TAB_MONITOR.ContainsKey(tab)) { MonitorForm form = TAB_MONITOR[tab]; form.CallFullScreen(); } }
private void ShowTagListForm() { MonitorForm tagCollectionForm = new MonitorForm(); tagCollectionForm.OnTagSelected_Clicked = (EventTagSelected)Delegate.Combine(tagCollectionForm.OnTagSelected_Clicked, (EventTagSelected) delegate(string tagName) { SetProperty(_HMIValve, "TagName", tagName); }); tagCollectionForm.StartPosition = FormStartPosition.CenterScreen; tagCollectionForm.ShowDialog(); }
private void ShowTagClick() { var frm = new MonitorForm(this.PLCAddressClick); frm.OnTagSelected_Clicked += PLCAddressClick => { var pd = TypeDescriptor.GetProperties(_HMIWaterPump)["PLCAddressClick"]; pd.SetValue(_HMIWaterPump, PLCAddressClick); }; frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(); }
private void ShowTagList() { var frm = new MonitorForm(TagName); frm.OnTagSelected_Clicked += tagName => { var pd = TypeDescriptor.GetProperties(shape)["TagName"]; pd.SetValue(shape, tagName); }; frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(); }
private void ShowTagList() { var frm = new MonitorForm(PLCAddressValue); frm.OnTagSelected_Clicked += tagName => { var pd = TypeDescriptor.GetProperties(_HMIbutton)["PLCAddressValue"]; pd.SetValue(_HMIbutton, tagName); }; frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(); }
public void ShowTagDesignerForm() { var frm = new MonitorForm(TagName); frm.OnTagSelected_Clicked += tagName => { var pd = TypeDescriptor.GetProperties(_LedSingleControl)["TagName"]; pd.SetValue(_LedSingleControl, tagName); }; frm.StartPosition = FormStartPosition.CenterScreen; frm.ShowDialog(); }
public void CloseFaTab(FATabStripItem tab, bool autoDisconn = false) { this.BeginInvoke((MethodInvoker) delegate() { if (TAB_MONITOR.ContainsKey(tab)) { MonitorForm form = TAB_MONITOR[tab]; TAB_MONITOR.Remove(tab); form.Disconnection(); form.Close(); faTab.Items.Remove(tab); } }); }
private void toolStripButton2_Click(object sender, EventArgs e) { if (monitorForm.IsDisposed != true) { monitorForm.Show(); //弹出这个窗口 monitorForm.Focus(); //激活显示 } else { monitorForm = new MonitorForm(); monitorForm.Show(); //弹出这个窗口 monitorForm.Focus(); //激活显示 } }
private void faTab_TabStripItemClosing(TabStripItemClosingEventArgs e) { FATabStripItem tab = e.Item; this.BeginInvoke((MethodInvoker) delegate() { if (TAB_MONITOR.ContainsKey(tab)) { MonitorForm form = TAB_MONITOR[tab]; TAB_MONITOR.Remove(tab); form.Disconnection(); form.Close(); } }); }
private void commonConfigsToolStripMenuItem_Click(object sender, EventArgs e) { FATabStripItem tab = (FATabStripItem)faTab.SelectedItem; if (tab != null && TAB_MONITOR.ContainsKey(tab)) { MonitorForm form = TAB_MONITOR[tab]; CentralServerConfigForm configForm = new CentralServerConfigForm(form); configForm.Show(this); } else { CentralServerConfigForm configForm = new CentralServerConfigForm(null); configForm.Show(this); } }
private void menuItem_lookAttr_Click(object sender, EventArgs e) { FATabStripItem tab = (FATabStripItem)faTab.SelectedItem; if (tab != null && TAB_MONITOR.ContainsKey(tab)) { MonitorForm form = TAB_MONITOR[tab]; SessionConfig sessionConfig = form.getSessionConfig(); if (null != sessionConfig) { SshSettingForm ssForm = new SshSettingForm(sessionConfig); ssForm.ShowDialog(this); RenderSessionList(); } } }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { // Attempts to obtain an IWindowsFormsEditorService. var edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (ReferenceEquals(edSvc, null)) { return(null); } using (var form = new MonitorForm(value.ToString())) { if (edSvc.ShowDialog(form) == DialogResult.OK) { return(form.lblSelectedTag.Caption); } } return(value); }
//INSTANT VB NOTE: In the following line, Instant VB substituted 'Object' for 'dynamic' - this will work in VB with Option Strict Off: public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { // Attempts to obtain an IWindowsFormsEditorService. IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (ReferenceEquals(edSvc, null)) { return(null); } using (MonitorForm form = new MonitorForm(value.ToString())) { if (edSvc.ShowDialog(form) == DialogResult.OK) { return(form.lblSelectedTagName.Text); } } // If OK was not pressed, return the original value return(value); }
//INSTANT VB NOTE: In the following line, Instant VB substituted 'Object' for 'dynamic' - this will work in VB with Option Strict Off: public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { // Attempts to obtain an IWindowsFormsEditorService. var edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (ReferenceEquals(edSvc, null)) { return(null); } // Displays a StringInputDialog Form to get a user-adjustable // string value. using (var form = new MonitorForm(value.ToString())) { if (edSvc.ShowDialog(form) == DialogResult.OK) { return(form.lblSelectedTag.Caption); } } // If OK was not pressed, return the original value return(value); }
private static void Main() { Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); using var serviceProvider = new ServiceCollection() .AddLogging(builder => builder.SetMinimumLevel(LogLevel.Trace).AddNLog("NLog.config.xml")) .AddSingleton <AppState>() .AddSingleton <ChangeLogger>() // Application context .AddSingleton <TrayApplicationContext>() .AddSingleton <NotifyIconManager>() // Menu .AddSingleton <TrayContextMenuStrip>() .AddSingleton(provider => new TrayHandlerCollection( provider.GetServices <IMenuHandler>().OrderBy(m => m.GetSortOrder()).ToArray() )) .AddSingleton <IMenuHandler, ExitMenuHandler>() .AddSingleton <IMenuHandler, ConfigureMenuHandler>() .AddSingleton <IMenuHandler, MachineControlMenuHandler>() .AddSingleton <IMenuHandler, KeepAwakeMenuHandler>() .AddSingleton <KeepAwakeTask>() .AddSingleton <IMenuHandler, MassControlMenuHandler>() // Virtual machines .AddSingleton <IMachineController, VirtualBoxInterface>() .AddSingleton <IMachineLocator, VirtualBoxInterface>() .AddSingleton(p => new VirtualBoxProxyFactory(p.GetService <ILogger <VirtualBoxProxyFactory> >(), p)) .AddTransient <VirtualMachine.VirtualBoxSdk.Proxy.Version60.VirtualBoxProxy>() .AddTransient <VirtualMachine.VirtualBoxSdk.Proxy.Version61.VirtualBoxProxy>() .AddSingleton <MachineStateUpdater>() .AddSingleton <MassController>() // Configuration .AddSingleton <IConfigurationFileLocator, UserProfileFileLocator>() .AddSingleton <IConfigurationReader, XmlConfigurationReader>() .AddSingleton <IConfigurationWriter, XmlConfigurationWriter>() .AddSingleton <ConfigurationFactory>() .AddSingleton <ConfigurationUpdater>() // Shutdown monitor .AddSingleton <MonitorForm>() .AddSingleton <ShutdownLocker>() .AddSingleton(_ => { var currentFile = Process.GetCurrentProcess().MainModule?.FileName; if (string.IsNullOrWhiteSpace(currentFile)) { throw new InvalidOperationException("Unable to retrieve current process name"); } var command = $"\"{currentFile}\" --auto-start"; return(new StartupManager("VBoxHeadlessAutoStart", command)); }) .AddSingleton <InstanceLocker>() .BuildServiceProvider(); var locker = serviceProvider.GetService <InstanceLocker>(); if (!locker.StartLock()) { MonitorForm.BroadcastConfigureMessage(); return; } var logger = serviceProvider.GetService <ILogger <TrayApplicationContext> >(); logger.LogTrace($"TrayApp {Process.GetCurrentProcess().Id} started"); var appState = serviceProvider.GetService <AppState>(); appState.OnConfigurationChange += (object sender, ConfigurationChangeEventArgs e) => // Update the log level from the configuration LogLevelConfigurationManager.SetLogLevel(e.NewConfiguration.LogLevel); // Load the change logger so it attaches its event listeners to the app state _ = serviceProvider.GetService <ChangeLogger>(); try { // Load the configuration and machines into the store appState.UpdateConfiguration(); appState.UpdateMachines(); } catch (InvalidInstallException e) { if (!IsAutoStarting()) { MessageBox.Show( $"Could not continue, {e.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error ); } return; } if (IsAutoStarting()) { var massController = serviceProvider.GetService <MassController>(); Task.Run(() => massController.StartAll((_, c) => c?.AutoStart == true)); } // Show the shutdown monitor form so it can listen for shutdown events and block them if needed serviceProvider.GetService <MonitorForm>().Show(); // Run the application Application.Run(serviceProvider.GetService <TrayApplicationContext>()); locker.StopLock(); logger.LogTrace($"TrayApp {Process.GetCurrentProcess().Id} finished"); NLog.LogManager.Flush(); NLog.LogManager.Shutdown(); }
public ShellForm(MonitorForm monitorForm) { this.monitorForm = monitorForm; }
public CentralServerConfigForm(MonitorForm form) { InitializeComponent(); SkinUtil.SetFormSkin(this); this.monitorForm = form; }
private static void Main(string[] args) { IPlayer[] players = { new SmartPlayer(), new SmartPlayer2(), new SmartPlayer2(), new SmartPlayer(), }; int mapId = 351658; board = new Board(players, mapId); game = new Game(players, board); _form = new MonitorForm(game, mapId); _form.OnCloseBtnClick += (s, e) => { Environment.Exit(0); }; _form.OnPauseBtnClick += (s, e) => { isPause = !isPause; }; _form.OnSlowerBtnClick += (s, e) => { turnTimeOutInMS = (int)(turnTimeOutInMS * 1.5); turnTimeOutInMS = Math.Min(turnTimeOutInMS, 2048); }; _form.OnFasterBtnClick += (s, e) => { turnTimeOutInMS = (int)(turnTimeOutInMS / 1.5); turnTimeOutInMS = Math.Max(turnTimeOutInMS, 2); }; _form.OnNewGameBtnClick += (s, e) => { mapId = new Random().Next(1000000); board = new Board(players, mapId); game = new Game(players, board); _form.InitBoardPanel(game, mapId); isPause = false; }; _form.OnPrevTurnesBtnClick += (s, e) => { isPause = true; prevTurnes = 4; }; _form.OnPrevOneBtnClick += (s, e) => { isPause = true; prevTurnes = 1; }; _form.OnNextOneBtnClick += (s, e) => { isPause = true; nextTurnes = 1; }; _form.OnNextTurnesBtnClick += (s, e) => { isPause = true; nextTurnes = 4; }; _form.OnTileCtrlBtnClick += (s, e) => { }; var thread = new Thread(formStart); thread.Start(); while (true) { var boardStrHistory = new Dictionary <long, string>(); for (long i = 0, prev_i = 0; !game.IsGameOver; prev_i = i, i++) { bool isShowAvailableMoves = false; while (isPause) { if (prevTurnes > 0) { prevTurnes--; if (i >= 2) { i -= 2; break; } } if (nextTurnes > 0) { nextTurnes--; break; } if (isShowAvailableMoves == false && i >= boardStrHistory.Count) { isShowAvailableMoves = true; _form.ShowAvailableMoves(game); } Thread.Sleep(TimeSpan.FromMilliseconds(250)); } if (isShowAvailableMoves) { isShowAvailableMoves = false; _form.HideAvailableMoves(game); } if (i >= boardStrHistory.Count) { string prevBoardStr = JsonHelper.SerialiazeWithType(board); boardStrHistory.Add(i, prevBoardStr); if (game.CurrentPlayer is HumanPlayer) { } game.Turn(); var prevBoard = JsonHelper.DeserialiazeWithType <Board>(prevBoardStr); _form.Draw(board, prevBoard); } else { string historyStr = boardStrHistory[i]; var history = JsonHelper.DeserialiazeWithType <Board>(historyStr); string prevHistoryStr = boardStrHistory[prev_i]; var prevBoard = JsonHelper.DeserialiazeWithType <Board>(prevHistoryStr); _form.Draw(history, prevBoard); } _form.DrawStats(game); Thread.Sleep(TimeSpan.FromMilliseconds(turnTimeOutInMS)); } Thread.Sleep(TimeSpan.FromMilliseconds(250)); } }