Ejemplo n.º 1
0
        /// <summary>Set fullscreen to a specific state</summary>
        /// <param name="value">True for fullscreen, false of restored size and position</param>
        public void FullscreenSet(bool value)
        {
            TvCore.Settings.Fullscreen = value;
            TvCore.Settings.Save();

            if (value)
            {
                TvCore.Settings.TvFormOldSize     = Size;
                TvCore.Settings.TvFormOldLocation = Location;
                TvCore.Settings.TvFormOldState    = WindowState.ToString();
                TvCore.Settings.Save();

                FormBorderStyle = FormBorderStyle.None;
                WindowState     = FormWindowState.Maximized;
            }
            else
            {
                WindowState     = (FormWindowState)Enum.Parse(typeof(FormWindowState), TvCore.Settings.TvFormOldState);
                FormBorderStyle = TvCore.Settings.Borders ? FormBorderStyle.Sizable : FormBorderStyle.None;

                Location = TvCore.Settings.TvFormOldLocation;
                Size     = TvCore.Settings.TvFormOldSize;
            }

            IsFullscreen = value;

            AspectRatioResize();
        }
 private void Form1_LocationChanged(object sender, EventArgs e)
 {
     if (WindowState.ToString() == "Minimized")
     {
         Dispose();      //Close to tray
     }
 }
Ejemplo n.º 3
0
        private void SaveSettings()
        {
            RegistryKey softwareKey = Registry.LocalMachine.OpenSubKey("Software", true);

            if (softwareKey == null)
            {
                return;
            }

            RegistryKey wroxKey = softwareKey.CreateSubKey("WroxPress");

            if (wroxKey == null)
            {
                return;
            }

            RegistryKey selfPlacingWindowKey = wroxKey.CreateSubKey("SelfPlacingWindow");

            if (selfPlacingWindowKey == null)
            {
                return;
            }

            selfPlacingWindowKey.SetValue("BackColor", BackColor.ToKnownColor());
            selfPlacingWindowKey.SetValue("Red", (int)BackColor.R);
            selfPlacingWindowKey.SetValue("Green", (int)BackColor.G);
            selfPlacingWindowKey.SetValue("Blue", (int)BackColor.B);
            selfPlacingWindowKey.SetValue("Width", Width);
            selfPlacingWindowKey.SetValue("Height", Height);
            selfPlacingWindowKey.SetValue("X", DesktopLocation.X);
            selfPlacingWindowKey.SetValue("Y", DesktopLocation.Y);
            selfPlacingWindowKey.SetValue("WindowState", WindowState.ToString());
        }
Ejemplo n.º 4
0
 internal void UnsetFullscreen(AglContext context)
 {
     context.UnsetFullScreen(window);
     Debug.Print("Telling Carbon to reset window state to " + windowState.ToString());
     SetCarbonWindowState();
     SetSize((short)windowedBounds.Width, (short)windowedBounds.Height);
 }
Ejemplo n.º 5
0
        public RoboTesterForm()
        {
            InitializeComponent();

            Localizer.LocalizeControl(this);
            controlButtonNameStart    = Localizer.GetString("TitleLAUNCH");
            controlButtonNameStop     = Localizer.GetString("TitleAbort");
            cbUseSelectedDate.Checked = UserSettings.Instance.UseTestPeriod;
            dtDateFrom.Value          = UserSettings.Instance.TestPeriodFrom == DateTime.MinValue ?
                                        DateTime.Now.Date.AddYears(-1) : UserSettings.Instance.TestPeriodFrom;
            dtDateTo.Value     = UserSettings.Instance.TestPeriodTo == DateTime.MinValue ? DateTime.Now: UserSettings.Instance.TestPeriodTo;
            cbLogTrace.Checked = UserSettings.Instance.SaveLog;

            worker.WorkerSupportsCancellation = true;
            worker.DoWork               += WorkerDoWork;
            worker.RunWorkerCompleted   += WorkerRunWorkerCompleted;
            worker.WorkerReportsProgress = true;

            InitContextAccountSettings();
            Instance = this;

            // запомнить окошко
            MainForm.Instance.AddNonChartWindowSets(new NonChartWindowSettings
            {
                Window      = WindowCode,
                WindowPos   = Location,
                WindowSize  = Size,
                WindowState = WindowState.ToString()
            });
        }
