本文整理汇总了C#中System.Windows.Controls.ChildWindow.Show方法的典型用法代码示例。如果您正苦于以下问题:C# ChildWindow.Show方法的具体用法?C# ChildWindow.Show怎么用?C# ChildWindow.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.ChildWindow
的用法示例。
在下文中一共展示了ChildWindow.Show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainWindow
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();
});
}
示例2: mmf_DoubleClick
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;
}
示例3: Button_Click
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();
}
示例4: 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);
}
}
示例5: OKButton_Click
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();
}
示例6: OpenWindow
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();
}
示例7: Render
/// <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();
});
}
示例8: ShowConfigDialog
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();
}
示例9: OnConfigCommandMessage
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();
}
示例10: MainPage
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();
});
}
示例11: ContentFrame_NavigationFailed
// 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();
}
示例12: ShowUnsavedChangesDialog
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();
}
示例13: LogoutTimerTick
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 ();
}
示例14: newChildWindowButton_Click
private void newChildWindowButton_Click(object sender, RoutedEventArgs e)
{
// Create a new skind child window
var window = new ChildWindow();
window.Show();
}
示例15: PopupMessage
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;
}