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


C# Window.Close方法代码示例

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


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

示例1: ShowInAppPopup

 public void ShowInAppPopup(Window showOnClose = null)
 {
     if (showOnClose != null)
     {
         showOnClose.Close();
     }
     InAppPopup.Show(showOnClose);
 }
开发者ID:GreatVV,项目名称:loadzzer,代码行数:8,代码来源:UI.cs

示例2: GetEmptyButtonSize

		public static double GetEmptyButtonSize ()
		{
			if (empty_button_size == -1) {
				Window window = new Window ();
				Canvas canvas = new Canvas ();
				window.Content = canvas;
				Button button = new Button ();
				canvas.Children.Add (button);
				window.Show ();
				empty_button_size = button.DesiredSize.Width;
				window.Close ();
			}
			return empty_button_size;
		}
开发者ID:JianwenSun,项目名称:mono-soc-2007,代码行数:14,代码来源:Utility.cs

示例3: ComboBox

        public ComboBox ( ) {
			this.Background = Brushes.Red;

			this.Padding = new Thickness ();
			this.Margin = new Thickness ();

			window = new Window(this);
			cmdItem = new Button ();
			lbItems = new ListBox ();

			var itemsBinding = new Binding ();
			itemsBinding.Mode = BindingMode.OneWay;
			itemsBinding.Source = this;
			itemsBinding.Path = new PropertyPath ("Items");

			lbItems.Margin = new Thickness (2);
			lbItems.BorderThickness = new Thickness (0);
			lbItems.ItemContainerStyle = (Style)this.FindResource ("ComboBoxItemStyle");
			lbItems.SetBinding (ListBox.ItemsProperty, itemsBinding);
			lbItems.SelectionChanged += (s,e) => {
				window.DialogResult = this.SelectedItem != null;
				window.Close ();
				this.IsDropDownOpen = false;
			};
				
			window.Content = lbItems;

			var selectedItemBinding = new Binding ("SelectedItem");
			selectedItemBinding.Mode = BindingMode.TwoWay;
			selectedItemBinding.Source = lbItems;

			cmdItem.SetBinding (
				Button.ContentProperty, 
				selectedItemBinding);

			this.SetBinding (
				ListBox.SelectedItemProperty, 
				selectedItemBinding);
        }
开发者ID:bbqchickenrobot,项目名称:WPFLight,代码行数:39,代码来源:ComboBox.cs

示例4: CloseDocumentWindow

        /// <summary>
        /// Closes a window if it is saved, not active, and not pinned
        /// </summary>
        /// <param name="window">The document window</param>
        /// <returns>True if window was closed</returns>
        private bool CloseDocumentWindow(Window window)
        {
            DateTime lastWindowAction;

            try
            {
                if (window != VisualStudio.ActiveWindow
                    && (window.Document == null
                        || (window.Document.Saved && !Provider.IsWindowPinned(window.Document.FullName))))
                {
                    documentLastSeen.TryRemove(window, out lastWindowAction);

                    window.Close();
                    return true;
                }
            }
            catch (Exception)
            {
                documentLastSeen.TryRemove(window, out lastWindowAction);
            }

            return false;
        }
开发者ID:modulexcite,项目名称:TidyTabs-VisualStudio,代码行数:28,代码来源:TidyTabsPackage.cs