Ejemplo n.º 6
0
        private void SubscriptionFormLoad(object sender, EventArgs e)
        {
            WindowCode = NonChartWindowSettings.WindowCode.Subscription;
            if (DesignMode)
            {
                return;
            }
            subscriptionControl.Initialize(Close, MainForm.serverProxyTrade,
                                           s => MainForm.Instance.ShowTradeSignal(false, false, true, s, true),
                                           () => AccountStatus.Instance.AccountData,
                                           () => AccountStatus.Instance.Login,
                                           stat => MainForm.Instance.OpenInvestInPAMMDialog(stat, true),
                                           names =>
            {
                UserSettings.Instance.PerformersGridColumns = names;
                UserSettings.Instance.SaveSettings();
            },
                                           () => UserSettings.Instance.PerformersGridColumns,
                                           () => UserSettings.Instance.ActionOnSignal,
                                           signal => { UserSettings.Instance.ActionOnSignal = signal; },
                                           MainForm.Instance.ChatEngine);
            subscriptionControl.EnterRoomRequested += EnterRoom;

            // запомнить окошко
            MainForm.Instance.AddNonChartWindowSets(new NonChartWindowSettings
            {
                Window      = WindowCode,
                WindowPos   = Location,
                WindowSize  = Size,
                WindowState = WindowState.ToString()
            });
        }
Ejemplo n.º 7
0
        private void HandleFormClosing()
        {
            if (DataSourceAdapter != null)
            {
                IEnumerable <IConfigurationData> config = DataSourceAdapter.GetConfiguration();

                if (WindowState != FormWindowState.Minimized) //too many problems when the form is minimized, not supported
                {
                    UpdateConfig(config, AppConfiguration.SplitTopBottomName, splitTopBottom.SplitterDistance.ToString());
                    UpdateConfig(config, AppConfiguration.SplitLeftRightName, splitLeftRight.SplitterDistance.ToString());
                    UpdateConfig(config, AppConfiguration.SplitTagSelectName, splitTagSelect.SplitterDistance.ToString());

                    UpdateConfig(config, AppConfiguration.AppWidthName, Size.Width.ToString());
                    UpdateConfig(config, AppConfiguration.AppHeightName, Size.Height.ToString());
                    UpdateConfig(config, AppConfiguration.AppXName, Location.X.ToString());
                    UpdateConfig(config, AppConfiguration.AppYName, Location.Y.ToString());
                    UpdateConfig(config, AppConfiguration.WindowStateName, WindowState.ToString());
                }

                UpdateConfig(config, AppConfiguration.ColumnConfigName, BuildColumnConfig());
                UpdateConfig(config, ConfigType.AutoSearch.ToString("g"), chkAutoSearch.Checked.ToString());
                UpdateConfig(config, AppConfiguration.ItemsPerPageName, AppConfiguration.ItemsPerPage.ToString());
                UpdateConfig(config, AppConfiguration.LastSelectedTabIndexName, tabControl.SelectedIndex.ToString());
                UpdateConfig(config, AppConfiguration.TagSelectPinnedName, m_tagSelectControl.Pinned.ToString());
            }
        }
