Пример #1
0
        /****************
        * Constructors *
        ****************/

        #region Public Constructors

        /// <summary>Initializes a new instance of the SettingsDialog class.</summary>
        public SettingsDialog()
        {
            int i = 0;

            /* Initialize a check box indicating whether or not the text in the column bound to each non-
             * numeric display field should wrap, along with the stack panel to contain the check boxes.
             */
            this.WrapStackPanel = new StackPanel();
            foreach (MidiItem.DisplayField field in MidiItem.DisplayFields)
            {
                if (field.RightAlign)
                {
                    continue;
                }
                string   s        = UI.ParseLabel(field.LabelText);
                bool?    b        = MIDIopsyApp.GetWrapSetting(s);
                CheckBox checkBox = UI.CreateCheckBox(++i, (i > 1) ? MarginType.Standard : MarginType.Top, field.LabelText, b);
                this.WrapStackPanel.Children.Add(checkBox);
            }
            this.InitialElement = this.WrapStackPanel.Children[0];

            /* Build out a group box to contain the stack panel with the text wrapping check boxes. */
            GroupBox groupBox = new GroupBox();

            groupBox.Header  = Properties.Resources.TextWrapping;
            groupBox.Content = this.WrapStackPanel;
            groupBox.Margin  = new Thickness(UI.TripleSpace, UI.TripleSpace, UI.TripleSpace, UI.UnitSpace);

            /* Build out the window and its content. */
            this.AddUIElement(groupBox);
            this.BuildOut(SettingsDialog.ClientWidth, Properties.Resources.Settings);
        }
Пример #2
0
        private static void Main()
        {
            /* Start the application and open a new window. */
            MIDIopsyApp    app    = new MIDIopsyApp();
            MIDIopsyWindow window = new MIDIopsyWindow();

            app.Run(window);
        }
Пример #3
0
        /****************
        * Constructors *
        ****************/

        #region Public Constructors

        /// <summary>Initializes a HelpWindow object.</summary>
        public HelpWindow()
        {
            /* This browser containing the (HTML) help text will serve as the content of the window. */
            this.Browser = new WebBrowser();
            this.Browser.NavigateToString(Properties.Resources.HelpText);

            /* Build the window. */
            this.Content = this.Browser;
            this.Icon    = MIDIopsyApp.CreateBitmapSource("Help.ico");
            this.Title   = MIDIopsyApp.Name + " " + ApplicationCommands.Help.Text;
            this.Restore(Properties.Settings.Default.HelpWindowMaximized, Properties.Settings.Default.HelpWindowBounds);
            this.Loaded  += this.HelpWindow_Loaded;
            this.Closing += this.HelpWindow_Closing;
        }
Пример #4
0
        /***********
        * Methods *
        ***********/

        #region Public Methods

        /// <summary>Displays an About box in front of the specified window.</summary>
        /// <param name="owner">The owner window of the About box.</param>
        public static void Show(Window owner)
        {
            /* Define the grid content panel. */
            Grid grid = new Grid();

            grid.Width  = AboutBox.BannerWidth;
            grid.Height = 2 * AboutBox.BannerHeight;
            grid.RowDefinitions.Add(new RowDefinition());
            grid.RowDefinitions.Add(new RowDefinition());
            grid.ColumnDefinitions.Add(new ColumnDefinition());
            grid.ColumnDefinitions.Add(new ColumnDefinition());
            grid.ColumnDefinitions[0].Width = new GridLength(AboutBox.BannerWidth - AboutBox.BannerHeight);

            /* Initialize the banner image.  (Note: "Build Action" property must be set to "Resource") */
            Image image = new Image();

            image.Source = MIDIopsyApp.CreateBitmapSource("Banner.bmp");
            Grid.SetRow(image, 0);
            Grid.SetColumn(image, 0);
            Grid.SetColumnSpan(image, 2);
            grid.Children.Add(image);

            /* Initialize the info text block. */
            TextBlock textBlock = new TextBlock();

            textBlock.Margin = new Thickness(AboutBox.MarginLength, AboutBox.MarginLength / 2, 0, 0);
            textBlock.Inlines.Add(AboutBox.Product);
            textBlock.Inlines.Add(new LineBreak());
            string s = string.Format("{0} {1}", Properties.Resources.Version, AboutBox.Version);

            textBlock.Inlines.Add(s);
            textBlock.Inlines.Add(new LineBreak());
            textBlock.Inlines.Add(AboutBox.Copyright);
            textBlock.Inlines.Add(new LineBreak());
            Hyperlink hyperlink = new Hyperlink();

            hyperlink.NavigateUri = new Uri("https://jeffbourdier.github.io/" + MIDIopsyApp.Name.ToLower());
            hyperlink.Inlines.Add(hyperlink.NavigateUri.AbsoluteUri);
            hyperlink.RequestNavigate += AboutBox.Hyperlink_RequestNavigate;
            textBlock.Inlines.Add(hyperlink);
            Grid.SetRow(textBlock, 1);
            Grid.SetColumn(textBlock, 0);
            grid.Children.Add(textBlock);

            /* Initialize the OK button. */
            Button button = new Button();

            button.Margin    = new Thickness(AboutBox.MarginLength);
            button.Content   = Properties.Resources.OK;
            button.Click    += UI.OkButton_Click;
            button.IsCancel  = true;
            button.IsDefault = true;
            Grid.SetRow(button, 1);
            Grid.SetColumn(button, 1);
            grid.Children.Add(button);

            /* Build and show the window. */
            Window window = new Window();

            window.WindowStyle   = WindowStyle.ToolWindow;
            window.ResizeMode    = ResizeMode.NoResize;
            window.Title         = Properties.Resources.About + " " + MIDIopsyApp.Name;
            window.Content       = grid;
            window.SizeToContent = SizeToContent.WidthAndHeight;
            window.Owner         = owner;
            FocusManager.SetFocusedElement(window, button);
            window.ShowDialog();
        }