示例5: ButtonsTab

        private static TabItem ButtonsTab()
        {
            Button defaultButton;

            var showDialog = ReactiveCommand.Create();
            Button showDialogButton;

            var result = new TabItem
            {
                Header = "Buttons",
                Content = new StackPanel
                {
                    Orientation = Orientation.Vertical,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment = VerticalAlignment.Center,
                    Gap = 8,
                    MinWidth = 120,
                    Children = new Controls
                    {
                        (showDialogButton = new Button
                        {
                            Content = "Button",
                            Command = showDialog,
                            [ToolTip.TipProperty] = "Hello World!",
                        }),
                        new Button
                        {
                            Content = "Button",
                            Background = new SolidColorBrush(0xcc119eda),
                            [ToolTip.TipProperty] = "Goodbye Cruel World!",
                        },
                        (defaultButton = new Button
                        {
                            Content = "Default",
                            IsDefault = true,
                        }),
                        new Button
                        {
                            Content = "Disabled",
                            IsEnabled = false,
                        },
                        new Button
                        {
                            Content = "Disabled",
                            IsEnabled = false,
                            Background = new SolidColorBrush(0xcc119eda),
                        },
                        new ToggleButton
                        {
                            Content = "Toggle",
                        },
                        new ToggleButton
                        {
                            Content = "Disabled",
                            IsEnabled = false,
                        },
                        new CheckBox
                        {
                            Content = "Checkbox",
                        },
                        new RadioButton
                        {
                            Content = "RadioButton 1",
                            IsChecked = true,
                        },
                        new RadioButton
                        {
                            Content = "RadioButton 2",
                        },
                    }
                },
            };

            defaultButton.Click += (s, e) =>
            {
                defaultButton.Content = ((string)defaultButton.Content == "Default") ? "Clicked" : "Default";
            };

            showDialog.Subscribe(async _ =>
            {
                var close = ReactiveCommand.Create();

                var dialog = new Window
                {
                    Content = new StackPanel
                    {
                        Width = 200,
                        Height = 200,
                        Children = new Controls
                        {
                            new Button { Content = "Yes", Command = close, CommandParameter = "Yes" },
                            new Button { Content = "No", Command = close, CommandParameter = "No" },
                        }
                    }
                };

                close.Subscribe(x => dialog.Close(x));

                showDialogButton.Content = await dialog.ShowDialog<string>();
            });
//.........这里部分代码省略.........
开发者ID:healtech,项目名称:Perspex,代码行数:101,代码来源:Program.cs

示例6: WriteWebDataSourceHTML

        private void WriteWebDataSourceHTML(ref Window FDesignWindow, ClientParam cParam, ProjectItem projItem)
        {
            String FileName = FDesignWindow.Document.FullName;
            FDesignWindow.Close(vsSaveChanges.vsSaveChangesYes);

            String UpdateHTML = "";

            UpdateHTML = String.Format("<rsweb:reportviewer id=\"ReportViewer1\" runat=\"server\" width=\"100%\" Font-Names=\"Verdana\""
                + " Font-Size=\"8pt\" Height=\"400px\">"
                + "<LocalReport ReportPath=\"\">"
                + "<DataSources>"
                + "<rsweb:ReportDataSource DataSourceId=\"Master\" Name={0} />"
                + "</DataSources>"
                + "</LocalReport>"
                + "</rsweb:reportviewer>",
                "\"NewDataSet_" + cParam.ProviderName.Substring(cParam.ProviderName.IndexOf('.') + 1) + "\"");

            //Start Update Process
            System.IO.StreamReader SR = new System.IO.StreamReader(FileName, Encoding.Default);
            String Context = SR.ReadToEnd();
            SR.Close();

            //Update HTML
            int x, y;
            string temp = "";
            x = Context.IndexOf("<rsweb");
            y = Context.IndexOf("</rsweb");
            temp = Context.Substring(x, (y - x) + 21);
            Context = Context.Replace(temp, UpdateHTML);

            //Page Title
            Context = Context.Replace("<title>Untitled Page</title>", "<title>" + cParam.FormTitle + "</title>");

            System.IO.FileStream Filefs = new System.IO.FileStream(FileName, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite);
            System.IO.StreamWriter SW = new System.IO.StreamWriter(Filefs, Encoding.UTF8);
            SW.Write(Context);
            SW.Close();
            Filefs.Close();

            FDesignWindow = projItem.Open("{7651A702-06E5-11D1-8EBD-00A0C90F26EA}");
            FDesignWindow.Activate();
        }
开发者ID:san90279,项目名称:UK_OAS,代码行数:42,代码来源:frmEEPReport.cs

示例7: CloseWindow

		void CloseWindow(ref Window win)
		{
			try
			{
				if (win != null)
				{
					win.Close(vsSaveChanges.vsSaveChangesNo);
					win = null;
				}
			}
			catch (Exception oEx)
			{
				LoggingHelper.HandleException(oEx);
			}
		}
开发者ID:erdincay,项目名称:db4o,代码行数:15,代码来源:Connect.cs

示例8: InitSaveBeforeQuitWindow

        protected void InitSaveBeforeQuitWindow()
        {
            SaveBeforeQuitWindow = new Window(UI.GetInterface(Name), null, "Save?", TextOrientation.Center, Vector2.Zero, new Vector2(642, 96), true, true, false, true);
            SaveBeforeQuitWindow.AddElement(new Button(UI.GetInterface(Name), "Yes", 24, TextOrientation.Center, new Vector2(10, 10), new Vector2(200, 50), origin, hover, pressed, ButtonListSide.LeftRight, true, true, true));
            SaveBeforeQuitWindow.AddElement(new Button(UI.GetInterface(Name), "No", 24, TextOrientation.Center, new Vector2(220, 10), new Vector2(200, 50), origin, hover, pressed, ButtonListSide.LeftRight, true, true, true));
            SaveBeforeQuitWindow.AddElement(new Button(UI.GetInterface(Name), "Cancel", 24, TextOrientation.Center, new Vector2(430, 10), new Vector2(200, 50), origin, hover, pressed, ButtonListSide.LeftRight, true, true, true));

            SaveBeforeQuitWindow[0].Clicked += (sender) =>
            {
                if (GameStateManager.PreviousState == GameStateManager.Playing)
                    Map.SavePlayable();
                else
                    Map.Save();
                SaveBeforeQuitWindow.Close();
                GameStateManager.TransitionState(GameStateManager.MainMenu);
            };

            SaveBeforeQuitWindow[1].Clicked += (sender) =>
            {
                SaveBeforeQuitWindow.Close();
                GameStateManager.TransitionState(GameStateManager.MainMenu);
            };

            SaveBeforeQuitWindow[2].Clicked += (sender) =>
            {
                SaveBeforeQuitWindow.Close();
            };
        }
开发者ID:GaiiusBaltar,项目名称:XNA-Top-Down-Map-Editor,代码行数:28,代码来源:PauseMenuView.cs

示例9: WriteWebFormTitle

        public void WriteWebFormTitle(Window FDesignWindow, ClientParam cParam, ProjectItem projItem)
        {
            String FileName = FDesignWindow.Document.FullName;
            FDesignWindow.Close(vsSaveChanges.vsSaveChangesYes);

            //Start Update Process
            System.IO.StreamReader SR = new System.IO.StreamReader(FileName, Encoding.Default);
            String Context = SR.ReadToEnd();
            SR.Close();

            //Page Title
            Context = Context.Replace("<title>Untitled Page</title>", "<title>" + cParam.FormTitle + "</title>");

            System.IO.FileStream Filefs = new System.IO.FileStream(FileName, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite);
            System.IO.StreamWriter SW = new System.IO.StreamWriter(Filefs, Encoding.UTF8);
            SW.Write(Context);
            SW.Close();
            Filefs.Close();

            FDesignWindow = projItem.Open("{7651A702-06E5-11D1-8EBD-00A0C90F26EA}");
            FDesignWindow.Activate();
        }
开发者ID:san90279,项目名称:UK_OAS,代码行数:22,代码来源:fmEasilyReport.cs

示例10: GenReportViewProperty

        internal static void GenReportViewProperty(Window FDesignWindow, ProjectItem reportDir, bool isMasterDetails, string RootName, string RptName)
        {
            String FileName = FDesignWindow.Document.FullName;
            string FormName = FileName.Substring(FileName.LastIndexOf("\\") + 1, FileName.Length - FileName.LastIndexOf("\\") - 1);
            FDesignWindow.Close(vsSaveChanges.vsSaveChangesYes);
               //Start Update Process
            System.IO.StreamReader SR = new System.IO.StreamReader(FileName, Encoding.Default);
            String Context = SR.ReadToEnd();
            SR.Close();

            //Gen Report Property
            if (isMasterDetails)
            {
                Context = Context.Replace("<LocalReport ReportPath=\"\">", "<LocalReport ReportPath=\"" + RootName + "\\" + RptName + ".rdlc\" OnSubreportProcessing=\"SubreportProcessing\">");
            }
            else
            {
                Context = Context.Replace("<LocalReport ReportPath=\"\">", "<LocalReport ReportPath=\"" + RootName + "\\" + RptName + ".rdlc\">");
            }

            System.IO.FileStream Filefs = new System.IO.FileStream(FileName, System.IO.FileMode.Create, System.IO.FileAccess.ReadWrite);
            System.IO.StreamWriter SW = new System.IO.StreamWriter(Filefs, Encoding.UTF8);
            SW.Write(Context);
            SW.Close();
            Filefs.Close();
            reportDir = ReportCreator.FindProjectItem(reportDir, FormName);
            FDesignWindow = reportDir.Open("{7651A702-06E5-11D1-8EBD-00A0C90F26EA}");
            FDesignWindow.Activate();
        }
开发者ID:san90279,项目名称:UK_OAS,代码行数:29,代码来源:ReportCreateor.cs

示例11: Main


//.........这里部分代码省略.........
                    Ibasa.OpenGL.Context.Clear(Ibasa.OpenGL.ClearFlags.Color | Ibasa.OpenGL.ClearFlags.Depth);

                    Ibasa.OpenGL.Context.CurrentProgram = theProgram;

                    Ibasa.OpenGL.Context.SetUniform(offsetLocation, offsetX, offsetY);

                    Ibasa.OpenGL.Context.ElementArrayBuffer.Buffer = indexBufferObject;
                    Ibasa.OpenGL.Context.ArrayBuffer.Buffer = positionBufferObject;
                    Ibasa.OpenGL.Context.VertexAttributeArrays[0].Enabled = true;
                    Ibasa.OpenGL.Context.VertexAttributeArrays[1].Enabled = true;
                    Ibasa.OpenGL.Context.VertexAttributeArrays[0].VertexAttributePointer(
                        4, Ibasa.OpenGL.DataType.Float, false, 32, 0);
                    Ibasa.OpenGL.Context.VertexAttributeArrays[1].VertexAttributePointer(
                        4, Ibasa.OpenGL.DataType.Float, false, 32, 16);

                    Ibasa.OpenGL.Context.DrawElements(
                        Ibasa.OpenGL.PrimitiveTopology.TriangleList, 9,
                        Ibasa.OpenGL.DataType.UnsignedShort, 0);

                    Ibasa.OpenGL.Context.VertexAttributeArrays[0].Enabled = false;
                    Ibasa.OpenGL.Context.VertexAttributeArrays[1].Enabled = false;
                    Ibasa.OpenGL.Context.ArrayBuffer.Buffer = Ibasa.OpenGL.Buffer.Null;
                    Ibasa.OpenGL.Context.CurrentProgram = Ibasa.OpenGL.Program.Null;

                    Ibasa.Platform.Windows.Wgl.SwapBuffers(hdc);
                }

                Ibasa.Platform.Windows.Wgl.MakeCurrent(IntPtr.Zero, IntPtr.Zero);
                Ibasa.Platform.Windows.Wgl.DeleteContext(hdc);
            }

            graphics.ReleaseHdc();
            graphics.Dispose();
            form.Close();

            Game game = new Game();

            game.Initalize();
            while (true)
            {
                game.Tick();
            }


            //unsafe
            //{
            //    long longs = 1337;
            //    int* ints = stackalloc int[2];

            //    Ibasa.Interop.Memory.Copy(&longs, ints, 8);

            //    Pair pair = new Pair();
            //    Ibasa.Interop.Memory.Read(ints, out pair);

            //    Console.WriteLine("{0}:{1}", ints[0], pair.A);
            //    Console.WriteLine("{0}:{1}", ints[1], pair.B);

            //    pair.A = 8008;
            //    pair.B = 1337;

            //    Ibasa.Interop.Memory.Write(ints, ref pair);

            //    Console.WriteLine("{0}:{1}", ints[0], pair.A);
            //    Console.WriteLine("{0}:{1}", ints[1], pair.B);

            //    Console.WriteLine("Sizeof(Pair) = {0}", Ibasa.Interop.Memory.SizeOf<Pair>());
开发者ID:Frassle,项目名称:Ibasa,代码行数:67,代码来源:Program.cs


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