public void Dispose() { if (QueryImage != null) { QueryImage.Dispose(); } }
public ImgViewModel() { IAModel = new ImageAnalyzerModel(); //IAModel.ImageFileName = "../Resources/Ha3.jpg"; //IAModel.NetImage = new BitmapImage(new Uri("C:/Users/JP/documents/visual studio 2012/Projects/WpfApplication2/WpfApplication2/Resources/Ha3.jpg")); dlgviewmodel = new DialogViewModel(); #region Attached a Listener aka callback function ///Register Commands QueryImageCmd = new QueryImage(this.QueryImageAction); StopQueryCmd = new StopQuery(this.StopQueryAction); //listener = new SubscribeAsString(Rimg, IAModel); listener = new SubscribeAsByteStream(DlgViewModel.ImgSrcObject, this); #endregion GPIO = new GenericTestCmd(this.GenericTestAction); string value = WpfApplication2.Properties.Resources.GreyBlackHotBrush.ToString(); mybrush = Application.Current.FindResource(value) as LinearGradientBrush; try { //hard coded console = new DisplaySource(mybrush.GradientStops.Cast <object>().ToList(), this.DisplaySourceOutput); } catch (ResourceReferenceKeyNotFoundException e) { Console.Out.WriteLineAsync("Resource Exception: " + e.Message); } /// Assuming this viewmodel is not being created by a background thread but a UI thread then give it a name Dispatcher.CurrentDispatcher.Thread.Name = "My App UI Thread"; _dispatcher = Dispatcher.CurrentDispatcher; }
private void OnQueryImage(ShowImageEventArgs queryImageEventArgs) { QueryImage?.Invoke(this, queryImageEventArgs); }