Ejemplo n.º 8
0
        // On form closing
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            Configuration config = Configuration.Instance;

            // save window location/size
            if (WindowState != FormWindowState.Minimized)
            {
                if (WindowState != FormWindowState.Maximized)
                {
                    config.SetConfigurationOption(mainFormXOption, Location.X.ToString( ));
                    config.SetConfigurationOption(mainFormYOption, Location.Y.ToString( ));
                    config.SetConfigurationOption(mainFormWidthOption, Width.ToString( ));
                    config.SetConfigurationOption(mainFormHeightOption, Height.ToString( ));
                }
                config.SetConfigurationOption(mainFormStateOption, WindowState.ToString( ));

                config.SetConfigurationOption(splitter1Option, mainSplitContainer.SplitterDistance.ToString( ));
                config.SetConfigurationOption(splitter2Option, splitContainer1.SplitterDistance.ToString( ));
                config.SetConfigurationOption(splitter3Option, splitContainer2.SplitterDistance.ToString( ));
            }

            // save size mode of picture box
            config.SetConfigurationOption(pictureSizeModeOption, pictureBox.SizeMode.ToString( ));

            // save recent folders
            for (int i = 0, n = recentFolders.Count; i < n; i++)
            {
                config.SetConfigurationOption(recentFolderOption + i, recentFolders[i]);
            }
            config.SetConfigurationOption(openLastOption, openLastFolderOnStartToolStripMenuItem.Checked.ToString( ));

            config.Save( );
        }
        protected override void OnClosing(CancelEventArgs e)
        {
            if (!_CloseGamefile())
            {
                // User decided to save before closing, so cancel closing
                e.Cancel = true;
            }
            else
            {
                // Save window state
                dynamic wnd;
                if (!Config.Root.HasSection("window"))
                {
                    wnd = Config.Root.AddSection("window");
                    wnd.AddItem("state", WindowState.ToString());
                    wnd.AddItem("pos_x", (int)Left);
                    wnd.AddItem("pos_y", (int)Top);
                    wnd.AddItem("size_x", (int)Width);
                    wnd.AddItem("size_y", (int)Height);
                    wnd.AddItem("splitter", (int)MainGrid.ColumnDefinitions[0].ActualWidth);
                }
                else
                {
                    wnd          = Config.Root.window;
                    wnd.state    = WindowState.ToString();
                    wnd.pos_x    = (int)Left;
                    wnd.pos_y    = (int)Top;
                    wnd.size_x   = (int)Width;
                    wnd.size_y   = (int)Height;
                    wnd.splitter = (int)MainGrid.ColumnDefinitions[0].ActualWidth;
                }
            }

            base.OnClosing(e);
        }
        private void AccountTradeResultsFormLoad(object sender, EventArgs e)
        {
            // загрузить сохраненные настройки
            cbShowBalanceCurve.Checked    = UserSettings.Instance.AccountResultsShowEquityCurve;
            cbDefaultUploadQuotes.Checked = UserSettings.Instance.AccountResultsUpdateQuotes;

            // запомнить окошко
            MainForm.Instance.AddNonChartWindowSets(new NonChartWindowSettings
            {
                Window      = WindowCode,
                WindowPos   = Location,
                WindowSize  = Size,
                WindowState = WindowState.ToString()
            });

            if (InstantCalculation)
            {
                BtnUpdateClick(sender, e);
            }
            else
            {
                // показать ту стату, что имеется
                var accId = AccountStatus.Instance.accountID;
                if (statByAccount.TryGetValue(accId, out statistics))
                {
                    UpdateTablesAndCharts(statistics);
                }
            }
        }
Ejemplo n.º 11
0
        private void RiskSetupFormLoad(object sender, EventArgs e)
        {
            if (DesignMode)
            {
                return;
            }

            // заполнить поля из настроек
            ReadParamsFromConfig();

            ShowCurrentLeverageOnChart();

            riskSetupControl.settingsChanged += RiskSettingsAreChanged;

            // запомнить окошко
            if (MainForm.Instance != null) // 4 winform test
            {
                MainForm.Instance.AddNonChartWindowSets(new NonChartWindowSettings
                {
                    Window      = WindowCode,
                    WindowPos   = Location,
                    WindowSize  = Size,
                    WindowState = WindowState.ToString()
                });
            }

            timerUpdateRisk.Enabled = true;
        }
