public void DoFinish() { TextBlock HotspotName = (TextBlock)StatesUI.FindName("HotspotName"); HotspotName.Text = this.Name; // For WPF Control -> Edit button StatesUI.SettingHotspot = this.SettingHotspot; if (CaptureSource != null) { this.DrawBitmapSource(CaptureSourceBS, "CaptureSource"); } if (FilteredMat != null) { this.DrawBitmapSource(FilteredMatBS, "FilteredMat"); } Visibility ActionBaseVisibleState = Visibility.Visible; if (ActionBase != null) { this.DrawBitmapSource(ActionBaseBS, "ActionBase"); } else { ActionBaseVisibleState = Visibility.Collapsed; } ((FrameworkElement)StatesUI.FindName("ActionBaseContainer")).Visibility = ActionBaseVisibleState; Visibility CasteableVisibleState = Visibility.Visible; if (this.UseCastableDetection()) { this.DrawBitmapSource(CasteableDetectionBS, "CasteableDetection"); } else { CasteableVisibleState = Visibility.Collapsed; } ((FrameworkElement)StatesUI.FindName("CasteableDetectionContainer")).Visibility = CasteableVisibleState; Visibility InfoVisibleState = Visibility.Visible; if (Info1 != "" || Info2 != "" || Info3 != "") { ((TextBlock)StatesUI.FindName("Info1")).Text = Info1; ((TextBlock)StatesUI.FindName("Info2")).Text = Info2; ((TextBlock)StatesUI.FindName("Info3")).Text = Info3; } else { InfoVisibleState = Visibility.Collapsed; } ((FrameworkElement)StatesUI.FindName("InfoContainer")).Visibility = InfoVisibleState; }
public void DrawBitmapSource(BitmapSource BitmapSource, string uiElementName) { Image renderTarget = (Image)StatesUI.FindName(uiElementName); renderTarget.Width = this.SettingHotspot.PreviewImageWidth; renderTarget.Height = this.SettingHotspot.PreviewImageHeight; renderTarget.Dispatcher.Invoke((Action)(() => renderTarget.Source = BitmapSource)); }
private void Awake() { statesUI = this; }