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


C# Window.Hide方法代码示例

本文整理汇总了C#中System.Windows.Window.Hide方法的典型用法代码示例。如果您正苦于以下问题:C# Window.Hide方法的具体用法?C# Window.Hide怎么用?C# Window.Hide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Window的用法示例。


在下文中一共展示了Window.Hide方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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();
 }
开发者ID:XiBeichuan,项目名称:hydronumerics,代码行数:11,代码来源:AvalonDataBindingTraceTester.cs

示例2: HideForeground

 public static void HideForeground(Window mainWindow)
 {
     mainWindow.Show();
     mainWindow.WindowState = WindowState.Minimized;
     mainWindow.ShowInTaskbar = false;
     mainWindow.Hide();
 }
开发者ID:bhattvishal,项目名称:CalendarSyncplus,代码行数:7,代码来源:Utilities.cs

示例3: TrayIcon

        public TrayIcon(Window window)
        {
            _icon = new NotifyIcon
            {
                Visible = true,
                Icon = Icon.FromHandle(Resources.ce16.GetHicon()),
                ContextMenu = new ContextMenu(new[]
                {
                    new MenuItem("&Show", (sender, args) => window.Show()),
                    new MenuItem("&Hide", (sender, args) => window.Hide()),
                    new MenuItem("Stay on &Top", (sender, args) =>
                    {
                        window.Topmost = !window.Topmost;
                        ((MenuItem) sender).Checked = window.Topmost;
                    }),
                    new MenuItem("-"),
                    new MenuItem("Settings", (sender, args) =>
                    {
                        var dlg = new SettingsWindow { Owner = window };
                        dlg.ShowDialog();
                    }),
                    new MenuItem("-"),
                    new MenuItem("&Exit", (sender, args) => window.Close())
                })
            };

            _icon.ContextMenu.MenuItems[2].Checked = ConfigManager.Config.StayOnTop;
        }
开发者ID:misaxi,项目名称:elmah-tracker,代码行数:28,代码来源:TrayIcon.cs

示例4: FadeOutHideWindow

 public static void FadeOutHideWindow(Window window, TimeSpan duration)
 {
     window.Opacity = 1D;
     var board = CreateFadeOutStoryboard(duration);
     board.Completed += (s, e) =>
     {
         window.Hide();
     };
     board.Begin(window);
 }
开发者ID:TehporP,项目名称:TerminologyLauncher,代码行数:10,代码来源:Fade.cs

示例5: ActivateMainWindow

        static void ActivateMainWindow(bool activate, Window mainWindow) {
            if (!activate) {
                mainWindow.Hide();
                return;
            }

            SetToNormalIfMinimized(mainWindow);

            TryActivateMainWindow(mainWindow);
        }
开发者ID:MaHuJa,项目名称:withSIX.Desktop,代码行数:10,代码来源:DialogHelper.cs

示例6: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            var vm = this.DataContext as MainWindowViewModel;
            vm.ConfirmationHandler = () =>
                {
                    // Note the use of the TaskCompletionSource here
                    var tcs = new TaskCompletionSource<bool>();

                    // Dynamically build confirmation dialog (just for demo purposes; you
                    // could use XAML, too).
                    #region Confirmation dialog
                    var dialog = new Window() { SizeToContent = SizeToContent.WidthAndHeight };
                    var stackPanel = new StackPanel() { Margin = new Thickness(10.0) };
                    dialog.Content = stackPanel;

                    stackPanel.Children.Add(new TextBlock() { Text = "Are you sure?" });
                    Button yesButton, noButton;
                    stackPanel.Children.Add(yesButton = new Button() {
                        Content = "Yes"
                    });
                    yesButton.Click += (_, __) => {
                        tcs.SetResult(true);
                        dialog.Hide();
                    };
                    stackPanel.Children.Add(noButton = new Button()
                    {
                        Content = "No"
                    });
                    noButton.Click += (_, __) =>
                    {
                        tcs.SetResult(false);
                        dialog.Hide();
                    };
                    #endregion

                    dialog.Show();

                    return tcs.Task;
                };
        }
开发者ID:mkandroid15,项目名称:Samples,代码行数:42,代码来源:MainWindow.xaml.cs

示例7: BubblesManager

        static BubblesManager()
        {
            _views = new List<Window>();

            OwnerWindow = new Window();
            OwnerWindow.WindowStyle = WindowStyle.ToolWindow;
            OwnerWindow.Left = 10000;
            OwnerWindow.Top = 1000;
            OwnerWindow.Width = 1;
            OwnerWindow.Show();
            OwnerWindow.Hide();
        }
开发者ID:tbener,项目名称:DiGit,代码行数:12,代码来源:BubblesManager.cs