Ejemplo n.º 12
0
 private void Form1_Resize(object sender, EventArgs e)
 {
     if (WindowState.ToString() != "Minimized")
     {
         this.dataGridView1.Size = new System.Drawing.Size(this.Width - 14, this.Height - 123);
         this.button5.Location   = new System.Drawing.Point(this.dataGridView1.Width - this.button4.Width + 4, 29);
         maxRows = (dataGridView1.Height / dataGridView1.RowTemplate.Height);
         int currentRows = dataGridView1.Rows.Count;
         int numBills    = newBills.theBills.Count;
         if (this.Height <= STARTING_HEIGHT)
         {
             maximized = false;
         }
         else
         {
             maximized = true;
         }
         if (maximized)
         {
             int newY = (int)Math.Floor(this.Height * 0.95);
             this.button1.Location  = new System.Drawing.Point(3, newY);
             this.button2.Location  = new System.Drawing.Point(110, newY);
             this.textBox1.Location = new System.Drawing.Point(this.Width - 343, newY + 5);
             this.textBox2.Location = new System.Drawing.Point(this.Width - 197, newY + 5);
             if (maxRows > numBills && numBills > currentRows)
             {
                 dataGridView1.Rows.Add(maxRows - numBills);
             }
             else if (maxRows > numBills && maxRows != currentRows)
             {
                 dataGridView1.Rows.Add(maxRows - currentRows);
             }
             this.Column1.Width = 120;
             this.Column2.Width = 120;
             this.Column3.Width = 120;
             this.Column4.Width = this.dataGridView1.Width - 183;
             maximized          = true;
         }
         else
         {
             int newY = (int)Math.Floor(this.Height * 0.89);
             this.button1.Location  = new System.Drawing.Point(3, newY);
             this.button2.Location  = new System.Drawing.Point(110, newY);
             this.textBox1.Location = new System.Drawing.Point(this.Width - 343, newY + 5);
             this.textBox2.Location = new System.Drawing.Point(this.Width - 197, newY + 5);
             for (int z = dataGridView1.Rows.Count; z > (numBills < 16 ? 16 : numBills); z--)
             {
                 dataGridView1.Rows.RemoveAt(z - 1);
             }
             this.Column1.Width = 90;
             this.Column2.Width = 90;
             this.Column3.Width = 90;
             this.Column4.Width = this.dataGridView1.Width - 273;
             maximized          = false;
         }
         //  int tester = (dataGridView1.Height - 2) - (maxRows * 22);
         // tester -= 21;
         // dataGridView1.ColumnHeadersHeight = 21 + tester;
     }
 }
Ejemplo n.º 13
0
        private void HandleFormClosing()
        {
            if (DataSourceAdapter != null)
            {
                IEnumerable <IConfigurationData> config = DataSourceAdapter.GetConfiguration();

                if (WindowState != FormWindowState.Minimized) //too many problems when the form is minimized, not supported
                {
                    UpdateConfig(config, AppConfiguration.SplitTopBottomName, splitTopBottom.SplitterDistance.ToString());
                    UpdateConfig(config, AppConfiguration.SplitLeftRightName, splitLeftRight.SplitterDistance.ToString());

                    UpdateConfig(config, AppConfiguration.AppWidthName, Size.Width.ToString());
                    UpdateConfig(config, AppConfiguration.AppHeightName, Size.Height.ToString());
                    UpdateConfig(config, AppConfiguration.AppXName, Location.X.ToString());
                    UpdateConfig(config, AppConfiguration.AppYName, Location.Y.ToString());
                    UpdateConfig(config, AppConfiguration.WindowStateName, WindowState.ToString());
                }

                if (GameFileViewFactory.IsUsingColumnView)
                {
                    UpdateConfig(config, AppConfiguration.ColumnConfigName, BuildColumnConfig());
                }
                else
                {
                    UpdateConfig(config, AppConfiguration.ColumnConfigName, BuildTileColumnConfig());
                }

                UpdateConfig(config, ConfigType.AutoSearch.ToString("g"), chkAutoSearch.Checked.ToString());
                UpdateConfig(config, AppConfiguration.ItemsPerPageName, AppConfiguration.ItemsPerPage.ToString());
            }
        }
