当前位置: 首页>>代码示例>>C#>>正文


C# Window.GetType方法代码示例

本文整理汇总了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[] { });
     }
 }
开发者ID:BietteMaxime,项目名称:OG-DotNet,代码行数:7,代码来源:WindowLocationPersister.cs

示例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;
        }
开发者ID:amatukaze,项目名称:IntelligentNavalGun,代码行数:28,代码来源:WindowPlacementPreference.cs

示例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;
     }
 }
开发者ID:JamesWHurst,项目名称:MonsoonWpfSampleApplic,代码行数:27,代码来源:WindowSettings.cs

示例4: MoveCommandBindingProxy

        public MoveCommandBindingProxy(Window window)
        {
            this.window = window;
            MoveCommand = new RoutedCommand("Move", window.GetType());

            _CommandBinding = new CommandBinding(MoveCommand,
                CommandExecuted,
                CommandCanExecute);
        }
开发者ID:radiantwf,项目名称:Face-PhotoAlbum,代码行数:9,代码来源:MoveCommandBindingProxy.cs

示例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;
        }
开发者ID:BietteMaxime,项目名称:OG-DotNet,代码行数:10,代码来源:WindowLocationPersister.cs

示例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;
        }
开发者ID:pointgaming,项目名称:point-gaming-desktop,代码行数:12,代码来源:WindowTreeManager.cs

示例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;
        }
开发者ID:amatukaze,项目名称:IntelligentNavalGun-Fx4,代码行数:14,代码来源:WindowPlacementPreference.cs

示例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);
        }
开发者ID:amatukaze,项目名称:IntelligentNavalGun,代码行数:15,代码来源:WindowPlacementPreference.cs

示例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();

        }
开发者ID:Corantin,项目名称:Cegep,代码行数:15,代码来源:OutilGeneral.cs

示例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;
        }
开发者ID:karamanolev,项目名称:MusicDatabase,代码行数:20,代码来源:SettingsManager.cs

示例11: WindowApplicationSettings

 public WindowApplicationSettings(Window window)
     : base(window.GetType().FullName)
 {
 }
开发者ID:gjhwssg,项目名称:MahApps.Metro,代码行数:4,代码来源:WindowSettings.cs

示例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));
            }
        }
开发者ID:CascadesCarnivoreProject,项目名称:Timelapse,代码行数:25,代码来源:CarnassialWindow.xaml.cs

示例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;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:78,代码来源:Application.cs

示例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;
 }
开发者ID:nabilzaini,项目名称:Quiddich,代码行数:9,代码来源:Pilotage.cs

示例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);
 }
开发者ID:eisenbe7,项目名称:KailleraNet,代码行数:9,代码来源:KailleraTrayManager.cs


注:本文中的System.Windows.Window.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。