public void InitializeOnceAtStartup(EgsDevice device) { RightHand.InitializeOnceAtStartup(device); LeftHand.InitializeOnceAtStartup(device); CursorImageSetInformationOptionalValue.SelectedItemChanged += (sender, e) => { RightHand.CurrentCursorImageSetIndex = CursorImageSetInformationOptionalValue.SelectedItem.Index; LeftHand.CurrentCursorImageSetIndex = CursorImageSetInformationOptionalValue.SelectedItem.Index; }; device.EgsGestureHidReport.RecognitionStateChanged += (sender, e) => { if (FirstFoundHand == null) { if (device.EgsGestureHidReport.Hands[(int)RightOrLeftKind.Right].IsTracking) { FirstFoundHand = _RightHand; } else if (device.EgsGestureHidReport.Hands[(int)RightOrLeftKind.Left].IsTracking) { FirstFoundHand = _LeftHand; } } else if (FirstFoundHand.IsTracking == false) { FirstFoundHand = null; } }; }
internal EgsDevice CreateNewEgsDeviceAndAddToDeviceList() { var device = EgsDevice.GetEgsDeviceForEgsDevicesManager(DeviceList.Count); DeviceList.Add(device); return(device); }
internal static EgsDevice GetEgsDeviceForEgsDevicesManager(int indexInHidDevicePathList) { var ret = new EgsDevice(); ret.InitializeOnceAtStartup(); ret.IndexInHidDevicePathList = indexInHidDevicePathList; return(ret); }
public void InitializeOnceAtStartup(EgsDevice device) { Trace.Assert(device != null); Device = device; LocationAndSize = GetDefaultLocationAndSize(); // NOTE: Thie is CameraView Window's Visibility. This does not mean if the app captures images from device or not. Device.EgsGestureHidReport.RecognitionStateChanged += EgsGestureHidReport_RecognitionStateChanged; }
internal void RemoveDeviceFromDeviceList(EgsDevice device) { if (DeviceList.Contains(device) == false) { return; } device.Close(); DeviceList.Remove(device); // TODO: MUSTDO: delete MessageReceivingForm.CurrentDevice itself MessageReceivingForm.CurrentDevice = null; }
internal EgsDevice CreateNewEgsDeviceAndAddToDeviceList() { var device = EgsDevice.GetEgsDeviceForEgsDevicesManager(DeviceList.Count); DeviceList.Add(device); // TODO: MUSTDO: This is ad-hoc implementation. This way cannot recognize multiple device's connection and disconnection. This is very bad way, it should be fixed. MessageReceivingForm.CurrentDevice = device; return(device); }
static internal EgsDevice CreateEgsDeviceForXamlDesign() { var ret = new EgsDevice(); ret.InitializeOnceAtStartup(); ret.IndexInHidDevicePathList = 0; ret.DeviceSerialNumber.Value = "EXV000000005"; ret._HidDeviceDevicePath = "THISISSOMEHIDDEVICEPATH"; ret._IsHidDeviceConnected = true; ret.IsConnected = true; return(ret); }
internal void InitializeOnceAtStartup(EgsDevice device) { if (device == null) { if (ApplicationCommonSettings.IsDebugging) { Debugger.Break(); } throw new ArgumentNullException("device"); } Device = device; Device.CameraViewImageSourceBitmapCapture.CameraViewImageSourceBitmapChanged += Device_CameraViewImageSourceBitmapCapture_CameraViewImageSourceBitmapChanged; }
/// <summary> /// This method must be called after an object of EgsDevice is constructed. /// </summary> public virtual void InitializeOnceAtStartup(EgsDevice device) { Trace.Assert(device != null); Device = device; IsToShowCursorChanged += delegate { if (IsToShowCursor == false) { InitializePropertiesDependsOnHidReport(); } }; CallPropertyChangedOfAllPropertiesAtOnce(); OnStateUpdated(EventArgs.Empty); }
internal void InitializeOnceAtStartup(EgsDevice device) { if (device == null) { if (ApplicationCommonSettings.IsDebugging) { Debugger.Break(); } throw new ArgumentNullException("device"); } Device = device; Contacts = Enumerable.Range(0, Device.TrackableHandsCountMaximum).Select(e => new EgsDeviceTouchScreenHidReportContact()).ToList(); ResetInternal(); }
public void InitializeOnceAtStartup(EgsDevice device) { Trace.Assert(device != null); Trace.Assert(device.CameraViewImageSourceBitmapCapture != null); Device = device; Device.CameraViewImageSourceBitmapCapture.CameraViewImageSourceBitmapSizeOrPixelFormatChanged += delegate { CreateCameraViewWpfBitmapSource(); }; Device.CameraViewImageSourceBitmapCapture.CameraViewImageSourceBitmapChanged += delegate { UpdateCameraViewWpfBitmapSource(); RaiseMultipleObjectsPropertyChanged(); }; }
public EgsDeviceFirmwareUpdateModel(EgsDevice device, Version deviceFirmwareVersion) { Trace.Assert(device != null); Trace.Assert(deviceFirmwareVersion != null); Device = device; FirmwareVersionInDevice = deviceFirmwareVersion; RatioOfSendingImageFileInUpdatingByOneFile = 80; FileSelectionCommand = new SimpleDelegateCommand(); FileSelectionCommand.CanPerform = true; FileSelectionCommand.PerformEventHandler += delegate { SelectFiles(); }; StartOrCancelCommand = new SimpleDelegateCommand(); StartOrCancelCommand.CanPerform = true; StartOrCancelCommand.PerformEventHandler += delegate { if (IsBusy) { CancelAsync(); } else { StartAsync(); } }; ProgressReport = new BackgroundWorker() { WorkerReportsProgress = true, WorkerSupportsCancellation = true }; ProgressReport.DoWork += delegate { LastResult = DoWorkInternal(); }; ProgressReport.RunWorkerCompleted += delegate { IsBusy = false; }; IsBusy = false; IsCanceled = false; LastResult = new EgsDeviceFirmwareUpdateResult(true, false, false, ""); FirmwareImageFilePathList = new List <string>(); IsToShowWarningMessages = false; }
internal void InitializeOnceAtStartup(EgsDevice device) { if (device == null) { if (ApplicationCommonSettings.IsDebugging) { Debugger.Break(); } throw new ArgumentNullException("device"); } Device = device; Faces = Enumerable.Range(0, Device.DetectableFacesCountMaximum).Select(e => new EgsDeviceEgsGestureHidReportFace()).ToList(); Hands = Enumerable.Range(0, Device.TrackableHandsCountMaximum).Select(e => new EgsDeviceEgsGestureHidReportHand()).ToList(); HandRecognitionStatePreviousList = Enumerable.Range(0, Device.TrackableHandsCountMaximum).Select(e => EgsGestureHidReportRecognitionState.NotDetecting).ToList(); UpdateHandXYScaleFactors(); ResetInternal(); }
public DebugForm(EgsDevice device) { InitializeComponent(); ownerDevice = device; ownerDevice.IsConnectedChanged += (sender, e) => { this.Visible = ownerDevice.IsConnected; }; ownerDevice.EgsGestureHidReport.ReportUpdated += (sender, e) => { string str = BitConverter.ToString(ownerDevice.HidReportsUpdate.reportAsByteArray); str += DateTime.Now.ToString(" HH:mm:ss.fff"); this.InsertList(str); }; copyToClipboardButton.Click += (sender, e) => { string str = ""; foreach (string item in logListBox.Items) { str += item; } // need this check if (string.IsNullOrEmpty(str) == false) { Clipboard.SetText(str); } }; clearLogButton.Click += (sender, e) => { logListBox.Items.Clear(); }; monitorMouseCheckBox.Click += (sender, e) => { ApplicationCommonSettings.IsToEmulateReportByActualMouseRawInputToDebugViews = this.monitorMouseCheckBox.Checked; if (monitorMouseCheckBox.Checked) { ownerDevice.Settings.TouchInterfaceKind.Value = TouchInterfaceKinds.Mouse; } }; this.monitorMouseCheckBox.Checked = ApplicationCommonSettings.IsToEmulateReportByActualMouseRawInputToDebugViews; }
public void InitializeOnceAtStartup(EgsDevice device) { Trace.Assert(device != null); owner = device; }
public EgsHostOnUserControl() { Device = EgsDevice.GetDefaultEgsDevice(); CultureInfoAndDescription = new CultureInfoAndDescriptionOptions(); MouseCursorPositionUpdatedByGestureCursorMethod = new MouseCursorPositionUpdatedByGestureCursorMethodOptions(); CursorDrawingTimingMethod = new CursorDrawingTimingMethodOptions(); CameraViewBordersAndPointersAreDrawnBy = new CameraViewBordersAndPointersAreDrawnByOptions(); CameraViewUserControlModel = new CameraViewUserControlModel(); OnePersonBothHandsViewModel = new OnePersonBothHandsViewModel(); CursorViews = new List <CursorForm>(); DrawingCursorsMinimumIntervalInMilliseconds = 8; drawingCursorsStopwatch = Stopwatch.StartNew(); PrecisionLogger = new TimerPrecisionLogger(); //CultureInfoAndDescription.SelectSingleItemByPredicate(e => e.CultureInfoString == ApplicationCommonSettings.DefaultCultureInfoName); MouseCursorPositionUpdatedByGestureCursorMethod.Value = MouseCursorPositionUpdatedByGestureCursorMethods.None; CursorDrawingTimingMethod.Value = CursorDrawingTimingMethods.ByHidReportUpdatedEvent; CameraViewBordersAndPointersAreDrawnBy.Value = CameraViewBordersAndPointersAreDrawnByKind.HostApplication; WaitTimeTillMouseCursorHideOnMouseMode = TimeSpan.FromSeconds(10); ResetSettingsCommand = new SimpleDelegateCommand(); SaveSettingsToFlashCommand = new SimpleDelegateCommand(); ResetDeviceCommand = new SimpleDelegateCommand(); SendManySettingsPacketsCommand = new SimpleDelegateCommand(); ResetSettingsCommand.CanPerform = true; SaveSettingsToFlashCommand.CanPerform = false; ResetDeviceCommand.CanPerform = false; SendManySettingsPacketsCommand.CanPerform = false; ResetSettingsCommand.PerformEventHandler += delegate { if (MessageBox.Show(Resources.CommonStrings_ResetSettingsConfirmation, Resources.CommonStrings_Confirmation, MessageBoxButton.OKCancel) != MessageBoxResult.OK) { return; } Reset(); }; SaveSettingsToFlashCommand.PerformEventHandler += delegate { if (MessageBox.Show(Resources.CommonStrings_SaveSettingsToFlashConfirmation, Resources.CommonStrings_Confirmation, MessageBoxButton.OKCancel) != MessageBoxResult.OK) { return; } Device.SaveSettingsToFlash(); }; ResetDeviceCommand.PerformEventHandler += delegate { if (MessageBox.Show(Resources.CommonStrings_ResetDeviceConfirmation, Resources.CommonStrings_Confirmation, MessageBoxButton.OKCancel) != MessageBoxResult.OK) { return; } Device.ResetDevice(); }; SendManySettingsPacketsCommand.PerformEventHandler += delegate { SendManySettingsPacketsAsync(); }; Device.IsHidDeviceConnectedChanged += Device_IsHidDeviceConnectedChanged; // NOTE: The next 2 lines are necessary. SaveSettingsToFlashCommand.CanPerform = Device.IsHidDeviceConnected; ResetDeviceCommand.CanPerform = Device.IsHidDeviceConnected; SendManySettingsPacketsCommand.CanPerform = Device.IsHidDeviceConnected; CursorDrawingTimingMethod.ValueUpdated += delegate { OnCursorDrawingTimingMethod_SelectedItemChanged(); }; CameraViewBordersAndPointersAreDrawnBy.ValueUpdated += CameraViewBordersAndPointersAreDrawnBy_SelectedItemChanged; CultureInfoAndDescription.ValueUpdated += delegate { BindableResources.Current.ChangeCulture(CultureInfoAndDescription.Value); }; // TODO: MUSTDO: When users cancel DFU, exceptions occur in Timer thread basically, // and the app cannot deal with them. // So it is necessary to attach them to event handlers. // The design of EgsDevicesManager is not completed. So I don't think this is good way. EgsDevice.DefaultEgsDevicesManager.Disposing += delegate { if (false && ApplicationCommonSettings.IsDebuggingInternal) { Debugger.Break(); } this.Dispose(); }; }
internal void InitializeOnceAtStartup(EgsDevice device) { Trace.Assert(device != null); Device = device; DisposeVideoCaptureAndSetIsCameraDeviceConnectedToFalse(); }