Ejemplo n.º 14
0
        private void frmMain_FormClosed(object sender, FormClosedEventArgs e)
        {
            Settings.Default.WindowLocation       = Location;
            Settings.Default.WindowSize           = Size;
            Settings.Default.WindowState          = WindowState.ToString();
            Settings.Default.InputPanelHeight     = splitContainer.Panel1.Height;
            Settings.Default.RemoveComments       = cbRemoveComments.Checked;
            Settings.Default.RemoveRegions        = cbRemoveRegions.Checked;
            Settings.Default.LocalVarsCompressing = cbCompressLocalVars.Checked;
            Settings.Default.MembersCompressing   = cbCompressMemebers.Checked;
            Settings.Default.TypesCompressing     = cbCompressTypes.Checked;
            Settings.Default.RemoveSpaces         = cbRemoveSpaces.Checked;
            Settings.Default.MiscCompressing      = cbCompressMisc.Checked;
            Settings.Default.ConsoleApp           = cbConsoleApp.Checked;
            Settings.Default.RemoveNamespaces     = cbRemoveNamespaces.Checked;
            Settings.Default.LineLength           = int.Parse(tbLineLength.Text);
            Settings.Default.MinifyFiles          = cbMinifyFiles.Checked;
            var stringCollection = new StringCollection();

            foreach (var fileName in Sources)
            {
                stringCollection.Add(fileName.Key);
            }
            Settings.Default.FileList                  = stringCollection;
            Settings.Default.Code                      = tbInput.Text;
            Settings.Default.CompressPublic            = cbCompressPublic.Checked;
            Settings.Default.RemoveToStringMethods     = cbRemoveToStringMethods.Checked;
            Settings.Default.UselessMembersCompressing = cbUselessMembersCompressing.Checked;
            Settings.Default.Save();
        }
Ejemplo n.º 15
0
        public void SaveFile(bool playRandom, bool playRepeat, Core.FilterType selectedFilter, double songVolume, double soundsVolume,
                             bool songMute, bool soundsMute, double windowWidth, double windowHeight, WindowState windowState)
        {
            try
            {
                var            doc            = new XmlDocument();
                XmlDeclaration xmlDeclaration = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
                XmlElement     root           = doc.DocumentElement;
                doc.InsertBefore(xmlDeclaration, root);
                var rootElement = doc.CreateElement("StartupConfig");
                doc.AppendChild(rootElement);

                AppendValue(doc, rootElement, "PlayRandom", playRandom.ToString());
                AppendValue(doc, rootElement, "PlayRepeat", playRepeat.ToString());
                AppendValue(doc, rootElement, "SelectedFilter", selectedFilter.ToString());
                AppendValue(doc, rootElement, "SongVolume", songVolume.ToString());
                AppendValue(doc, rootElement, "SoundsVolume", soundsVolume.ToString());
                AppendValue(doc, rootElement, "SongMute", songMute.ToString());
                AppendValue(doc, rootElement, "SoundsMute", soundsMute.ToString());
                AppendValue(doc, rootElement, "WindowWidth", windowWidth.ToString());
                AppendValue(doc, rootElement, "WindowHeight", windowHeight.ToString());
                AppendValue(doc, rootElement, "WindowState", windowState.ToString());
                AppendList(doc, rootElement, "RecentProject", RecentProjects);


                using (TextWriter tw = new StreamWriter(configPath, false, Encoding.UTF8))
                    doc.Save(tw);
            }
            catch { }
        }
Ejemplo n.º 16
0
        private void WalletFormLoad(object sender, EventArgs e)
        {
            try
            {
                if (!AccountStatus.Instance.isAuthorized ||
                    string.IsNullOrEmpty(AccountStatus.Instance.Login))
                {
                    return;
                }

                InitiateAsynchLoad();

                // запомнить окошко
                MainForm.Instance.AddNonChartWindowSets(new NonChartWindowSettings
                {
                    Window      = WindowCode,
                    WindowPos   = Location,
                    WindowSize  = Size,
                    WindowState = WindowState.ToString()
                });
            }
            finally
            {
                timerUpdate.Enabled = true;
            }
        }
