private void button1_Click(object sender, EventArgs e) { ScannerForm frm = new ScannerForm(); frm.Show(); this.Hide(); }
/// <summary> /// Hides the talk window /// </summary> public void HideTalkWindow() { if (Context.AppTalkWindowManager.IsTalkWindowActive) { ScannerForm.Invoke(new MethodInvoker(() => Context.AppTalkWindowManager.ToggleTalkWindow())); } }
/// <summary> /// If the button command begins with an @, it could either /// be a virtual key defined in the .NET class Keys, or /// it could be a command /// If is a command, the form is notified and it's handled there /// </summary> /// <param name="modifiers"></param> /// <param name="value"></param> /// <param name="isVirtualKey"></param> private void actuateSpecialKey(ArrayList modifiers, String value, bool isVirtualKey) { Log.Debug("command=" + value + " isVirtualKey=" + isVirtualKey.ToString()); if (isVirtualKey) { Keys key = TextController.MapVirtualKey(value); if (key == Keys.Escape && Context.AppTalkWindowManager.IsTalkWindowVisible) { Context.AppTalkWindowManager.CloseTalkWindow(); } else if (key == Keys.Escape && _dialogMode) { ScannerForm.Close(); } else { TextController.HandleVirtualKey(modifiers, value); } } else { // this is a command. runCommand(value); } }
/// <summary> /// Runs the specified command. The command can be /// prefixed by 'agent.' in which case the application /// agent is invoked to run the command. If the command /// is prefixed with 'scanner.' the scanner is invoked to run /// the command. If there is no prefix, then the scanner is /// invoked first, if it doesn't handle it, then the application /// agent is invoked. /// </summary> /// <param name="command"></param> private void runCommand(String command) { bool handled = false; if (command[0] == '@') { command = command.Substring(1); } Log.Debug("Calling scanner common runcomand with " + command); ScannerForm.Invoke(new MethodInvoker(delegate { String[] parts = command.Split('.'); if (parts.Length > 1) { if (String.Compare(parts[0], "agent", true) == 0) { runCommandAgent(parts[1], ref handled); } else if (String.Compare(parts[0], "scanner", true) == 0) { runCommandScanner(parts[1], ref handled); } } else { runCommandScanner(command, ref handled); if (!handled) { runCommandAgent(command, ref handled); } } })); }
/// <summary> /// Performs initialization. Reads the config file for the form, creates /// the animation manager, widget manager, loads in all the widgets, /// subscribes to events /// Call this function in the Initialize() function in the scanner. /// </summary> /// <param name="startupArg"></param> /// <returns></returns> public bool Initialize(StartupArg startupArg) { Log.Debug("Entered from Initialize"); Glass.Enable = CoreGlobals.AppPreferences.EnableGlass; Glass.EvtShowGlass += Glass_EvtShowGlass; StartupArg = startupArg; ScannerForm.AutoScaleMode = AutoScaleMode.None; ScannerForm.TopMost = true; Windows.ShowWindowBorder(ScannerForm, CoreGlobals.AppPreferences.ScannerShowBorder, CoreGlobals.AppPreferences.ScannerShowTitleBar ? ScannerForm.Text : String.Empty); Windows.EvtWindowPositionChanged += Windows_EvtWindowPositionChanged; ScannerForm.SizeChanged += ScannerForm_SizeChanged; subscribeTalkWindowManager(); ScannerForm.Shown += form_Shown; ScannerForm.VisibleChanged += form_VisibleChanged; _dialogMode = startupArg.DialogMode; var configFile = startupArg.ConfigFileName; if (String.IsNullOrEmpty(configFile)) { configFile = PanelConfigMap.GetConfigFileForScreen(ScannerForm.GetType()); } bool retVal = initWidgetManager(configFile); if (retVal) { retVal = initAnimationManager(configFile); } if (retVal) { createIdleTimer(); } PositionSizeController.Initialize(); PositionSizeController.AutoSetPosition(); _windowOverlapWatchdog = new WindowOverlapWatchdog(ScannerForm); WindowActivityMonitor.EvtWindowMonitorHeartbeat += WindowActivityMonitor_EvtWindowMonitorHeartbeat; Log.Debug("Returning from Initialize"); return(retVal); }
/// <summary> /// The interpreter invoked a "close" command. Close /// the scanner /// </summary> /// <param name="sender">event sender</param> /// <param name="e">event args</param> private void Interpreter_EvtCloseNotify(object sender, InterpreterEventArgs e) { ScannerForm.Invoke(new MethodInvoker(delegate { Log.Debug("Calling close for " + ScannerForm.Name); ScannerForm.Close(); })); }
public bool HandleWndProc(Message m) { bool retVal = false; if (m.Msg == WM_MOUSEACTIVATE) { Control control = Control.FromHandle(m.HWnd); if (control != null && (control == ScannerForm || ScannerForm.Contains(control))) { retVal = true; _animationManager.Interrupt(); } } return(retVal); }
public Interfaces.Plugin.IToolResult ShowDialog(ref SimPe.Interfaces.Files.IPackedFileDescriptor pfd, ref SimPe.Interfaces.Files.IPackageFile package) { if (ds == null) { ds = new ScannerForm(); } RemoteControl.ShowSubForm(ds); if (ds.FileName == null) { return(new ToolResult(false, false)); } else { SimPe.Packages.GeneratableFile gf = SimPe.Packages.GeneratableFile.LoadFromFile(ds.FileName); package = gf; return(new ToolResult(false, true)); } }
/// <summary> /// Call this in the OnPause hander in the form. /// </summary> public void OnPause() { if (_isPaused) { return; } _isPaused = true; try { if (!DialogMode) { if (!KeepTalkWindowActive) { if (!Context.AppTalkWindowManager.IsPaused) { ScannerForm.Invoke(new MethodInvoker(delegate { Context.AppTalkWindowManager.Pause(); _talkWindowPaused = true; })); } else { _talkWindowPaused = false; } } } } catch (Exception ex) { Log.Debug(ex.ToString()); } }
public static void StartMemoryScan(IScanComparer comparer) { Contract.Requires(comparer != null); var sf = GlobalWindowManager.Windows.OfType <ScannerForm>().FirstOrDefault(); if (sf != null) { if (MessageBox.Show("Open a new scanner window?", Constants.ApplicationName, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { sf = null; } } if (sf == null) { sf = new ScannerForm(); sf.Show(); } var settings = ScanSettings.Default; switch (comparer) { case ByteMemoryComparer _: settings.ValueType = ScanValueType.Byte; break; case ShortMemoryComparer _: settings.ValueType = ScanValueType.Short; settings.FastScanAlignment = 2; break; case IntegerMemoryComparer _: settings.ValueType = ScanValueType.Integer; settings.FastScanAlignment = 4; break; case LongMemoryComparer _: settings.ValueType = ScanValueType.Long; settings.FastScanAlignment = 4; break; case FloatMemoryComparer _: settings.ValueType = ScanValueType.Float; settings.FastScanAlignment = 4; break; case DoubleMemoryComparer _: settings.ValueType = ScanValueType.Double; settings.FastScanAlignment = 4; break; case ArrayOfBytesMemoryComparer _: settings.ValueType = ScanValueType.ArrayOfBytes; break; case StringMemoryComparer _: settings.ValueType = ScanValueType.String; break; } sf.ExcuteScan(settings, comparer); }