本文整理汇总了C#中System.Windows.Window.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# Window.GetType方法的具体用法?C# Window.GetType怎么用?C# Window.GetType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Window
的用法示例。
在下文中一共展示了Window.GetType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PickleWindow
private static void PickleWindow(Window window, Dictionary<string, object> data)
{
foreach (var propName in new[] { "Top", "Left", "Width", "Height", "WindowState" })
{
data[propName] = window.GetType().GetProperty(propName).GetGetMethod().Invoke(window, new object[] { });
}
}
示例2: Load
public NativeStructs.WINDOWPLACEMENT? Load(Window rpWindow)
{
var rPlacement = Preference.Instance.Windows.LoadPlacement(rpWindow.GetType().FullName);
if (rPlacement == null)
return null;
var rResult = new NativeStructs.WINDOWPLACEMENT()
{
rcNormalPosition = new NativeStructs.RECT(rPlacement.Left, rPlacement.Top, rPlacement.Left+rPlacement.Width,rPlacement.Top+rPlacement.Height),
};
switch (rPlacement.State)
{
case WindowState.Normal:
rResult.showCmd = NativeConstants.ShowCommand.SW_SHOWNORMAL;
break;
case WindowState.Minimized:
rResult.showCmd = NativeConstants.ShowCommand.SW_SHOWMINIMIZED;
break;
case WindowState.Maximized:
rResult.showCmd = NativeConstants.ShowCommand.SW_SHOWMAXIMIZED;
break;
}
return rResult;
}
示例3: WindowSettings
public WindowSettings(Window window, bool isSavingPosition, bool isSavingSize, string keyExtensionValue)
{
_window = window;
_isSavingPosition = isSavingPosition;
_isSavingSize = isSavingSize;
// Use the class-name of the given Window, minus the namespace prefix, as the instance-key.
// This is so that we have a distinct setting for different windows.
string sWindowType = window.GetType().ToString();
int iPos = sWindowType.LastIndexOf('.');
string sKey;
if (iPos > 0)
{
sKey = sWindowType.Substring(iPos + 1);
}
else
{
sKey = sWindowType;
}
if (keyExtensionValue == null)
{
_sInstanceSettingsKey = sKey;
}
else
{
_sInstanceSettingsKey = sKey + keyExtensionValue;
}
}
示例4: MoveCommandBindingProxy
public MoveCommandBindingProxy(Window window)
{
this.window = window;
MoveCommand = new RoutedCommand("Move", window.GetType());
_CommandBinding = new CommandBinding(MoveCommand,
CommandExecuted,
CommandCanExecute);
}
示例5: InitWindow
private static void InitWindow(Window window, Dictionary<string, object> data)
{
foreach (var property in data)
{
window.GetType().GetProperty(property.Key).GetSetMethod().Invoke(window, new[] { property.Value });
}
if (!Double.IsNaN(window.Top))
window.WindowStartupLocation = WindowStartupLocation.Manual;
}
示例6: WindowTreeManager
public WindowTreeManager(Window window, WindowTreeManager parent, bool autoClosing = true)
{
Parent = parent;
_window = window;
_autoClosing = autoClosing;
var windowName = window.GetType().Name;
_windowBoundsPersistor = new Settings.WindowBoundsPersistor(window, windowName);
_windowBoundsPersistor.Load();
window.Closing += SelfClosing;
}
示例7: Save
public void Save(Window rpWindow, NativeStructs.WINDOWPLACEMENT rpData)
{
var rPreference = new WindowPreference()
{
Name = rpWindow.GetType().FullName,
Left = rpData.rcNormalPosition.Left,
Top = rpData.rcNormalPosition.Top,
Width = rpData.rcNormalPosition.Right - rpData.rcNormalPosition.Left,
Height = rpData.rcNormalPosition.Bottom - rpData.rcNormalPosition.Top,
State = rpWindow.WindowState,
};
Preference.Current.Windows.Landscape[rPreference.Name] = rPreference;
}
示例8: Save
public void Save(Window rpWindow, NativeStructs.WINDOWPLACEMENT rpData)
{
var rPreference = new WindowPreference()
{
Name = rpWindow.GetType().FullName,
Left = rpData.rcNormalPosition.Left,
Top = rpData.rcNormalPosition.Top,
Width = rpData.rcNormalPosition.Right - rpData.rcNormalPosition.Left,
Height = rpData.rcNormalPosition.Bottom - rpData.rcNormalPosition.Top,
State = rpWindow.WindowState,
};
Preference.Instance.Windows.SavePlacement(rPreference);
}
示例9: OuvrirEcran
public static void OuvrirEcran(Window parent,string nom,bool modal,bool fermeParent)
{
Type type = parent.GetType();
Assembly assembly = type.Assembly;
Window win = (Window)assembly.CreateInstance(type.Namespace + "." + nom);
if (fermeParent)
parent.Close();
if (modal)
win.ShowDialog();
else
win.Show();
}
示例10: ManageWindowSettings
public void ManageWindowSettings(Window window)
{
string typeName = window.GetType().Name;
window.Initialized += (sender, e) =>
{
WindowSettings settings = this.Settings.WindowsSettings.Where(w => w.Name == typeName).FirstOrDefault();
if (settings != null)
{
window.Left = settings.X;
window.Top = settings.Y;
window.Width = settings.Width;
window.Height = settings.Height;
window.WindowState = settings.State;
window.WindowStartupLocation = WindowStartupLocation.Manual;
}
};
window.Closing += WindowClosing;
}
示例11: WindowApplicationSettings
public WindowApplicationSettings(Window window)
: base(window.GetType().FullName)
{
}
示例12: ShowBulkFileEditDialogAsync
// Various dialogs perform a bulk edit, after which the current file's data needs to be refreshed.
private async Task ShowBulkFileEditDialogAsync(Window dialog)
{
Debug.Assert((dialog.GetType() == typeof(PopulateFieldWithMetadata)) ||
(dialog.GetType() == typeof(DateTimeFixedCorrection)) ||
(dialog.GetType() == typeof(DateTimeLinearCorrection)) ||
(dialog.GetType() == typeof(DateDaylightSavingsTimeCorrection)) ||
(dialog.GetType() == typeof(DateCorrectAmbiguous)) ||
(dialog.GetType() == typeof(DateTimeSetTimeZone)) ||
(dialog.GetType() == typeof(DateTimeRereadFromFiles)),
String.Format("Unexpected dialog {0}.", dialog.GetType()));
bool? result = dialog.ShowDialog();
if (result == true)
{
// load the changes made through the current dialog
long currentFileID = this.dataHandler.ImageCache.Current.ID;
this.dataHandler.FileDatabase.SelectFiles(this.dataHandler.FileDatabase.ImageSet.FileSelection);
// show updated data for file
// Delete isn't considered a bulk edit so none of the bulk edit dialogs can result in a change in the image which needs to be displayed.
// Hence the image cache doesn't need to be invalidated. However, SelectFiles() may mean the currently displayed file is no longer selected.
await this.ShowFileAsync(this.dataHandler.FileDatabase.GetFileOrNextFileIndex(currentFileID));
}
}
示例13: RunInternal
internal int RunInternal(Window window)
{
VerifyAccess();
#if DEBUG_CLR_MEM
if (CLRProfilerControl.ProcessIsUnderCLRProfiler &&
(CLRProfilerControl.CLRLoggingLevel >= CLRProfilerControl.CLRLogState.Performance))
{
CLRProfilerControl.CLRLogWriteLine("Application_Run");
}
#endif // DEBUG_CLR_MEM
EventTrace.EasyTraceEvent(EventTrace.Keyword.KeywordGeneral | EventTrace.Keyword.KeywordPerf, EventTrace.Event.WClientAppRun);
//
// NOTE: hamidm 08/06/04
// PS Windows OS Bug # 901085 (Can't create app and do run/shutdown followed
// by run/shutdown)
//
// Devs could write the following code
//
// Application app = new Application();
// app.Run();
// app.Run();
//
// In this case, we should throw an exception when Run is called for the second time.
// When app is shutdown, _appIsShutdown is set to true. If it is true here, then we
// throw an exception
if (_appIsShutdown == true)
{
throw new InvalidOperationException(SR.Get(SRID.CannotCallRunMultipleTimes, this.GetType().FullName));
}
if (window != null)
{
if (window.CheckAccess() == false)
{
throw new ArgumentException(SR.Get(SRID.WindowPassedShouldBeOnApplicationThread, window.GetType().FullName, this.GetType().FullName));
}
if (WindowsInternal.HasItem(window) == false)
{
WindowsInternal.Add(window);
}
if (MainWindow == null)
{
MainWindow = window;
}
if (window.Visibility != Visibility.Visible)
{
Dispatcher.BeginInvoke(
DispatcherPriority.Send,
(DispatcherOperationCallback) delegate(object obj)
{
Window win = obj as Window;
win.Show();
return null;
},
window);
}
}
EnsureHwndSource();
//Even if the subclass app cancels the event we still want to create and run the dispatcher
//so that when the app explicitly calls Shutdown, we have a dispatcher to service the posted
//Shutdown DispatcherOperationCallback
// Invoke the Dispatcher synchronously if we are not in the browser
if (!BrowserInteropHelper.IsBrowserHosted)
{
RunDispatcher(null);
}
return _exitCode;
}
示例14: SavePreferences
public static void SavePreferences(Window win)
{
WindowPreference wp = new WindowPreference();
wp.Width = win.Width;
wp.Height = win.Height;
wp.Top = win.Top;
wp.Left = win.Left;
preferences[win.GetType().Name] = wp;
}
示例15: addActiveWindow
/// <summary>
/// Sets/gets the active window for the tray manager.
/// This will be expanded to multiple windows in the future
/// </summary>
public void addActiveWindow(Window value)
{
if (!TrayFlags.containsType(value.GetType())) return;
activeWindow.Add(value);
}