Ejemplo n.º 17
0
        private void frmSetting_FormClosing(object sender, FormClosingEventArgs e)
        {
            //Save config---------------------------------
            if (WindowState == FormWindowState.Normal)
            {
                //Windows Bound-------------------------------------------------------------------
                GlobalSetting.SetConfig(Name + ".WindowsBound", GlobalSetting.RectToString(Bounds));
            }

            //Windows State-------------------------------------------------------------------
            GlobalSetting.SetConfig(Name + ".WindowsState", WindowState.ToString());

            //Save extra supported extensions
            string extraExts = "";

            foreach (var control in panExtraExts.Controls)
            {
                var chk = (CheckBox)control;

                if (chk.Checked)
                {
                    extraExts += chk.Tag.ToString() + ";";
                }
            }
            GlobalSetting.SupportedExtraExtensions = extraExts;
            GlobalSetting.SetConfig("ExtraExtensions", GlobalSetting.SupportedExtraExtensions);

            //Force to apply the configurations
            GlobalSetting.IsForcedActive = true;
        }
Ejemplo n.º 18
0
        private void SavePositions()
        {
            if (WindowState != FormWindowState.Minimized)
            {
                if (WindowState != FormWindowState.Maximized)
                {
                    Form  owner = Owner;
                    Point origin;

                    if (owner != null)
                    {
                        Rectangle ownerWindowBounds = owner.Bounds;
                        origin = ownerWindowBounds.Location;
                    }
                    else
                    {
                        origin = new Point(0, 0);
                    }

                    // Save our client rectangle relative to our parent window's bounds (including non-client)

                    Rectangle ourClientBounds = WindowBoundsToClientBounds(this.Bounds);

                    int relativeLeft = ourClientBounds.Left - origin.X;
                    int relativeTop  = ourClientBounds.Top - origin.Y;

                    Settings.CurrentUser.SetInt32(SettingNames.Left, relativeLeft);
                    Settings.CurrentUser.SetInt32(SettingNames.Top, relativeTop);
                    Settings.CurrentUser.SetInt32(SettingNames.Width, ourClientBounds.Width);
                    Settings.CurrentUser.SetInt32(SettingNames.Height, ourClientBounds.Height);
                }

                Settings.CurrentUser.SetString(SettingNames.WindowState, WindowState.ToString());
            }
        }
Ejemplo n.º 19
0
        private void CheckBox_FullScreen_CheckedChanged(object sender, EventArgs e)
        {
            if (checkBoxFullScreen.Checked)
            {
                if (!checkBoxNoBorder.Checked)
                {
                    FormBorderStyle = FormBorderStyle.None;
                }

                windowSizeW  = Size.Width;
                windowsSizeH = Size.Height;
                windowPosX   = Location.X;
                windowPosY   = Location.Y;

                windowState = WindowState.ToString();
                WindowState = FormWindowState.Normal;

                Location = new Point(Screen.FromControl(this).Bounds.Left, Screen.FromControl(this).Bounds.Top);

                Width  = Screen.FromControl(this).Bounds.Width;
                Height = Screen.FromControl(this).Bounds.Height;
            }
            else
            {
                if (!checkBoxNoBorder.Checked)
                {
                    FormBorderStyle = FormBorderStyle.Sizable;
                }

                Location = new Point(windowPosX, windowPosY);
                Width    = windowSizeW;
                Height   = windowsSizeH;
            }
        }
