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 mmf_DoubleClick(object sender, MouseButtonEventArgs e) { TimeSpan span; if (sender == lastClickItem) { DateTime now = DateTime.Now; span = now - lastClicked; if (span.Milliseconds < 300) { var child = new ChildWindow(); child.Show(); child.Closed += delegate { }; } else { lastClickItem = null; } } lastClicked = DateTime.Now; lastClickItem = sender; }
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(); }
/// <summary> /// Show popup window whichs is special, has special message /// </summary> /// <param name="childWindow"></param> /// <param name="message"></param> public static void Show(ChildWindow childWindow, MessageItem message) { if (childWindow != null) { _instance = childWindow; _instance.Show(); Messenger.Default.Send<MessageItem>(message); } }
private void OKButton_Click(object sender, RoutedEventArgs e) { this.Close(); ChildWindow chol = new ChildWindow(); chol.Height = 2400; chol.Width = 2300; //SL_Project_UI.MainPage mp = new SL_Project_UI.MainPage(); //mp.Visibility = Visibility.Collapsed; chol.Show(); }
public void OpenWindow(ViewModelBase viewModel, Action onClosed) { var childWindow = new ChildWindow { Content = GetViewForViewModel(viewModel) }; var canClose = viewModel as ICanClose; if (canClose != null) { canClose.RequestClose += (s,e) => childWindow.Close(); } childWindow.Closed += (s,e) => onClosed(); childWindow.Show(); }
/// <summary> /// Renders this view. /// </summary> public override void Render() { var dispatcher = ControllerContext.Request.Navigator.Dispatcher; dispatcher.Dispatch( delegate { TraceSources.MagellanSource.TraceInformation("The WindowViewEngine is instantiating the window '{0}'.", _type); // Prepare the window RenderedInstance = (ChildWindow)_viewActivator.Instantiate(_type); WireModelToView(RenderedInstance); TraceSources.MagellanSource.TraceVerbose("The ChildWindowViewEngine is rendering the window '{0}' as a dialog.", _type); RenderedInstance.Show(); }); }
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(); }
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 MainPage() { InitializeComponent(); Loaded += MainPage_Loaded; Messenger.Default.Register<Player>(this, (player) => { var dialog = new ChangePlayerNameDialogView(); Messenger.Default.Send<Player, ChangePlayerNameDialogViewModel>(player); dialog.Show(); }); Messenger.Default.Register<SticksAIPlayer>(this, Tokens.EducationEnded, (player) => { var educationResult = new ChildWindow(); educationResult.Content = new TextBlock() { Text = player.Name + " is ready for battle!" }; educationResult.Show(); }); Messenger.Default.Register<Tuple<Player, Player>>(this, Tokens.GameEnded, (playersPair) => { var gameResult = new ChildWindow(); gameResult.Content = new TextBlock() { Text = GameOverMessage.GetRandom(playersPair.Item1.Name, playersPair.Item2.Name) }; gameResult.Show(); }); }
// If an error occurs during navigation, show an error window private void ContentFrame_NavigationFailed(object sender, NavigationFailedEventArgs e) { e.Handled = true; ChildWindow errorWin = new ChildWindow{Content = new TextBlock{Text = e.Exception.ToString()}}; errorWin.Show(); }
public void ShowUnsavedChangesDialog(Action subsequentAction) { var saveButton = new Button() { HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(8), Content = "Save", Width = 100 }; saveButton.Click += delegate(object sender, RoutedEventArgs e) { (((sender as Button).Parent as Grid).Parent as ChildWindow).Close(); Save(); subsequentAction(); }; var dontSaveButton = new Button() { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(8), Content = "Don't Save", Width = 100 }; dontSaveButton.Click += delegate(object sender, RoutedEventArgs e) { (((sender as Button).Parent as Grid).Parent as ChildWindow).Close(); subsequentAction(); }; var cancelButton = new Button() { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom, Margin = new Thickness(8), Content = "Cancel", Width = 100 }; cancelButton.Click += delegate(object sender, RoutedEventArgs e) { (((sender as Button).Parent as Grid).Parent as ChildWindow).Close(); }; TextBlock text = new TextBlock(); string drawingName = drawingHost.CurrentDrawing.Name; if (drawingName == null) drawingName = "untitled"; text.Text = "Do you want to save changes to \"" + drawingName + "\"?"; Grid grid = new Grid() { Width = 360 }; grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); Grid.SetRow(text, 0); Grid.SetRow(dontSaveButton, 1); Grid.SetRow(saveButton, 1); Grid.SetRow(cancelButton, 1); grid.Children.Add(text, saveButton, dontSaveButton, cancelButton); var unsavedChangesWindow = new ChildWindow() { Content = grid }; unsavedChangesWindow.HasCloseButton = false; unsavedChangesWindow.Show(); }
private void LogoutTimerTick( object sender, EventArgs e ) { ( ( DispatcherTimer )sender ).Stop (); // The main logout time has expired. Show the log out warning prompt. LogOutWarning = new LogOutWarningView ( response.WarningTimeOutIntervalSeconds ); LogOutWarning.Closed += LogOutWarningClosed; LogOutWarning.Show (); // Start the warning timer. _warningLogoutTimer.Interval = TimeSpan.FromSeconds ( response.WarningTimeOutIntervalSeconds ); _warningLogoutTimer.Tick += WarningLogoutTimerTick; _warningLogoutTimer.Start (); }
private void newChildWindowButton_Click(object sender, RoutedEventArgs e) { // Create a new skind child window var window = new ChildWindow(); window.Show(); }
public static ChildWindow PopupMessage(string title, string message, string closeButtonLabel, bool closeWindow) { if (CurrentPopup != null) return null; var msgBox = new ChildWindow(); CurrentPopup = msgBox; msgBox.Style = Application.Current.Resources["PopupMessageWindow"] as Style; msgBox.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0xBA, 0xD2, 0xEC)); msgBox.Title = title; msgBox.MaxWidth = Application.Current.Host.Content.ActualWidth * 0.5; StackPanel content = new StackPanel(); content.Children.Add(new TextBlock() { Text = message, Margin = new Thickness(20), Foreground = new SolidColorBrush(Colors.White), FontSize = 14, HorizontalAlignment=HorizontalAlignment.Center }); Button closeButton = new Button { Content = closeButtonLabel, FontSize = 14, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(20) }; closeButton.Click += (s, o) => { msgBox.Close(); if (closeWindow) { BrowserWindow.Close(); } }; content.Children.Add(closeButton); msgBox.Content = content; msgBox.IsTabStop = true; msgBox.Show(); msgBox.Focus(); _currentWindow = msgBox; PopupManager.CloseActivePopup(); return msgBox; }
public static ChildWindow PopupContent(string title, object content, IEnumerable<Button> buttons) { if (CurrentPopup != null) return null; var msgBox = new ChildWindow(); CurrentPopup = msgBox; msgBox.Style = Application.Current.Resources["PopupMessageWindow"] as Style; msgBox.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0xBA, 0xD2, 0xEC)); msgBox.Title = title; msgBox.MaxWidth = Application.Current.Host.Content.ActualWidth * 0.5; StackPanel panel = new StackPanel(); panel.Children.Add(new ContentPresenter() { Content = content }); StackPanel buttonPanel = new StackPanel() { Margin = new Thickness(20), Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center }; if (buttons != null) { foreach (Button b in buttons) { b.Click += (s, e) => { msgBox.Close(); }; buttonPanel.Children.Add(b); } } else { var closeButton = new Button { Content = Labels.ButtonClose, HorizontalAlignment = HorizontalAlignment.Center, }; closeButton.Click += (s, e) => { msgBox.Close(); }; buttonPanel.Children.Add(closeButton); } panel.Children.Add(buttonPanel); msgBox.Content = panel; msgBox.IsTabStop = true; msgBox.Show(); msgBox.Focus(); PopupManager.CloseActivePopup(); return msgBox; }
private void ShowItemTable(IList<string> items) { string tblTxt = ""; string facet = ""; int c = 0; foreach (string item in items) { PivotItem pivotItem = MainPivotViewer.GetItem(item); if (c == 0) { foreach (KeyValuePair<string, IList<string>> kvp in pivotItem.Facets) { if (validFacet(kvp.Key)) { tblTxt += kvp.Key + "\t"; } } tblTxt += "\n"; } foreach (KeyValuePair<string, IList<string>> kvp in pivotItem.Facets) { if (validFacet(kvp.Key)) { string val = String.Join(", ", ((List<string>)kvp.Value).ToArray()); string[] vals = Regex.Split(val, "[|]{2}"); if (vals.Length > 1) { facet = vals[1]; } else { facet = vals[0]; } tblTxt += facet + "\t"; } } tblTxt += "\n"; c += 1; } ChildWindow childWin = new ChildWindow(); childWin.Width = 800; childWin.Height = 400; childWin.Title = "BL!P Output in Tablular Format"; TextBox tb = new TextBox(); tb.Text = tblTxt; childWin.Content = tb; tb.IsReadOnly = true; tb.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible; tb.VerticalScrollBarVisibility = ScrollBarVisibility.Visible; childWin.Show(); }
public static ChildWindow PopupMessage( string title, string message) { if (CurrentPopup != null) return null; var msgBox = new ChildWindow(); CurrentPopup = msgBox; msgBox.Style = System.Windows.Application.Current.Resources["PopupMessageWindow"] as Style; msgBox.BorderBrush = new SolidColorBrush(Color.FromArgb(0xFF, 0xBA, 0xD2, 0xEC)); msgBox.Title = title; msgBox.MaxWidth = Application.Current.Host.Content.ActualWidth * 0.5; msgBox.Content = new TextBlock() { Text = message, Margin = new Thickness(20), Foreground = new SolidColorBrush(Colors.White), FontSize = 14 }; msgBox.IsTabStop = true; msgBox.Show(); msgBox.Focus(); _currentWindow = msgBox; PopupManager.CloseActivePopup(); return msgBox; }
public static void Message(String title,string message) { ChildWindow childWindow = new ChildWindow(); childWindow.Title = title; childWindow.Content = message; childWindow.Show(); }
private void ShowSequences(IList<string> items) { string tblTxt = ""; string facet = ""; int c = 0; foreach (string item in items) { PivotItem pivotItem = MainPivotViewer.GetItem(item); string queryName = ""; string querySequence = ""; foreach (KeyValuePair<string, IList<string>> kvp in pivotItem.Facets) { if (kvp.Key == "QueryName") { string val = String.Join(", ", ((List<string>)kvp.Value).ToArray()); string[] vals = Regex.Split(val, "[|]{2}"); if (vals.Length > 1) { facet = vals[1]; } else { facet = vals[0]; } queryName = facet; } if (kvp.Key == "QuerySequence") { string val = String.Join(", ", ((List<string>)kvp.Value).ToArray()); string[] vals = Regex.Split(val, "[|]{2}"); if (vals.Length > 1) { facet = vals[1]; } else { facet = vals[0]; } querySequence = facet; } } tblTxt += ">" + queryName + "\n" + querySequence + "\n"; c += 1; } ChildWindow childWin = new ChildWindow(); childWin.Width = 800; childWin.Height = 400; childWin.Title = "BL!P Query Sequences in FASTA Format"; TextBox tb = new TextBox(); tb.Text = tblTxt; childWin.Content = tb; tb.IsReadOnly = true; tb.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible; tb.VerticalScrollBarVisibility = ScrollBarVisibility.Visible; childWin.Show(); }
/// <summary> /// Show popup window whichs is special, non default message /// </summary> /// <param name="childWindow"></param> public static void Show(ChildWindow childWindow) { if (childWindow != null) { _instance = childWindow; _instance.Show(); } }
private void Button_Click(object sender, RoutedEventArgs e) { ChildWindow child = new ChildWindow(); child.Show(); }
public static ChildWindow OpenWindow(object ContentControl,double _Width = 700, double _Height = 500) { var SectionWindow = new ChildWindow {Width=_Width,Height=_Height}; SectionWindow.Content = ContentControl; SectionWindow.Visibility = Visibility.Visible; // SectionWindow.Title = ApplicationStrings.MaterialTitle; SectionWindow.Show(); return SectionWindow; }
private void DrawAreas(XAMLResponse e) { CenterRectAreas = new LocationRect(); AllPointsInLayer = new LocationCollection(); int resultCnt = e.OutputFields.Count; if (resultCnt > 0) { if (resultCnt < recordLimit) { if (Layers.Count > 0) { MapLayer currentLayer = Layers[0]; MapLayer newLayer = (MapLayer)XamlReader.Load(e.XAML); currentLayer.Children.Clear(); Layers[2].Children.Clear(); currentLayer.Children.Add(newLayer); foreach (XAMLFields shp in e.OutputFields) { UIElement el = (UIElement)newLayer.FindName(shp.ID); if (el != null) { el.MouseLeftButtonUp += new MouseButtonEventHandler(el_MouseLeftButtonUp); el.MouseEnter += polygon_MouseEnter; el.MouseLeave += polygon_MouseLeave; Area newArea = new Area(); newArea.Name = shp.Fields["name"]; newArea.Country = shp.Fields["country"].ToString(); newArea.DesignationType = shp.Fields["desig_type"]; newArea.Designation = shp.Fields["desig_eng"]; newArea.RepArea = shp.Fields["rep_area"]; int year = 0; int.TryParse(shp.Fields["status_yr"], out year); if (year != 0) newArea.StatusYear = year; newArea.Wdpaid = int.Parse(shp.Fields["wdpaid"]); newArea.Iucncat = shp.Fields["iucncat"]; StringBuilder label = new StringBuilder("\n"); label.Append("Name :" + shp.Fields["name"] + "\n"); label.Append("Country :" + shp.Fields["country"] + "\n"); label.Append("Designation :" + shp.Fields["desig_eng"] + "\n"); label.Append("Type :" + shp.Fields["desig_type"] + "\n"); label.Append("Total Area :" + shp.Fields["rep_area"] + "\n"); label.Append("Iucncat :" + shp.Fields["iucncat"] + "\n"); label.Append("Continent :" + shp.Fields["continent"] + "\n"); (el as FrameworkElement).Tag = newArea; ToolTip tt = AddToolTip(label.ToString()); ToolTipService.SetToolTip(el, tt); if (el.GetType().Equals(typeof(Pushpin))) { Pushpin p = (Pushpin)el; AllPointsInLayer.Add(p.Location); Pin pin = new Pin { ShowCustomPin = true }; pin.MouseLeftButtonUp += new MouseButtonEventHandler(el_MouseLeftButtonUp); pin.Cursor = Cursors.Hand; newLayer.AddChild(pin, p.Location, PositionOrigin.BottomCenter); ToolTip tt1 = AddToolTip(label.ToString()); ToolTipService.SetToolTip(pin, tt1); newLayer.Children.Remove(p); } if (el.GetType().Equals(typeof(MapLayer))) { MapLayer p = (MapLayer)el; p.Cursor = Cursors.Hand; foreach (MapPolygon mp in p.Children) { for (int i = 0; i < mp.Locations.Count; i++) { AllPointsInLayer.Add(mp.Locations[i]); } mp.Fill = new SolidColorBrush(MiscFunctions.ColorFromInt(LayerStyle[Layers[0].Name].fill)); mp.Stroke = new SolidColorBrush(MiscFunctions.ColorFromInt(LayerStyle[Layers[0].Name].stroke)); mp.Opacity = LayerStyle[Layers[0].Name].opacity; LocationRect rect = new LocationRect(mp.Locations); Pin pin = new Pin { ShowCustomTree = true }; pin.Tag = (el as MapLayer); ToolTip tt1 = AddToolTip(label.ToString()); pin.Cursor = Cursors.Hand; ToolTipService.SetToolTip(pin, tt1); pin.MouseLeftButtonUp += new MouseButtonEventHandler(el_MouseLeftButtonUp); newLayer.AddChild(pin, rect.Center, PositionOrigin.BottomCenter); photoservices.GetFotos(rect, Layers[2], currentMap); } } if (el.GetType().Equals(typeof(MapPolyline))) { MapPolyline p = (MapPolyline)el; for (int i = 0; i < p.Locations.Count; i++) { AllPointsInLayer.Add(p.Locations[i]); } p.Stroke = new SolidColorBrush(MiscFunctions.ColorFromInt(LayerStyle[Layers[0].Name].stroke)); p.StrokeThickness = 2; p.StrokeMiterLimit = 0; } if (el.GetType().Equals(typeof(MapPolygon))) { MapPolygon p = (MapPolygon)el; for (int i = 0; i < p.Locations.Count; i++) { AllPointsInLayer.Add(p.Locations[i]); } LocationRect rect = new LocationRect(p.Locations); Pin pin = new Pin { ShowCustomTree = true }; ToolTip tt1 = AddToolTip(label.ToString()); ToolTipService.SetToolTip(pin, tt1); pin.Cursor = Cursors.Hand; pin.MouseLeftButtonUp += new MouseButtonEventHandler(el_MouseLeftButtonUp); newLayer.AddChild(pin, rect.Center, PositionOrigin.BottomCenter); p.Stroke = new SolidColorBrush(MiscFunctions.ColorFromInt(LayerStyle[Layers[0].Name].stroke)); p.Fill = new SolidColorBrush(MiscFunctions.ColorFromInt(LayerStyle[Layers[0].Name].fill)); p.Opacity = LayerStyle[Layers[0].Name].opacity; } } } } CenterRectAreas = new LocationRect(AllPointsInLayer); if(currentMap != null) currentMap.SetView(CenterRectAreas); if (AllPointsInLayer != null) AllPointsInLayer.Clear(); CenterRectAreas = null; } else { cw = new ChildWindow { Content = "Too many locations were found, try a smaller area" }; cw.Show(); } } else { cw = new ChildWindow { Content = string.Format("No locations were found, try a bigger area {0}",e.OutputMessage) }; cw.Show(); } Messenger.Default.Send<bool>(true, "draw"); }
private void ShowAsChildWindow(object ContentControl) { var SectionWindow = new ChildWindow(); SectionWindow.Height = 500; SectionWindow.Width = 800; SectionWindow.Content = ContentControl; SectionWindow.Visibility = Visibility.Visible; SectionWindow.Show(); //SectionWindow.Closing += new EventHandler<System.ComponentModel.CancelEventArgs>(SectionWindow_Closing); }
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(); }
private void ShowConnectionDialog() { Deployment.Current.Dispatcher.BeginInvoke(() => { _connectionDialog = new ConnectionViewDialog(); _connectionDialog.Closed += (sender, e) => { }; _connectionDialog.Show(); }); }