internal void Activate(ChildWindow wnd) { if (_topWindow == wnd) return; if (_topWindow != null) _topWindow.SetValue(ZIndexProperty, 0); _topWindow = wnd; wnd.SetValue(ZIndexProperty, 1); }
public MainWindow() { InitializeComponent(); CollectGarbageCommand = new RelayCommand<object>(o => { GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); }); RaiseEventCommand = new RelayCommand<object>(o => { var handler = EventOrdinary; if (handler != null) handler(this, DateTime.Now.ToString()); _weakEvent.Raise(this, DateTime.Now.ToString()); _weakEventSource.Raise(this, DateTime.Now.ToString()); _asyncWeakEvent.RaiseAsync(this, DateTime.Now.ToString()); }); OpenChildWindowCommand = new RelayCommand<object>(o => { var w = new ChildWindow(this); w.WindowStartupLocation = WindowStartupLocation.CenterScreen; w.Show(); }); }
private void Button_Click(object sender, RoutedEventArgs e) { ChildWindow window = new ChildWindow(); window.Owner = this; ChildWindowCount.Content = "Child Window count = " + OwnedWindows.Count.ToString(); window.Show(); }
public void Show(ChildWindow wnd) { var x = (ActualWidth - wnd.Width) / 2; var y = (ActualHeight - wnd.Height) / 2; SetLeft(wnd, x); SetTop(wnd, y); Children.Add(wnd); Activate(wnd); }
public void Show(ChildWindow wnd) { double x = Math.Max((ActualWidth - wnd.Width)/2, 0); double y = Math.Max((ActualHeight - wnd.Height)/2, 0); SetLeft(wnd, x); SetTop(wnd, y); Children.Add(wnd); Activate(wnd); }
private void btnPushMe_Click_1(object sender, RoutedEventArgs e) { ChildWindow child = new ChildWindow(); bool? resDiag = child.ShowDialog(); if (resDiag.HasValue && resDiag.Value) { lbl1.Content = child.txtBox1Text; } }
public ZoomBoxChildWindow() { ChildWindow = new ChildWindow() { Child = new ZoomBox(), Width = 190, Height = 210, MinHeight = 63 }; Header = "Overview"; }
/// <summary> /// About Window (special case of interaction) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void OpenAboutWindowOnButtonClick(object sender, RoutedEventArgs e) { if (mWind != null && mWind.IsVisible) { return; } var childWindow = new ChildWindow { IsModal = true, Title = "About ", Content = mWind, ShowCloseButton = true }; await this.ShowChildWindowAsync(childWindow); }
//点击审批项目时处理 private void OnGridRowLeftButtonUp(object sender, MouseButtonEventArgs e) { TimeSpan t = DateTime.Now.TimeOfDay; //获取当前时间 if (ArchiveFlowGrid.Tag != null) { var oldT = (TimeSpan)ArchiveFlowGrid.Tag; if ((t - oldT) < TimeSpan.FromMilliseconds(300)) // 延时300ms { var flow = ArchiveFlowGrid.SelectedItem as ArchiveWorkflow; if (flow != null) { if (NavigationService != null) { //导航到相对页面 NavigationService.Navigate(new Uri("Req/ViewApplication?ID=" + flow.FlowId, UriKind.Relative)); } else { BusyIndicator1.IsBusy = true; BusyIndicator1.BusyContent = "正在读取流程信息..."; flowContext.GetArchiveWorkflow(flow.FlowId, obj => { BusyIndicator1.IsBusy = false; if (Utility.Utility.CheckInvokeOperation(obj)) { var child = new ChildWindow { Title = "查看归档流程-" + flow.FlowTitle }; var win = new ViewApplication { ArchiveFlow = obj.Value, Margin = new Thickness(0, 0, 0, 20) }; child.Content = win; child.Show(); } }, null); } } } } ArchiveFlowGrid.Tag = t; }
private void AdvancedClusterProperties_Click(object sender, RoutedEventArgs e) { GraphicsLayer layerInfo = DataContext as GraphicsLayer; if (layerInfo == null) { return; } FlareClusterer flareCluster = layerInfo.Clusterer as FlareClusterer; if (flareCluster == null) { return; } ChildWindow fw = new ChildWindow(); //fw.ResizeMode = ResizeMode.NoResize; TextBlock title = new TextBlock { Foreground = new SolidColorBrush(Colors.White), FontSize = 12, FontWeight = FontWeights.Bold, Text = "Advanced Cluster Properties" }; fw.Title = title; fw.Height = 235; fw.Width = 290; currentClusterInfo = flareCluster; // TODO nik (refactor) flareCluster. flareClusterer..ClusterInfo != null ? layerInfo.ClusterInfo.Clone() : new ClusterInfo(); ClusterPropertiesConfigWindow configWindow = new ClusterPropertiesConfigWindow(); configWindow.OkClicked += (o, args) => { fw.DialogResult = true; }; configWindow.CancelClicked += (o, args) => { fw.DialogResult = false; // automatically calls close }; fw.Closed += (o, args) => { if (fw.DialogResult != true) // && !fw.IsAppExit) { restoreClusterProperties(); } }; configWindow.DataContext = flareCluster; fw.Content = configWindow; fw.DialogResult = null; //fw.ShowDialog(); fw.Show(); }
public static ChildWindow CreateChildWindow(string namespaces, SessionObject.ExecMode pExecMode) { ChildWindow form = null; try { Type cwType = Type.GetType(namespaces); object cw = new object(); object UserConnected = SessionObject.objectSelected; DataGrid gridUser = SessionObject.gridUtilisateur; cw = Activator.CreateInstance(cwType, new object[] { UserConnected }, new SessionObject.ExecMode[] { pExecMode }, new DataGrid[] { gridUser }); form = (ChildWindow)cw; return(form); } catch (Exception ex) { throw ex; } }
private void OnModalClosed(object sender, EventArgs e) { ChildWindow win = sender as ChildWindow; win.Closed -= OnModalClosed; this.Result = win.DialogResult; if (!Result.HasValue) { cancelMethod(); } else if (Result.GetValueOrDefault(false)) { proceedMethod(); } this.CloseModalWindow(); }
private bool EnumWindow(IntPtr hWnd, IntPtr lParam) { var buffer = new StringBuilder(128); User32Methods.GetClassName(hWnd, buffer, buffer.Capacity); var childWindow = new ChildWindow() { Handle = hWnd, ClassName = buffer.ToString() }; var gcHandleDetails = GCHandle.FromIntPtr(lParam); var details = (EnumChildWindowsDetails)gcHandleDetails.Target; details.Windows.Add(childWindow); return(true); }
public static ChildWindow FindChildWindows(List <ChildWindow> list, Func <ChildWindow, bool> condCallback) { for (int i = 0; i < list.Count; i++) { if (condCallback(list[i])) { return(list[i]); } } for (int i = 0; i < list.Count; i++) { ChildWindow found = FindChildWindows(list[i].childs, condCallback); if (found != null) { return(found); } } return(null); }
public LeakTest() { InitializeComponent(); PopupCommand = new DelegateCommand(arg => { var child = new ChildWindow(); child.Closed += (sender, args) => { System.Diagnostics.Debug.WriteLine("Closed window"); }; // when the window has loaded, close it and re-trigger the command child.Loaded += (sender, args) => { child.Close(); PopupCommand.Execute(null); }; child.Show(); }); }
private void LoadChartButton_Click(object sender, RoutedEventArgs e) { loadChartItems = GanttChartDataGrid.GetLoadChartItems(); ObservableCollection <LoadChartItem> selectedLoadChartItemContainer = new ObservableCollection <LoadChartItem>(); ComboBox resourceComboBox = new ComboBox { ItemsSource = loadChartItems, DisplayMemberPath = "Content", Margin = new Thickness(0, 0, 0, 4) }; resourceComboBox.SelectionChanged += delegate { selectedLoadChartItemContainer.Clear(); selectedLoadChartItemContainer.Add(resourceComboBox.SelectedItem as LoadChartItem); }; if (resourceComboBox.Items.Count > 0) { resourceComboBox.SelectedIndex = 0; } Grid grid = new Grid(); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0, GridUnitType.Auto) }); grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); grid.Children.Add(resourceComboBox); Grid.SetRow(resourceComboBox, 0); LoadChartView loadChartView = new LoadChartView { Items = selectedLoadChartItemContainer, ItemHeight = 176, BarHeight = 172, Height = 240, VerticalAlignment = VerticalAlignment.Top }; grid.Children.Add(loadChartView); Grid.SetRow(loadChartView, 1); ChildWindow loadChartWindow = new ChildWindow { Title = "Load Chart", Width = 640, Height = 300, Content = grid }; loadChartWindow.Closed += LoadChartWindow_Closed; loadChartWindow.Show(); }
private void OnConfirmationWindowClosed(object sender, EventArgs e) { ChildWindow w = sender as ChildWindow; if (w.DialogResult != null && w.DialogResult.Value) { PsaDatasetViewModel traceViewModel = DataContext as PsaDatasetViewModel; if (traceViewModel == null) { throw new ArgumentException("Wrong ViewModel type here!"); } PsaDataset dataset = traceViewModel.Model; VtsWebServiceClient service = new VtsWebServiceClient(); service.DeleteDatasetCompleted += ServiceOnDeleteDatasetCompleted; service.DeleteDatasetAsync(dataset.Id, LoggedUserContext.LoggedUser.Login, LoggedUserContext.LoggedUser.PasswordHash); } }
/// <summary> /// Called when shutdown attempted. /// </summary> /// <param name="rootModel">The root model.</param> /// <param name="view">The view.</param> /// <param name="handleShutdownModel">The handler for the shutdown model.</param> /// <param name="e">The <see cref="System.ComponentModel.CancelEventArgs"/> instance containing the event data.</param> protected virtual void OnShutdownAttempted(IPresenter rootModel, ChildWindow view, Action <ISubordinate, Action> handleShutdownModel, CancelEventArgs e) { if (_actuallyClosing || rootModel.CanShutdown()) { _actuallyClosing = false; return; } bool runningAsync = false; var custom = rootModel as ISupportCustomShutdown; if (custom != null && handleShutdownModel != null) { var shutdownModel = custom.CreateShutdownModel(); var shouldEnd = false; handleShutdownModel( shutdownModel, () => { var canShutdown = custom.CanShutdown(shutdownModel); if (runningAsync && canShutdown) { _actuallyClosing = true; view.Close(); } else { e.Cancel = !canShutdown; } shouldEnd = true; }); if (shouldEnd) { return; } } runningAsync = e.Cancel = true; }
public void CloseAllChildWindows() { LoggerUtility.WriteLog("<Info: Closing The Child Windows Method>"); List <Window> wChildWindows = wVStoreMainWindow.ModalWindows(); LoggerUtility.WriteLog("dsda" + wChildWindows); if (wChildWindows != null) { LoggerUtility.WriteLog("The Value is Not Equal To Null" + wChildWindows); } { foreach (Window ChildWindow in wChildWindows) { LoggerUtility.WriteLog("The Current Child Window Is " + ChildWindow.Title); ChildWindow.Close(); } } }
private void SetWithBehaviour() { var content = new TextBlock { Margin = new Thickness(30, 30, 30, 30), Text = "Touch my Overlay to close me.\n\nI have the OverlayClosingBehavior.", FontWeight = FontWeights.Bold, }; _withBehaviour = new TestChildWindowWithBehaviour { Title = "ChildWindow closed by Overlay", Content = content, OverlayBrush = new SolidColorBrush(Colors.Transparent), OverlayOpacity = 0.4, HasCloseButton = false, }; _withBehaviour.Show(); }
public void ShowConversionConfirmationDialog(object dataContext, Action dialogLoaded = null) { if (_conversionConfirmationView != null && _conversionConfirmationView.IsOpen) { return; } _conversionConfirmationView = new FrameView { DataContext = dataContext }; if (dialogLoaded != null) { _conversionConfirmationView.Loaded += (sender, args) => { dialogLoaded(); } } ; this.ShowChildWindowAsync(_conversionConfirmationView); }
private void OnConfigCommandMessage(ConfigCommandMessage message) { var window = new ChildWindow(); var contentControl = new NewEditServer(); contentControl.DataContext = new EditServerDetailViewModel(message.Server); window.Content = contentControl; window.Closed += (s, e) => { Messenger.Default.Unregister<CloseEditServerMessage>(this); Application.Current.RootVisual.SetValue(Control.IsEnabledProperty, true); }; Messenger.Default.Register<CloseEditServerMessage>(this, (m) => { window.DialogResult = false; window.Close(); }); window.Show(); }
public void CreateUserView(string namespaces, string title, SessionObject.ExecMode pExecMode) { try { Type cwType = Type.GetType(namespaces); object cw = new object(); object UserConnected = SessionObject.objectSelected; DataGrid gridUser = SessionObject.gridUtilisateur; cw = Activator.CreateInstance(cwType, new object[] { UserConnected }, new SessionObject.ExecMode[] { pExecMode }, new DataGrid[] { gridUser }); ChildWindow form = (ChildWindow)cw; form.Title = title; form.Show(); } catch (Exception ex) { Message.Show(ex.Message, Galatee.Silverlight.Resources.Langue.errorTitle); } }
private void CustomExercise_Click(object sender, RoutedEventArgs e) { // Show a modal dialog with the create custom exercise form ChildWindow modalWindow = new ChildWindow(); CustomExercise customExercise = new CustomExercise(); customExercise.CustomExerciseCanceled += (s, ev) => { modalWindow.Close(); }; customExercise.CustomExerciseCreated += (s, ev) => { CreateExerciseLogEntry(ev.CreatedExercise); modalWindow.Close(); }; customExercise.DataContext = new FitnessTrackerPlus.Web.Data.Exercise(); modalWindow.Title = "Add Custom Exercise"; modalWindow.Content = customExercise; modalWindow.Show(); }
public AddProjectWindowViewModel(ChildWindow aChildWindow , TaxPayerEntity aOldTaxPayerEntity , TaxPayerEntity aNewTaxPayerEntity) { childWindow = aChildWindow; OldTaxPayerEntity = aOldTaxPayerEntity; NewTaxPayerEntity = aNewTaxPayerEntity; NewTaxPayerEntity.TaxPayerCode = ""; NewTaxPayerEntity.TaxPayerName = ""; NewTaxPayerEntity.TaxPayerRegyear = ""; NewTaxPayerEntity.TaxPayerProject = ""; NewTaxPayerEntity.TaxPayerProjectFinish = false; NewTaxPayerEntity.TaxPayerFtk = false; Title = "添加项目 纳税人:" + OldTaxPayerEntity.TaxPayerName; OnOK = new DelegateCommand(onOK); OnCancel = new DelegateCommand(onCancel); }
public ProductPartTimeWindowViewModel(ChildWindow aChildWindow, ProductEntity aProductEntity) { childWindow = aChildWindow; ProductEntity = aProductEntity; productPartTimeWindowState = ProductPartTimeWindowState.NO; ProductPartTimeEntityList = new ObservableCollection <ProductPartTimeEntity>(); ProductPartTypeEntityList = new ObservableCollection <ProductPartTypeEntity>(); ProductPartTypeDictionary = new Dictionary <int, ProductPartTypeEntity>(); Title = "产品 " + ProductEntity.ProductID + " : " + ProductEntity.ProductName + " 阶段"; OnQuit = new DelegateCommand(OnQuitCommand, CanQuitCommand); OnAdd = new DelegateCommand(OnAddCommand, CanAddCommand); OnModify = new DelegateCommand(OnModifyCommand, CanModifyCommand); OnSave = new DelegateCommand(OnSaveCommand, CanSaveCommand); OnCancel = new DelegateCommand(OnCancelCommand, CanCancelCommand); IsNotAddorModify = true; LoadData(); }
public override void AutoPush() { UpdateChildren(); ChildWindow cw = getBetBox(); if (cw != null) { Thread t = new Thread(new ThreadStart(delegate() { string betValue = "99"; for (int i = 0; i <= 7; i++) { // Make sure the window has focus, and it's the active window, otherwise the window might not recognize the text update Win32.ShowWindow(WindowHandle, (int)Win32.SW.SHOWNORMAL); Win32.SetForegroundWindow(WindowHandle); Win32.BringWindowToTop(WindowHandle); // Click the raise box to ensure that we've got focus Win32.ClickButton(cw.Handle); // Set the value Win32.SetText(cw.Handle, betValue); // Add a 9 to the betvalue betValue += "9"; Thread.Sleep(5); } // Sleep 25ms to make sure the amount get's a chance to be entered Thread.Sleep(10); // Push the raise button BetRaise(); })); t.Start(); } }
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { // If the app is running outside of the debugger then report the exception using // the browser's exception mechanism. On IE this will display it a yellow alert // icon in the status bar and Firefox will display a script error. if (!System.Diagnostics.Debugger.IsAttached) { ChildWindow errorWin = new ChildWindow() { Content = new StackPanel() }; (errorWin.Content as StackPanel).Children.Add( new TextBlock() { Text = "An error has occurred. Please check the Issue Tracker on Rawr's development website (http://rawr.codeplex.com) for a solution, or report it there if it hasn't been reported:" }); string errorString = string.Empty; Exception ex = e.ExceptionObject; do { errorString += ex.Message + "\r\n\r\n" + ex.StackTrace; ex = ex.InnerException; } while (ex != null); (errorWin.Content as StackPanel).Children.Add( new TextBox() { Text = errorString }); errorWin.Show(); // NOTE: This will allow the application to continue running after an exception has been thrown // but not handled. // For production applications this error handling should be replaced with something that will // report the error to the website and stop the application. e.Handled = true; //Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); }); } }
public static void WriteAndRunXAML(string componentCode) { string path = "code.xaml"; using (StreamWriter w = new StreamWriter(path)) { w.Write(componentCode); } StreamReader sr = new StreamReader(path); StackPanel root = XamlReader.Load(sr.BaseStream) as StackPanel; //UIElement item = (UIElement)(XamlReader.Parse(componentCode)); ChildWindow child = new ChildWindow(); //child.Preview.Children.Add(item); //child.Preview = root; child.Content = root; child.ShowDialog(); }
public void ShowSendDialog(object dataContext, Action dialogLoaded = null) { if (_sendView != null && _sendView.IsOpen) { return; } _sendView = new FrameView { DataContext = dataContext }; if (dialogLoaded != null) { _sendView.Loaded += (sender, args) => { dialogLoaded(); } } ; this.ShowChildWindowAsync( dialog: _sendView, overlayFillBehavior: ChildWindowManager.OverlayFillBehavior.FullWindow); }
private void ShowConfigDialog(MainViewModel mainViewModel) { var win = new ChildWindow(); win.Title = "Configure"; var configViewModel = new ConfigViewModel(mainViewModel.AgentConfig); configViewModel.Removed += mainViewModel.OnNodeRemoved; configViewModel.Updated += mainViewModel.OnNodeUpdated; configViewModel.Added += mainViewModel.OnNodeAdded; win.Content = new ConfigPanel() { DataContext = configViewModel }; win.Width = 600; win.Height = 300; win.Show(); }
public override bool EnumChildWindowCallBack(int hWnd, int lParam) { if (children.ContainsKey(hWnd) || bannedChildren.Contains(hWnd)) { return(true); } ChildWindow cw = new ChildWindow(hWnd); // Only save this child if it's relevant, otherwise ban the window if (cw.ControlID == 339 || cw.ControlID == 443 || cw.ControlID == 4000) { children.Add(hWnd, new ChildWindow(hWnd)); } else { bannedChildren.Add(hWnd); } return(true); }
public void ShowReceiveDialog(object dataContext) { if (_receiveView != null) { if (_receiveView.IsOpen) { return; } _receiveView.DataContext = dataContext; } else { _receiveView = new ReceiveView { DataContext = dataContext }; } this.ShowChildWindowAsync( dialog: _receiveView, overlayFillBehavior: ChildWindowManager.OverlayFillBehavior.FullWindow); }
public InputStandBookJAViewModel(ChildWindow aChildWindow) { IsBusy = false; TaxPayerEntityDirectory = new Dictionary <int, TaxPayerEntity>(); StandBookEntityDirectory = new Dictionary <string, StandBookEntity>(); FileTypeEntityList = new ObservableCollection <FileTypeEntity>(); childWindow = aChildWindow; OnOpenStandBookFile = new DelegateCommand(onOpenStandBookFile); OnOK = new DelegateCommand(onOK, canOK); OnCancel = new DelegateCommand(onCancel); StandBookEntity = new StandBookEntity(); HasShowTemp = Visibility.Collapsed; ShowProgress = Visibility.Collapsed; ShowUpdate = Visibility.Visible; documentManagerContext = new Web.DocumentManagerDomainContext(); CanInput = false; LoadData(); }
public static void DragChildWindow(this ChildWindow childWindow, Point p) { var root = VisualTreeHelper.GetChild(childWindow, 0) as FrameworkElement; if (root == null) { return; } var contentRoot = root.FindName("ContentRoot") as FrameworkElement; if (contentRoot == null) { return; } var group = contentRoot.RenderTransform as TransformGroup; if (group == null) { return; } TranslateTransform translateTransform = null; foreach (var transform in group.Children.OfType <TranslateTransform>()) { translateTransform = transform; } if (translateTransform == null) { return; } // reset transform translateTransform.X += p.X; translateTransform.Y += p.Y; }
/// <summary> /// Displays content in a window /// </summary> /// <param name="windowTitle">Title text shown in window</param> /// <param name="windowContents">Contents of the window</param> /// <param name="isModal">Determines wheter the window is modal or not</param> /// <param name="onClosingHandler">Event handler invoked when window is closing, and can be handled to cancel window closure</param> /// <param name="onClosedHandler">Event handler invoked when window is closed</param> public void ShowWindow(string windowTitle, FrameworkElement windowContents, bool isModal = false, EventHandler <CancelEventArgs> onClosingHandler = null, EventHandler onClosedHandler = null) { if (windowContents == null) { throw new ArgumentNullException("windowContents"); } int hashCode = windowContents.GetHashCode(); ChildWindow childWindow = null; if (!m_ChildWindows.TryGetValue(hashCode, out childWindow)) { // not existing yet childWindow = new ChildWindow() { Title = windowTitle ?? string.Empty, }; if (onClosedHandler != null) { childWindow.Closed += onClosedHandler; } if (onClosingHandler != null) { childWindow.Closing += onClosingHandler; } childWindow.CloseCompleted += new EventHandler(childWindow_CloseCompleted); childWindow.Content = windowContents; m_ChildWindows.Add(hashCode, childWindow); if (!isModal) { windowContents.Loaded += (o, e) => { DialogResizeHelper.CenterAndSizeDialog(windowContents, childWindow); }; DialogResizeHelper.CenterAndSizeDialog(windowContents, childWindow); } } childWindow.ShowDialog(isModal); }
/// <summary> /// 从某个控件位置打开窗体 /// </summary> /// <param name="childWindow"></param> /// <param name="baseElement"></param> public static void GetTransform(this ChildWindow childWindow, FrameworkElement baseElement) { if (childWindow == null || baseElement == null) { return; } var zoomFactory = HtmlHelper.ZoomFactor; var position = baseElement.TransformToVisual(null).Transform(new Point(0, 0)); position = new Point(position.X * zoomFactory, position.Y * zoomFactory); var pageSize = HtmlHelper.PageSize; pageSize = new Size(pageSize.Width * zoomFactory, pageSize.Height * zoomFactory); //处理边角 //处理位置 bool upFlag = false; var start = new Point(position.X, position.Y + baseElement.ActualHeight / 2); if (position.Y + baseElement.ActualHeight / 2 > pageSize.Height / 2)//向上延伸 { upFlag = true; } //计算childwindows的长度,宽度。 //计算childwindow的位置 var left = position.X + baseElement.Height; //ComboBox cob; //childWindow.Measure() }
void m_serviceClient_CheckAppVersionCompleted(object sender, CheckAppVersionCompletedEventArgs e) { CPApplication.Current.Browser.LoadingSpin.Hide(); if (e.Error != null) { CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show(e.Error.Message, MessageBoxType.Error); return; } if (e.Result.Faults != null && e.Result.Faults.Count > 0) { CPApplication.Current.CurrentPage.Context.Window.MessageBox.Show(e.Result.Faults[0].ErrorDescription, MessageBoxType.Error); return; } var childWindow = new ChildWindow(); var about = new About { ChildWindow = childWindow, AppVersion = e.Result }; childWindow.Style = Application.Current.Resources["AboutWindowStyle"] as Style; childWindow.Content = about; childWindow.Show(); }
private void ShowDialogAsync <TView>( object dataContext, ref ChildWindow childView, EventHandler canceled = null) where TView : ChildWindow, new() { if (childView != null && childView.IsOpen) { return; } childView = new TView { DataContext = dataContext }; if (canceled != null) { childView.CloseButtonClicked += canceled; } this.ShowChildWindowAsync( dialog: childView, overlayFillBehavior: ChildWindowManager.OverlayFillBehavior.FullWindow); }
public void NotifyShowCardsEnd() { Application.Current.Dispatcher.Invoke((ThreadStart)delegate() { if (_showHandCardsWindow == null) return; gridRoot.Children.Remove(_showHandCardsWindow); _showHandCardsWindow = null; }); }
void desktopUserControl_OnProgramOpened(ChildWindow programUC) { programUC.Show(); Root.Children.Add(programUC); }
void _player_PropertyChanged(object sender, PropertyChangedEventArgs e) { Application.Current.Dispatcher.Invoke((ThreadStart)delegate() { PlayerViewModel model = sender as PlayerViewModel; int count = GameModel.PlayerModels.Count; if (e.PropertyName == "IsCardChoiceQuestionShown") { if (model.IsCardChoiceQuestionShown) { if (cardChoiceWindow != null) { gridRoot.Children.Remove(cardChoiceWindow); } cardChoiceWindow = new ChildWindow(); cardChoiceWindow.Template = Resources["DarkGreenWindowStyle"] as ControlTemplate; cardChoiceWindow.MaxWidth = 800; cardChoiceWindow.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center; cardChoiceWindow.CloseButtonVisibility = model.CardChoiceModel.CanClose ? Visibility.Visible : Visibility.Collapsed; cardChoiceWindow.Effect = new DropShadowEffect(){ BlurRadius = 10d }; cardChoiceWindow.Caption = model.CardChoiceModel.Prompt; var box = CardChoiceBoxSelector.CreateBox(model.CardChoiceModel); if (box is CardArrangeBox) { (box as CardArrangeBox).OnCardMoved += (s1, s2, d1, d2) => { var callback = model.CurrentCardChoiceRearrangeCallback; if (callback != null) { callback(new CardRearrangement(s1, s2, d1, d2)); } }; } gridRoot.Children.Add(cardChoiceWindow); cardChoiceWindow.WindowStartupLocation = Xceed.Wpf.Toolkit.WindowStartupLocation.Center; cardChoiceWindow.Content = box; cardChoiceWindow.Show(); } else if (cardChoiceWindow != null) { cardChoiceWindow.Close(); gridRoot.Children.Remove(cardChoiceWindow); cardChoiceWindow = null; } } else if (e.PropertyName == "Role") { int index; for (index = 0; index < count; index++) { var playerModel = GameModel.PlayerModels[index]; if (playerModel == model) break; } Trace.Assert(index < count); if (model.Player.Role == Role.Ruler) { gameLogs.Logs.Clear(); for (int i = 0; i < count; i++) { gameLogs.Logs.Add(GameModel.PlayerModels[(i + index) % count].Player, logDocs[i + 1]); } } } else if (e.PropertyName == "Hero") { gameLogs.AppendPickHeroLog(model.Player, true); } }); }
private void Button_Click(object sender, RoutedEventArgs e) { ChildWindow child = new ChildWindow(); child.Show(); }
private void MenuItem_Click_Option(object sender, RoutedEventArgs e) { reset(); ChildWindow option = new ChildWindow(imageBG); option.ShowDialog(); }
private void ToggleView(ref ChildWindow win, bool visible) { if (win == null) { win = new ChildWindow(); win.ShowInTaskbar = false; win.Owner = Application.Current.MainWindow; win.WindowStartupLocation = WindowStartupLocation.CenterOwner; } if (visible) { win.Show(); } else { win.Close(); } }
private void _constructPlayerCurrentSpecialDeck(PlayerViewModel model) { if (model.CurrentSpecialDeck != null) { Trace.Assert(model.CurrentSpecialDeck.Cards != null); if (_privateDeckChoiceWindow != null) { gridRoot.Children.Remove(_privateDeckChoiceWindow); } _privateDeckChoiceWindow = new ChildWindow(); _privateDeckChoiceWindow.Template = Resources["BlackWindowStyle"] as ControlTemplate; _privateDeckChoiceWindow.MaxWidth = 800; _privateDeckChoiceWindow.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center; _privateDeckChoiceWindow.CloseButtonVisibility = Visibility.Collapsed; _privateDeckChoiceWindow.WindowStartupLocation = Xceed.Wpf.Toolkit.WindowStartupLocation.Center; string title = LogFormatter.Translate(new CardChoicePrompt("SpecialDeck", model.CurrentSpecialDeck.DeckPlace)); _privateDeckChoiceWindow.Caption = title; var box = new PrivateDeckBox(); box.DataContext = model.CurrentSpecialDeck.Cards; _privateDeckChoiceWindow.Content = box; gridRoot.Children.Add(_privateDeckChoiceWindow); _privateDeckChoiceWindow.Show(); } else { gridRoot.Children.Remove(_privateDeckChoiceWindow); _privateDeckChoiceWindow = null; } }
private void OnConfigCommandMessage(ConfigCommandMessage message) { var window = new ChildWindow(); var contentControl = new NewEditServer(); contentControl.DataContext = new EditServerDetailViewModel(message.Server); window.Content = contentControl; window.SizeToContent = SizeToContent.WidthAndHeight; window.Topmost = true; window.WindowStartupLocation = WindowStartupLocation.CenterScreen; window.ResizeMode = ResizeMode.NoResize; window.Title = "Edit Server"; Messenger.Default.Register<CloseEditServerMessage>(this, (m) => { window.DialogResult = false; window.Close(); }); window.ShowDialog(); Messenger.Default.Unregister<CloseEditServerMessage>(this); }
private void newChildWindowButton_Click(object sender, RoutedEventArgs e) { // Create a new skind child window var window = new ChildWindow(); window.Show(); }
public void NotifyShowCardsStart(Player p, List<Card> cards) { Application.Current.Dispatcher.Invoke((ThreadStart)delegate() { if (_showHandCardsWindow != null) { gridRoot.Children.Remove(_showHandCardsWindow); } _showHandCardsWindow = new ChildWindow(); _showHandCardsWindow.Template = Resources["DarkGreenWindowStyle"] as ControlTemplate; _showHandCardsWindow.MaxWidth = 800; _showHandCardsWindow.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center; _showHandCardsWindow.CloseButtonVisibility = Visibility.Visible; _showHandCardsWindow.Effect = new DropShadowEffect() { BlurRadius = 10d }; _showHandCardsWindow.WindowStartupLocation = Xceed.Wpf.Toolkit.WindowStartupLocation.Center; string title = PromptFormatter.Format(new CardChoicePrompt("ShowCards", p)); _showHandCardsWindow.Caption = title; var viewModels = from c in cards select new CardViewModel() { Card = c }; var box = new PrivateDeckBox(); box.IsHitTestVisible = false; box.Margin = new Thickness(0, -20, 0, 0); box.DataContext = new ObservableCollection<CardViewModel>(viewModels); _showHandCardsWindow.Content = box; gridRoot.Children.Add(_showHandCardsWindow); _showHandCardsWindow.Show(); _showHandCardsWindow.Closed += (o, e) => { GameModel.MainPlayerModel.AnswerEmptyMultichoiceQuestion(); }; }); }
private void _constructPlayerCurrentPrivateDeck(PlayerViewModel model) { if (model.CurrentPrivateDeck != null) { Trace.Assert(model.CurrentPrivateDeck.Cards != null); if (_privateDeckChoiceWindow != null) { gridRoot.Children.Remove(_privateDeckChoiceWindow); } _privateDeckChoiceWindow = new ChildWindow(); _privateDeckChoiceWindow.Template = Resources["DarkGreenWindowStyle"] as ControlTemplate; _privateDeckChoiceWindow.MaxWidth = 800; _privateDeckChoiceWindow.HorizontalContentAlignment = System.Windows.HorizontalAlignment.Center; _privateDeckChoiceWindow.CloseButtonVisibility = Visibility.Collapsed; _privateDeckChoiceWindow.Effect = new DropShadowEffect() { BlurRadius = 10d }; _privateDeckChoiceWindow.WindowStartupLocation = Xceed.Wpf.Toolkit.WindowStartupLocation.Center; string title = PromptFormatter.Format(new CardChoicePrompt("PrivateDeck", model.Player, model.CurrentPrivateDeck.TraslatedName)); _privateDeckChoiceWindow.Caption = title; var box = new PrivateDeckBox(); box.DataContext = model.CurrentPrivateDeck.Cards; _privateDeckChoiceWindow.Content = box; gridRoot.Children.Add(_privateDeckChoiceWindow); _privateDeckChoiceWindow.Show(); } else { gridRoot.Children.Remove(_privateDeckChoiceWindow); _privateDeckChoiceWindow = null; } }
internal void Hide(ChildWindow wnd) { if (_topWindow == wnd) _topWindow = null; Children.Remove(wnd); }