Ejemplo n.º 20
0
        public void Save()
        {
            using (var writer = XmlWriter.Create(SettingsPath, new XmlWriterSettings {
                Indent = true
            }))
            {
                writer.WriteStartElement(typeof(EditorSettings).Name);
                writer.WriteElementString(WindowStateElement, WindowState.ToString());
                writer.WriteElementString(EditorThemeElement, EditorTheme.ToString());

                writer.WriteStartElement(DesktopBoundsElement);
                writer.WriteElementString(RectangleXElement, DesktopBounds.X.ToString(CultureInfo.InvariantCulture));
                writer.WriteElementString(RectangleYElement, DesktopBounds.Y.ToString(CultureInfo.InvariantCulture));
                writer.WriteElementString(RectangleWidthElement, DesktopBounds.Width.ToString(CultureInfo.InvariantCulture));
                writer.WriteElementString(RectangleHeightElement, DesktopBounds.Height.ToString(CultureInfo.InvariantCulture));
                writer.WriteEndElement();

                if (recentlyUsedFiles.Count > 0)
                {
                    writer.WriteStartElement(RecentlyUsedFilesElement);
                    foreach (var file in recentlyUsedFiles)
                    {
                        writer.WriteStartElement(RecentlyUsedFileElement);
                        writer.WriteElementString(FileTimestampElement, file.Timestamp.ToString("o"));
                        writer.WriteElementString(FileNameElement, file.FileName);
                        writer.WriteEndElement();
                    }
                    writer.WriteEndElement();
                }

                writer.WriteEndElement();
            }
        }
Ejemplo n.º 21
0
 /// <summary>
 /// Occurs when a key is pressed.
 /// </summary>
 /// <param name="sender">The KeyboardDevice which generated this event.</param>
 /// <param name="e">The key that was pressed.</param>
 void Keyboard_KeyDown(object sender, KeyboardKeyEventArgs e)
 {
     if (e.Key == Key.F11)
     {
         WindowState = WindowState == WindowState.Fullscreen ? WindowState.Normal : WindowState.Fullscreen;
         _gameSettings["WindowState"] = WindowState.ToString();
     }
 }
Ejemplo n.º 22
0
		/// <summary>
		///     Saves all values to the given xml writer.
		/// </summary>
		/// <param name="writer"></param>
		public void Save(XmlWriter writer)
		{
			writer.WriteAttributeString("top", Top.ToString(CultureInfo.InvariantCulture));
			writer.WriteAttributeString("left", Left.ToString(CultureInfo.InvariantCulture));
			writer.WriteAttributeString("width", Width.ToString(CultureInfo.InvariantCulture));
			writer.WriteAttributeString("height", Height.ToString(CultureInfo.InvariantCulture));
			writer.WriteAttributeString("state", State.ToString());
		}
Ejemplo n.º 23
0
        void SaveSettings()
        {
            // Сохранение происходит при помощи работы с XML.
            XmlDocument doc = loadConfigDocument();

            // Открываем узел appSettings, в котором содержится перечень настроек.
            XmlNode node = doc.SelectSingleNode("//appSettings");

            // Массив ключей (создан для упрощения обращения к файлу конфигурации).
            string[] keys = new string[] { "BackGroundColor.R",
                                           "BackGroundColor.G",
                                           "BackGroundColor.B",
                                           "TextColor.R",
                                           "TextColor.G",
                                           "TextColor.B",
                                           "TextStyleFont.Name",
                                           "TextStyleFont.Size",
                                           "TextStyleFont.Style",

                                           "Window.State" };

            // Массив значений (создан для упрощения обращения к файлу конфигурации).
            string[] values = new string[] { BackColor.R.ToString(),
                     BackColor.G.ToString(),
                     BackColor.B.ToString(),
                     label1.ForeColor.R.ToString(),
                     label1.ForeColor.G.ToString(),
                     label1.ForeColor.B.ToString(),
                     label1.Font.Name.ToString(),
                     label1.Font.Size.ToString(),
                     label1.Font.Style.ToString(),

                     WindowState.ToString() };

            // Цикл модификации файла конфигурации.
            for (int i = 0; i < keys.Length; i++)
            {
                // Обращаемся к конкретной строке по ключу.
                XmlElement element = node.SelectSingleNode(string.Format("//add[@key='{0}']", keys[i])) as XmlElement;

                // Если строка с таким ключем существует - записываем значение.
                if (element != null)
                {
                    element.SetAttribute("value", values[i]);
                }
                else
                {
                    // Иначе: создаем строку и формируем в ней пару [ключ]-[значение].
                    element = doc.CreateElement("add");
                    element.SetAttribute("key", keys[i]);
                    element.SetAttribute("value", values[i]);
                    node.AppendChild(element);
                }
            }

            // Сохраняем результат модификации.
            doc.Save(Assembly.GetExecutingAssembly().Location + ".config");
        }
 private void Form1_LocationChanged(object sender, EventArgs e)
 {
     if (WindowState.ToString() == "Minimized")
     {
         Program.theForm.Hide();
         axVLC.pause();
         //Dispose();      //Close to tray
     }
 }