示例8: Show

        public void Show(string account, Uri authenticationUri, Uri redirectUri)
        {
            if (window == null) {
                waitHandle = new EventWaitHandle(false, EventResetMode.AutoReset);
                var uiThread = new Thread(() => {
                    window = new Window() { Title = account };
                    window.Closing += (s, e) => {
                        window.Hide();
                        waitHandle.Set();
                        e.Cancel = true;
                    };

                    browser = new WebBrowser();
                    browser.Loaded += (s, e) => {
                        browser.Navigate(authenticationUri);
                    };
                    browser.Navigating += (s, e) => {
                        if (redirectUri.IsBaseOf(e.Uri) && redirectUri.AbsolutePath == e.Uri.AbsolutePath) {
                            var parameters = new NameValueCollection();
                            foreach (var parameter in e.Uri.Query.TrimStart('?').Split('&')) {
                                var nameValue = parameter.Split('=');
                                parameters.Add(nameValue[0], nameValue[1]);
                            }
                            var handler = Authenticated;
                            handler?.Invoke(this, new AuthenticatedEventArgs(parameters));
                            e.Cancel = true;
                        }
                    };
                    browser.Navigated += (s, e) => {
                        if (authenticationUri.IsBaseOf(e.Uri))
                            SetForegroundWindow(new WindowInteropHelper(window).Handle);
                    };

                    window.Content = browser;
                    window.Show();

                    System.Windows.Threading.Dispatcher.Run();
                });
                uiThread.SetApartmentState(ApartmentState.STA);
                uiThread.Start();
            } else {
                window.Dispatcher.Invoke(() => {
                    browser.Source = authenticationUri;
                    window.Title = account;
                    window.Show();
                });
            }

            waitHandle.WaitOne();
        }
开发者ID:viciousviper,项目名称:PowerShellCloudProvider,代码行数:50,代码来源:BrowserWindow.cs

示例9: TrayMainWindows

        public TrayMainWindows(Window window)
        {
            _window = window;
            try
            {
                _notifyIcon = new System.Windows.Forms.NotifyIcon();
                _notifyIcon.Text = _window.Title;
                _notifyIcon.Icon = new System.Drawing.Icon("TodoTouch_512.ico");
                _notifyIcon.Visible = true;
                _notifyIcon.DoubleClick += DoubleClick;

                _window.Closed += (sender, args) => { this.Dispose(); };
                _window.StateChanged += (sender, args) => { if (_window.WindowState == WindowState.Minimized) _window.Hide(); };
            }
            catch (Exception ex)
            {
                var msg = "Error create tray icon";
                Log.Error(msg, ex);
            }
        }
开发者ID:rfi99,项目名称:todotxt.net,代码行数:20,代码来源:TrayMainWindows.cs

示例10: MinimizeToSystemTray

        /// <summary>
        /// This is a helper class to rapidly add a minimize-to-tray functionality in WPF Win32 apps.
        /// </summary>
        /// <param name="Window">A reference to the window to control.</param>
        /// <param name="Icon">A string referencing the .ICO path. The Icon *must* be set for this class to work properly.</param>
        /// <param name="StartMinimized">Should the window be minimized to the tray immediately?</param>
        /// <param name="RequireDoubleClick">Should the tray icon require a double-click, or will a single-click suffice?</param>
        public MinimizeToSystemTray(Window Window, Icon Icon, bool StartMinimized = false, bool RequireDoubleClick = false)
        {
            if (Icon == null)
                throw new Exception("Icon must be set for this class to function properly.");
            if (Window == null)
                throw new Exception("Window must not be null.");
            this.window = Window;
            Window.Closing += window_Closing;
            Window.StateChanged += window_StateChanged;
            ni = new NotifyIcon();
            ni.Icon = Icon;
            ni.Visible = true;
            if (RequireDoubleClick)
                ni.DoubleClick += IconClick;
            else
                ni.Click += IconClick;

            if(StartMinimized)
            {
                Window.WindowState = System.Windows.WindowState.Minimized;
                Window.Hide();
            }
        }
开发者ID:treehopper-electronics,项目名称:treehopper-sdk,代码行数:30,代码来源:SystemTrayWindow.cs

示例11: TrayMainWindows

        public TrayMainWindows(Window window)
        {
            _window = window;
            try
            {
                _notifyIcon = new System.Windows.Forms.NotifyIcon();
                _notifyIcon.Text = _window.Title;
                Stream iconStream = System.Windows.Application.GetResourceStream(new Uri("pack://application:,,,/TodoTouch_512.ico")).Stream;
                _notifyIcon.Icon = new System.Drawing.Icon(iconStream);
                _notifyIcon.Visible = true;
                _notifyIcon.DoubleClick += DoubleClick;

                _notifyIcon.ContextMenu = new ContextMenu();
                _notifyIcon.ContextMenu.MenuItems.Add("E&xit", new EventHandler(ExitClick));

                _window.Closed += (sender, args) => { this.Dispose(); };
                _window.StateChanged += (sender, args) => { if (_window.WindowState == WindowState.Minimized) _window.Hide(); };
            }
            catch (Exception ex)
            {
                var msg = "Error create tray icon";
                Log.Error(msg, ex);
            }
        }
