public MainWindowViewModel(Window window) { _window = window; _console = (TextBox)window.FindName("_consoleBuffer"); _messages = (TextBox)window.FindName("_messageBuffer"); _scheduler = TaskScheduler.FromCurrentSynchronizationContext(); DiscoverTests = new RelayCommand(ExecuteDiscoverTests, CanExecuteDiscoverTests); SelectDNX = new RelayCommand(ExecuteSelectDNX, CanExecuteSelectDNX); SelectProject = new RelayCommand(ExecuteSelectProject, CanExecuteSelectProject); StartTestHost = new RelayCommand(ExecuteStartTestHost, CanExecuteStartTestHost); StopTestHost = new RelayCommand(ExecuteStopTestHost, CanExecuteStopTestHost); RunAllTests = new RelayCommand(ExecuteRunAllTests, CanExecuteRunAllTests); RunSelectedTests = new RelayCommand(ExecuteRunSelectedTests, CanExecuteRunSelectedTests); }
internal void OnLoaded(Window win) { this.Clear(); if (!string.IsNullOrEmpty(this.captionInfo.IncludeName)) { this.captionInfo.IncludeElement = win.FindName(this.captionInfo.IncludeName) as FrameworkElement; } if ((this.captionInfo.ExIncludesName != null) && (this.captionInfo.ExIncludesName.Length > 0)) { this.captionInfo.ExIncludesElement = new FrameworkElement[this.captionInfo.ExIncludesName.Length]; for (int i = 0; i < this.captionInfo.ExIncludesName.Length; i++) { this.captionInfo.ExIncludesElement[i] = win.FindName(this.captionInfo.ExIncludesName[i]) as FrameworkElement; } } }
private void Cancel(Window window) { Username = ""; Password = ""; var usernameTextBox = (TextBox)window.FindName("txtbname"); if (usernameTextBox!=null) PutFocusOnControl(usernameTextBox); }
private void AddSample(Window parent, UserControl ctrl) { Grid.SetColumn(ctrl, 1); Grid.SetRow(ctrl, 1); ctrl.ClearValue(UserControl.WidthProperty); ctrl.ClearValue(UserControl.HeightProperty); var g = parent.FindName("content") as Grid; g.Children.Add(ctrl); }
public NavigationViewController(Window canvas, Grid navigationBar) { this.canvas = canvas; this.canvasGrid = canvas.FindName("Canvas") as Grid; this.navigationBar = navigationBar; this.leftButton = (Label)navigationBar.FindName("LeftButtonLabel"); this.rightButton = (Label)navigationBar.FindName("RightButtonLabel"); this.title = (Label)navigationBar.FindName("Title"); ((StackPanel)(navigationBar.FindName("LeftButton"))).MouseDown += leftButton_MouseDown; ((StackPanel)(navigationBar.FindName("RightButton"))).MouseDown += rightButton_MouseDown; }
/// <summary> /// Initializing constructor /// </summary> /// <param name="parent">Reference to a parent window</param> public TrashCanPopupManager( Window parent ) { _trashCan = parent.FindName( "TrashCanPopup" ) as Popup; _trashIcon = parent.FindName( "TrashIconRect" ) as FrameworkElement; if( _trashCan != null ) { DragHelper.DragStarted += OnGlobalDragStarted; DragHelper.DragComplete += OnGlobalDragComplete; var dropHelper = new DropHelper( _trashCan ); dropHelper.QueryDragDataValid += OnTrashCanDragQueryDataValid; dropHelper.TargetDrop += OnTrashCanDrop; } if( _trashIcon != null ) { _trashIcon.RenderTransform = new ScaleTransform( 1.0, 1.0 ); _trashIcon.RenderTransformOrigin = new Point( 0.5, 0.9 ); } }
public MapsGraphicalInterface(Window selfHandler, ListBox mapListOuter, TextBlock mapNameOuter, TextBlock mapStateOuter, TextBlock mapDateAddedOuter, string resourcesPrefix) { this.MapList = mapListOuter; this.MapName = mapNameOuter; this.MapState = mapStateOuter; this.MapDateAdded = mapDateAddedOuter; foreach (resourseTypes type in Enum.GetValues(typeof(resourseTypes))) { this.TBS[type] = (TextBlock)selfHandler.FindName(resourcesPrefix + type.ToString()); } // set null titles up this.setSelectedMap(null); }
public static Grid removeControl(Window Parent) { /* * * WPF Page를 제거하고 해당 페이지가 들어있던 Grid를 반환한다. * * */ try { Grid MainGrid = (Grid)Parent.FindName("MainGrid"); MainGrid.Children.Remove(MainGrid.Children[0]); return MainGrid; } catch (Exception) { return null; } }
public static Grid getGrid(Window Parent) { return (Grid)Parent.FindName("MainGrid"); }
private void DragSource_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { try { Visual visual = e.OriginalSource as Visual; _topWindow = (Window)DragDropHelper.FindAncestor(typeof(Window), visual); if (!_topWindow.IsActive) return; _initialMousePosition = e.GetPosition(_topWindow); string adornerLayerName = GetAdornerLayer(sender as DependencyObject); _adornerLayer = (Canvas)_topWindow.FindName(adornerLayerName); string dropTargetName = GetDropTarget(sender as DependencyObject); _dropTarget = (UIElement)_topWindow.FindName(dropTargetName); _draggedData = (sender as FrameworkElement).DataContext; } catch (Exception exc) { Console.WriteLine("Exception in DragDropHelper: " + exc.InnerException.ToString()); } }
private void SetTranslation(Window varControl, string msg) { if (varControl.Dispatcher.CheckAccess()) { RichTextBox txtTranslation = varControl.FindName("txtTranslation") as RichTextBox; txtTranslation.Document = new FlowDocument(new Paragraph(new Run(msg))); txtTranslation.Foreground = _fontColor; txtTranslation.Focus(); } else { varControl.Dispatcher.Invoke(new Action<Window, string>((c, m) => SetTranslation(varControl, msg)), new object[] { varControl, msg }); } }
public WpfTextTraceListener(string name) : base(name) { ownerWindow = Application.Current.Windows.OfType<Window>().SingleOrDefault(x => x.IsActive); output = (TextBlock)ownerWindow.FindName("Status"); }