Ejemplo n.º 25
0
 private void Window_Closing(object sender, CancelEventArgs e)
 {
     // save Window position and state
     Properties.Settings.Default.XDrawWindow_State  = WindowState.ToString();
     Properties.Settings.Default.XDrawWindow_Left   = RestoreBounds.Left;
     Properties.Settings.Default.XDrawWindow_Top    = RestoreBounds.Top;
     Properties.Settings.Default.XDrawWindow_Width  = RestoreBounds.Width;
     Properties.Settings.Default.XDrawWindow_Height = RestoreBounds.Height;
 }
Ejemplo n.º 26
0
 private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     m_Settings["FirstStart"]          = "False";
     m_Settings["MainFormLocationX"]   = Location.X.ToString();
     m_Settings["MainFormLocationY"]   = Location.Y.ToString();
     m_Settings["MainFormSizeWidth"]   = Size.Width.ToString();
     m_Settings["MainFormSizeHeight"]  = Size.Height.ToString();
     m_Settings["MainFormWindowState"] = WindowState.ToString();
 }
Ejemplo n.º 27
0
        private void SaveSettings()
        {
            var storageFile   = IsolatedStorageFile.GetUserStoreForDomain();
            var storageStream = new IsolatedStorageFileStream(SelfplacingwindowXml, FileMode.Create, FileAccess.Write);
            var writer        = new XmlTextWriter(storageStream, Encoding.UTF8)
            {
                Formatting = Formatting.Indented
            };

            writer.WriteStartDocument();
            writer.WriteStartElement("Settings");

            {
                writer.WriteStartElement("BackColor");
                writer.WriteValue(BackColor.ToKnownColor().ToString());
                writer.WriteEndElement();

                writer.WriteStartElement("Red");
                writer.WriteValue(BackColor.R);
                writer.WriteEndElement();

                writer.WriteStartElement("Green");
                writer.WriteValue(BackColor.G);
                writer.WriteEndElement();

                writer.WriteStartElement("Blue");
                writer.WriteValue(BackColor.B);
                writer.WriteEndElement();

                writer.WriteStartElement("Width");
                writer.WriteValue(Width);
                writer.WriteEndElement();

                writer.WriteStartElement("Height");
                writer.WriteValue(Height);
                writer.WriteEndElement();

                writer.WriteStartElement("X");
                writer.WriteValue(DesktopLocation.X);
                writer.WriteEndElement();

                writer.WriteStartElement("Y");
                writer.WriteValue(DesktopLocation.Y);
                writer.WriteEndElement();

                writer.WriteStartElement("WindowState");
                writer.WriteValue(WindowState.ToString());
                writer.WriteEndElement();
            }

            writer.WriteEndElement();
            writer.Flush();
            writer.Close();
            storageStream.Close();
            storageFile.Close();
        }
Ejemplo n.º 28
0
        private void SaveWindowState()
        {
            XMLProfileSettings xml = new XMLProfileSettings();

            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowHeight", Name), Size.Height);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowWidth", Name), Size.Width);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationX", Name), Location.X);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationY", Name), Location.Y);
            xml.PutSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowState", Name),
                           WindowState.ToString());
        }
Ejemplo n.º 29
0
 private void buttonMax_Click(object sender, EventArgs e)
 {
     if (WindowState.ToString() == "Normal")
     {
         this.WindowState = FormWindowState.Maximized;
     }
     else
     {
         this.WindowState = FormWindowState.Normal;
     }
 }
Ejemplo n.º 30
0
 private void Window_StateChanged(object sender, EventArgs e)
 {
     if (WindowState.ToString() == "Normal")
     {
         this.BorderThickness = new Thickness(0);
     }
     else
     {
         this.BorderThickness = new Thickness(5);
     }
 }