internal Command(IAppState appState, string name, ICommsPort commsPort, bool isLogging) { _appState = appState; _name = name; _commsPort = commsPort; _isLogging = isLogging; }
public UploadColorsStripCommand(IAppState appState, ColorForm colorForm, IColorTarget colorTarget, ICommsPort commsPort) : base(appState) { _commsPort = commsPort; _colorForm = colorForm; _colorTarget = colorTarget; }
public OpenFileStripCommand(IAppState appState, MainForm mainForm, ColorForm colorForm, OpenFileDialog openFileDialog, ICommsPort commsPort) : base(appState) { _mainForm = mainForm; _colorForm = colorForm; _commsPort = commsPort; _openFileDialog = openFileDialog; }
private byte[] getData(ICommsPort commsPort, int remaining) { var buffer = new byte[remaining]; while (remaining > 0) { remaining -= commsPort.Read(buffer, buffer.Length - remaining, remaining); } return(buffer); }
public MainWindow(IAppState appState, ISettings settings, IConfigCommsPort commsPort, ICommsPortFactory commsPortFactory) : this() { this.appState = appState; this.settings = settings; this.commsPort = commsPort; this.commsPortFactory = commsPortFactory; this.appState.StateChanged += AppState_StateChanged; this.appState.State = NXTCamView.Core.State.NotConnected; }
public CaptureForm(IAppState appState, ColorForm colorForm, ICommsPort commsPort) { _appState = appState; _colorForm = colorForm; InitializeComponent(); Icon = AppImages.GetIcon(AppImages.Capture); _commsPort = commsPort; _colorForm.HighlightColorsChanged += colorDetail_HighlightColorsChanged; _colorForm.ColorFunctionChanged += colorDetail_ColorFunctionChanged; StickyWindowsUtil.MakeStickyMDIChild(this); _addingColor = AppCursors.AddingColor; _removingColor = AppCursors.RemovingColor; }
public ColorForm(IAppState appState, IColorTarget colorTarget, IConfigCommsPort commsPort) { _appState = appState; _commsPort = commsPort; _colorTarget = colorTarget; InitializeComponent(); Icon = AppImages.GetIcon(AppImages.Colors); setupColorFunction(); setupToolbar(); initErrorImage(); _appState.StateChanged += appStateChanged; StickyWindowsUtil.MakeStickyMDIChild(this); }
private void btnTest_Click(object sender, EventArgs e) { if (backgroundWorker.IsBusy) { btnTest.Enabled = false; lbResult.Text = "Aborting"; backgroundWorker.CancelAsync( ); //hack - must force the serial port to stop from this thread - hmmm _testCommsPort.EnsureClosed( ); } else { var comPort = ((ComboBinder <string>)cobCOMPorts.SelectedItem).Value; if (comPort.Equals(ComboBinder <string> .None.Value)) { return; } //if we are testing the currently selected port then close it _commsPortWasOpen = comPort.Equals(Settings.Default.COMPort); if (_commsPortWasOpen) { _commsPort.EnsureClosed( ); } btnTest.Enabled = true; btnTest.Text = "Abort"; lbResult.ForeColor = Color.Black; lbResult.Text = "Searching for NXTCam..."; lbResult.Refresh( ); _hasDoneTest = true; //setup a new port to test var baud = ((ComboBinder <Int32>)cobBaudRate.SelectedItem).Value; var parity = (Parity)((ComboBinder <Int32>)cobParity.SelectedItem).Value; var dataBits = ((ComboBinder <Int32>)cobDataBits.SelectedItem).Value; var stopBits = (StopBits)((ComboBinder <Int32>)cobStopBits.SelectedItem).Value; var handshake = (Handshake)((ComboBinder <Int32>)cobHandshake.SelectedItem).Value; _testCommsPort = _commsPortFactory.Create(new CommsPortSettings(comPort, baud, parity, dataBits, stopBits, handshake)); backgroundWorker.RunWorkerAsync(); } }
public CaptureWindow(IAppState appState, ICommsPort commsPort) : base(global::Gtk.WindowType.Toplevel) { this.appState = appState; this.commsPort = commsPort; this.worker = new BackgroundWorker() { WorkerReportsProgress = true }; this.Build(); var width = FetchFrameCommand.ImageWidth; var height = FetchFrameCommand.ImageHeight; rawPixbuf = new Pixbuf(Colorspace.Rgb, false, 8, width, height); rawPixbuf.Fill(0); stretchyImage.Pixbuf = rawPixbuf; statusbar.Push(mainStatusBarContext, "Idle"); }
public MainForm(IAppState appState, IUpdater updater, ColorForm colorForm, TrackingForm trackingForm, IConfigCommsPort commsPort, ICommsPortFactory commsPortFactory) { _appState = appState; _commsPort = commsPort; _commsPortFactory = commsPortFactory; _updater = updater; _colorForm = colorForm; _trackingForm = trackingForm; Thread.CurrentThread.Name = "GuiThread"; Icon = AppImages.GetIcon(AppImages.MainForm); InitializeComponent(); StickyWindowsUtil.MakeSticky(this); StickyWindow.Active = Settings.Default.SnapWindows; tsmSnapWindows.Checked = StickyWindow.Active; _appState.StateChanged += appStateChanged; _appState.State = State.NotConnected; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.ThreadException += Application_ThreadException; }
public CaptureStripCommand(IAppState appState, MainForm mainForm, ColorForm colorForm, ICommsPort commsPort) : base(appState) { _mainForm = mainForm; _colorForm = colorForm; _commsPort = commsPort; }
public ConnectStripCommand(IAppState appState, ICommsPort commsPort, MainForm mainForm, ICommsPortFactory commsPortFactory) : base(appState) { _commsPort = commsPort; _commsPortFactory = commsPortFactory; _mainForm = mainForm; }
public SetRegistersCommand(IAppState appState, ICommsPort commsPort) : base(appState, "Upload Settings", commsPort) { }
public DumpFrameCommand(IAppState appState, BackgroundWorker worker, ICommsPort commsPort) : base(appState, "Capture", commsPort, worker) { }
public TrackingCommand(IAppState appState, ICommsPort commsPort, EventHandler <ObjectsDetectedEventArgs> handler) : base(appState, "Tracking", commsPort) { _handler = handler; }
public OpenOptionsStripCommand(IAppState appState, ICommsPort commsPort, ICommsPortFactory commsPortFactory) : base(appState) { _commsPort = commsPort; _commsPortFactory = commsPortFactory; }
public OptionsForm(IAppState appState, ICommsPort commsPort, ICommsPortFactory commsPortFactory) { InitializeComponent(); Icon = Icon.FromHandle(((Bitmap)AppImages.Options).GetHicon()); _appState = appState; _commsPort = commsPort; _commsPortFactory = commsPortFactory; SuspendLayout(); var items = new List <ComboBinder <int> >(); items.Add(new ComboBinder <int>("19.2k", 19200)); items.Add(new ComboBinder <int>("38.4k", 38400)); items.Add(new ComboBinder <int>("115.2k", 115200)); items.Add(new ComboBinder <int>("230.4k", 230400)); items.Add(new ComboBinder <int>("460.8k", 460800)); cobBaudRate.Items.AddRange(items.ToArray()); items.Clear(); items.Add(new ComboBinder <int>("8", 8)); items.Add(new ComboBinder <int>("7", 7)); cobDataBits.Items.AddRange(items.ToArray()); items.Clear(); items.Add(new ComboBinder <int>("Even", (int)Parity.Even)); items.Add(new ComboBinder <int>("Mark", (int)Parity.Mark)); items.Add(new ComboBinder <int>("None", (int)Parity.None)); items.Add(new ComboBinder <int>("Odd", (int)Parity.Odd)); items.Add(new ComboBinder <int>("Space", (int)Parity.Space)); cobParity.Items.AddRange(items.ToArray()); items.Clear(); //items.Add(new ComboBinder<Int32>("None", (int)StopBits.None)); items.Add(new ComboBinder <int>("1", (int)StopBits.One)); items.Add(new ComboBinder <int>("1.5", (int)StopBits.OnePointFive)); items.Add(new ComboBinder <int>("2", (int)StopBits.Two)); cobStopBits.Items.AddRange(items.ToArray()); items.Clear(); items.Add(new ComboBinder <int>("None", (int)Handshake.None)); items.Add(new ComboBinder <int>("RequestToSend", (int)Handshake.RequestToSend)); items.Add(new ComboBinder <int>("RequestToSendXOnXOff", (int)Handshake.RequestToSendXOnXOff)); items.Add(new ComboBinder <int>("XOnXOff", (int)Handshake.XOnXOff)); cobHandshake.Items.AddRange(items.ToArray()); string settings = Settings.Default.CustomRegisters; string[] registerSettings = settings.Split(':'); //handle not settings if (registerSettings.Length != MAX_UPLOAD_REGISTERS) { registerSettings = new string[MAX_UPLOAD_REGISTERS]; } _customSettings = new List <CustomRegisterSettingControl>(); for (int i = 0; i < MAX_UPLOAD_REGISTERS; i++) { var control = new CustomRegisterSettingControl(i, registerSettings[i], nudReg_ValueChanged); control.Left = 20; control.Top = 38 + (i * 26); _customSettings.Add(control); tabNXTCamSettingsAdv.Controls.Add(control); } ResumeLayout(); }
public GetVersionCommand(IAppState appState, ICommsPort commsPort) : base(appState, "Version", commsPort) { }
public PingCommand(IAppState appState, ICommsPort commsPort) : base(appState, "Search", commsPort) { }
public InterpolateFrameCommand(IAppState appState, BackgroundWorker worker, ICommsPort commsPort, Image image) : base(appState, "Interpolate", commsPort, worker) { BmBayer = (Bitmap)image; }
public DisconnectStripCommand(IAppState appState, MainForm mainForm, ICommsPort commsPort) : base(appState) { _mainForm = mainForm; _commsPort = commsPort; }
public SetColorMapCommand(IAppState appState, ICommsPort commsPort) : base(appState, "Set Colors", commsPort) { }
protected Command(IAppState appState, string name, ICommsPort commsPort) : this(appState, name, commsPort, true) { }
/* ******************************************************** * The bayerImage is in the bayer format shown below. * * | | | | | | | | | | . | 1 | 1 | * | | | | | | | | | | . | 7 | 7 | * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | . | 4 | 5 | * -----+---+---+---+---+---+---+---+---+---+ . +---+---+ * 0 | G | R | G | R | G | R | G | R | G | . | G | R | * -----+---+---+---+---+---+---+---+---+---+ . +---+---+ * 1 | B | G | B | G | B | G | B | G | B | . | B | G | * -----+---+---+---+---+---+---+---+---+---+ . +---+---+ * 2 | G | R | G | R | G | R | G | R | G | . | G | R | * -----+---+---+---+---+---+---+---+---+---+ . +---+---+ * 3 | B | G | B | G | B | G | B | G | B | . | B | G | * -----+---+---+---+---+---+---+---+---+---+ . +---+---+ * 4 | G | R | G | R | G | R | G | R | G | . | G | R | * -----+---+---+---+---+---+---+---+---+---+ . +---+---+ * 5 | B | G | B | G | B | G | B | G | B | . | B | G | * -----+---+---+---+---+---+---+---+---+---+ . +---+---+ * . . . . . . . . . . . . . * -----+---+---+---+---+---+---+---+---+---+ . +---+---+ * 142 | G | R | G | R | G | R | G | R | G | . | G | R | * -----+---+---+---+---+---+---+---+---+---+ . +---+---+ * 143 | B | G | B | G | B | G | B | G | B | . | B | G | * -----+---+---+---+---+---+---+---+---+---+ . +---+---+ * * The corners are calculated, then the edges, then the center. * */ protected FetchFrameCommand(IAppState appState, string name, ICommsPort commsPort, BackgroundWorker worker) : base(appState, name, commsPort) { Worker = worker; }
public SetTrackingModeCommand(IAppState appState, ICommsPort commsPort, TrackingMode mode) : base(appState, "Set Tracking Mode", commsPort) { _mode = mode; }