开发者ID:aviera,项目名称:todotxt.net,代码行数:24,代码来源:TrayMainWindows.cs

示例12: TouchControl

        /// <summary>
        /// Creates a touch control
        /// </summary>
        /// <param name="entryCommand"></param>
        /// <param name="parentWindow"></param>
        public TouchControl(TouchBranchCommand entryCommand, Window parentWindow)
        {
            InitializeComponent();
            initializeBrushes();

            var segmentAmount = entryCommand.Commands.Count();
            int index = 0;
            foreach (var command in entryCommand.Commands)
            {
                // Slice shape:
                var segment = TouchControlShapeFactory.GetSegment(segmentAmount, index);
                var path = new Path()
                {
                    Data = segment,
                };
                touchCanvas.Children.Add(path);

                // Invisible border that holds and centers the text label:
                var border = new Border()
                {
                    Width = TEXT_AVAILABLE_WIDTH,
                    Height = TEXT_AVAILABLE_HEIGHT,
                    IsHitTestVisible = false,
                };
                var textCenter = TouchControlShapeFactory.GetTextPosition(segmentAmount, index);
                Canvas.SetLeft(border, textCenter.X - TEXT_AVAILABLE_WIDTH / 2);
                Canvas.SetRight(border, textCenter.X + TEXT_AVAILABLE_WIDTH / 2);
                Canvas.SetTop(border, textCenter.Y - TEXT_AVAILABLE_HEIGHT / 2);
                Canvas.SetBottom(border, textCenter.Y + TEXT_AVAILABLE_HEIGHT / 2);

                // The text label, centered inside the invisible border
                var text = new TextBlock()
                {
                    Text = command.DisplayName,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment = VerticalAlignment.Center,
                };
                border.Child = text;
                touchCanvas.Children.Add(border);

                // Give action to the slice. Looking forward to using extended `is` expression in pattern matching (https://github.com/dotnet/roslyn/issues/206)
                var vsCommand = command as TouchVSCommand;
                var branchCommand = command as TouchBranchCommand;
                if (vsCommand != null)
                {
                    path.TouchUp += (s, e) =>
                    {
                        e.Handled = true;
                        VisualStudioModule.ExecuteCommand(vsCommand.VsCommandName, vsCommand.VsCommandParams);
                        parentWindow.Hide();
                    };
                }
                else if (branchCommand != null)
                {
                    path.TouchUp += (s, e) =>
                    {
                        e.Handled = true;
                        parentWindow.Hide();
                        Show(branchCommand, e);
                    };
                }

                index++;
            }
        }
开发者ID:WELL-E,项目名称:TouchVS,代码行数:70,代码来源:TouchControl.xaml.cs

示例13: BuildSearchCustomerWindow

        private void BuildSearchCustomerWindow()
        {
            if (customerPicker == null)
            {
                customerPicker = new searchCustomer(searchCustomerTypeEnum.Customer);
                customerPicker_VM = customerPicker.DataContext as searchCustomer_ModelView;
            }
            customerPickerWindow = new Window()
            {
                Title = "Ügyfél választó",
                Content = customerPicker,
                SizeToContent = SizeToContent.WidthAndHeight
            };

            customerPicker_VM.CustomerSelected += (s, a) =>
            {
                viewModel.selectedCustomer = (CustomerBaseRepresentation)s;
                customerPickerWindow.Hide();
            };
        }
开发者ID:sikisuti,项目名称:gyorok,代码行数:20,代码来源:CustomerSelector.xaml.cs

示例14: BuildSearchContactWindow

        private void BuildSearchContactWindow()
        {
            contactPicker = new searchCustomer(searchCustomerTypeEnum.Contact);
            contactPicker_VM = contactPicker.DataContext as searchCustomer_ModelView;
            contactPickerWindow = new Window()
            {
                Title = "Kapcsolattartó választó",
                Content = contactPicker,
                SizeToContent = SizeToContent.WidthAndHeight
            };

            contactPicker_VM.CustomerSelected += (s, a) =>
            {
                DataProxy.Instance.AddContact(viewModel.selectedCustomer, (PersonRepresentation)s);
                ((FirmRepresentation)viewModel.selectedCustomer).contacts.Add((CustomerBaseRepresentation)s);
                contactPickerWindow.Hide();
            };
        }
开发者ID:sikisuti,项目名称:gyorok,代码行数:18,代码来源:CustomerSelector.xaml.cs

示例15: BuildCityChooserWindow

        private void BuildCityChooserWindow()
        {
            cityPickerWindow = new SearchCity();
            cityPicker_VM = cityPickerWindow.DataContext as SearchCity_ViewModel;

            cityPicker_VM.citySelected += (s, a) =>
            {
                viewModel.selectedCustomer.city = (CityRepresentation)s;
                cityPickerWindow.Hide();
            };
        }
开发者ID:sikisuti,项目名称:gyorok,代码行数:11,代码来源:CustomerSelector.xaml.cs


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