本文整理汇总了C#中System.Windows.Window.Show方法的典型用法代码示例。如果您正苦于以下问题:C# Window.Show方法的具体用法?C# Window.Show怎么用?C# Window.Show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Window
的用法示例。
在下文中一共展示了Window.Show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: App_Startup
void App_Startup(object sender, StartupEventArgs e)
{
Window = new MainWindow();
SubscribeToWindowEvents();
MainWindow = Window;
Window.Show();
}
示例2: Main
public static void Main()
{
// original (doesn't work with snoop, well, can't find a window to own the snoop ui)
Window window = new Window();
window.Title = "Say Hello";
window.Show();
Application application = new Application();
application.Run();
// setting the MainWindow directly (works with snoop)
// Window window = new Window();
// window.Title = "Say Hello";
// window.Show();
//
// Application application = new Application();
// application.MainWindow = window;
// application.Run();
// creating the application first, then the window (works with snoop)
// Application application = new Application();
// Window window = new Window();
// window.Title = "Say Hello";
// window.Show();
// application.Run();
// creating the application first, then the window (works with snoop)
// Application application = new Application();
// Window window = new Window();
// window.Title = "Say Hello";
// application.Run(window);
} }
示例3: PlatformWpf
public PlatformWpf()
: base(null, true)
{
var app = new Application ();
var slCanvas = new Canvas ();
var win = new Window
{
Title = Title,
Width = Width,
Height = Height,
Content = slCanvas
};
var cirrusCanvas = new CirrusCanvas(slCanvas, Width, Height);
MainCanvas = cirrusCanvas;
win.Show ();
EntryPoint.Invoke (null, null);
var timer = new DispatcherTimer ();
timer.Tick += runDelegate;
timer.Interval = TimeSpan.FromMilliseconds (1);
timer.Start ();
app.Run ();
}
示例4: OnStartup
protected override void OnStartup(StartupEventArgs args)
{
base.OnStartup(args);
Window win = new Window();
win.Title = "Inherit the App";
win.Show();
}
示例5: RunCommand
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
m_doc = doc;
m_window = new Window {Title = "Object ID and Thread ID", Width = 500, Height = 75};
m_label = new Label();
m_window.Content = m_label;
new System.Windows.Interop.WindowInteropHelper(m_window).Owner = Rhino.RhinoApp.MainWindowHandle();
m_window.Show();
// register the rhinoObjectAdded method with the AddRhinoObject event
RhinoDoc.AddRhinoObject += RhinoObjectAdded;
// add a sphere from the main UI thread. All is good
AddSphere(new Point3d(0,0,0));
// add a sphere from a secondary thread. Not good: the rhinoObjectAdded method
// doesn't work well when called from another thread
var add_sphere_delegate = new Action<Point3d>(AddSphere);
add_sphere_delegate.BeginInvoke(new Point3d(0, 10, 0), null, null);
// handle the AddRhinoObject event with rhinoObjectAddedSafe which is
// desgined to work no matter which thread the call is comming from.
RhinoDoc.AddRhinoObject -= RhinoObjectAdded;
RhinoDoc.AddRhinoObject += RhinoObjectAddedSafe;
// try again adding a sphere from a secondary thread. All is good!
add_sphere_delegate.BeginInvoke(new Point3d(0, 20, 0), null, null);
doc.Views.Redraw();
return Result.Success;
}
示例6: TryShowWindow
static void TryShowWindow(Window window) {
try {
window.Show();
} catch (InvalidOperationException e) {
MainLog.Logger.FormattedDebugException(e);
}
}
示例7: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
// General
/* TODO: Do the following tasks for Login
* 1- The first window to spawn is gonna be the login.
* 2- After the users enters the correct credentials (email and pasword) close the login window, make spawn the application
* window, and make that new window the main one.
*/
// New Login window
_loginWindow = new SessionView();
SessionViewModel context = new SessionViewModel();
_loginWindow.DataContext = context;
_loginWindow.Show();
//App.RunAppAfterSuccessfulLogin();
// Old but login window
/*
_loginWindow = new LoginView();
LoginViewModel context = new LoginViewModel();
_loginWindow.DataContext = context;
_loginWindow.Show();*/
//App.RunAppAfterSuccessfulLogin();
/*ApplicationView app = new ApplicationView();
string path = "Data/employees.xml";
ApplicationViewModel context = new ApplicationViewModel(path);
app.DataContext = context;
app.Show();*/
}
示例8: OpenLocationView
private void OpenLocationView(object sender, MouseButtonEventArgs e){
var locIcon = (Ellipse)sender;
var location = (LocationDef)locIcon.DataContext;
var maker = new SchematicMaker(location.BackingLocation, 15, 15);
var locDisplay = new LocationDisplay(maker);
//Display the LocationDisplay in its own window
Window extLocationDisplay = new Window(){
Title = location.Description,
Content = locDisplay
};
//For debug only
//Image testImage = new Image();
//testImage.Source = new BitmapImage(maker.IconList[0].Icon);
//Window testImageDisplay = new Window(){
// Title = "Test Image",
// Content = testImage
//};
//testImageDisplay.Show();
locDisplay.IsEnabled = true;
extLocationDisplay.Show();
/*This should display the LocationDisplay control alongside the MapDisplay, but
for some reason the LocationDisplay control is never visible, and the vshost seems
to crash when this is attempted*/
//MainWindow parent = (MainWindow)Window.GetWindow(this);
//parent.AddDock(locDisplay);
}
示例9: TestDataBindingsForObject
/// <summary>
/// hooks the window to the wpf trace
/// </summary>
/// <param name="windowToTest">The window to test</param>
public static void TestDataBindingsForObject(Window windowToTest)
{
EnforceDataBindingTraceListener(windowToTest);
windowToTest.ShowInTaskbar = false;
windowToTest.Show();
windowToTest.Hide();
}
示例10: BasicsWindow
public BasicsWindow()
{
Window basics = new Window
{
Title = "Code Basics",
Height = 400,
Width = 400,
FontSize = 20,
};
StackPanel sp = new StackPanel();
basics.Content = sp;
TextBlock title = new TextBlock
{
Text = "Code Basics",
FontSize = 24,
TextAlignment = TextAlignment.Center,
};
sp.Children.Add(title);
txtName = new TextBox();
sp.Children.Add(txtName);
txtName.Margin = new Thickness(10);
Button btnSend = new Button
{
Content = "Send",
};
sp.Children.Add(btnSend);
btnSend.Margin = new Thickness(10);
btnSend.Click += BtnSend_Click;
basics.Show();
}
示例11: ShowAddImagesToChangelistWindow
public static void ShowAddImagesToChangelistWindow(List<string> files)
{
var window = new Window { Width = 300, Height = 300 };
window.Content = new AddImagesToChangelistWindow(window, files);
window.Show();
}
示例12: TestDateTimeWithTwoDataPoints
public void TestDateTimeWithTwoDataPoints()
{
Chart chart = new Chart();
chart.Width = 500;
chart.Height = 300;
_isLoaded = false;
chart.Loaded += new RoutedEventHandler(chart_Loaded);
Random rand = new Random();
DataSeries dataSeries = new DataSeries();
dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 1, 1), YValue = rand.Next(10, 100) });
dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 1, 2), YValue = rand.Next(10, 100) });
chart.Series.Add(dataSeries);
Window window = new Window();
window.Content = chart;
window.Show();
if (_isLoaded)
{
Assert.AreEqual(2, chart.Series[0].DataPoints.Count);
window.Dispatcher.InvokeShutdown();
window.Close();
}
}
示例13: OnStartup
protected override void OnStartup(StartupEventArgs e)
{
#if DEBUG
Microsoft.Msagl.GraphViewerGdi.DisplayGeometryGraph.SetShowFunctions();
#endif
appWindow = new Window {
Title = "WpfApplicationSample",
Content = mainGrid,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
WindowState = WindowState.Normal
};
SetupToolbar();
graphViewerPanel.ClipToBounds = true;
mainGrid.Children.Add(toolBar);
toolBar.VerticalAlignment=VerticalAlignment.Top;
graphViewer.ObjectUnderMouseCursorChanged += graphViewer_ObjectUnderMouseCursorChanged;
mainGrid.Children.Add(graphViewerPanel);
graphViewer.BindToPanel(graphViewerPanel);
SetStatusBar();
graphViewer.MouseDown += WpfApplicationSample_MouseDown;
appWindow.Loaded += (a,b)=>CreateAndLayoutAndDisplayGraph(null,null);
//CreateAndLayoutAndDisplayGraph(null,null);
//graphViewer.MainPanel.MouseLeftButtonUp += TestApi;
appWindow.Show();
}
示例14: ShouldCreateWindowWrapperAndSetProperties
public void ShouldCreateWindowWrapperAndSetProperties()
{
var a = new WindowDialogActivationBehavior();
var windowWrapper = new WindowWrapper();
var style = new Style();
windowWrapper.Style = style;
Assert.AreEqual(style, windowWrapper.Style);
var content = new Grid();
windowWrapper.Content = content;
Assert.AreEqual(content, windowWrapper.Content);
var owner = new Window();
owner.Show();
windowWrapper.Owner = owner;
Assert.AreEqual(owner, windowWrapper.Owner);
windowWrapper.Show();
windowWrapper.Closed += WindowWrapperOnClosed;
windowWrapper.Close();
windowWrapper.Closed -= WindowWrapperOnClosed;
Assert.IsTrue(this._wasClosed);
}
示例15: LineThicknessDefaultValue
public void LineThicknessDefaultValue()
{
Chart chart = new Chart();
chart.Width = 500;
chart.Height = 300;
Common.CreateAndAddDefaultDataSeries(chart);
ChartGrid grid = new ChartGrid();
Axis axis = new Axis();
axis.Grids.Add(grid);
chart.AxesY.Add(axis);
_isLoaded = false;
chart.Loaded += new RoutedEventHandler(chart_Loaded);
Window window = new Window();
window.Content = chart;
window.Show();
if (_isLoaded)
{
Assert.AreEqual(0.25, grid.LineThickness);
}
window.Dispatcher.InvokeShutdown();
window.Close();
}