Esempio n. 1
0
        private void SaveUserPrefs()
        {
            double leftColWidth = this.innerGrid.ColumnDefinitions[0].ActualWidth;

            AppCuKey.SetValue(_rvn_Geometry,
                              String.Format("{0},{1},{2},{3},{4},{5}",
                                            this.Left,
                                            this.Top,
                                            this.Width,
                                            this.Height,
                                            leftColWidth,
                                            (int)this.WindowState));

            int x = (Int32)AppCuKey.GetValue(_rvn_Runs, 0);

            x++;
            AppCuKey.SetValue(_rvn_Runs, x);

            var bt = this.listView1.SelectedItem as BrowserTab;

            if (bt != null)
            {
                AppCuKey.SetValue(_rvn_LastUrl, bt.LocationUrl);
            }

            StoreUrlHistory();
        }
Esempio n. 2
0
 private void SaveFormToRegistry()
 {
     if (AppCuKey != null)
     {
         // the completion list
         var    converted        = _completions.ToList().ConvertAll(x => x.XmlEscapeIexcl());
         string completionString = String.Join("¡", converted.ToArray());
         AppCuKey.SetValue(_rvn_Completions, completionString);
     }
 }
Esempio n. 3
0
        private void LoadUserPrefs()
        {
            string s = (string)AppCuKey.GetValue(_rvn_Geometry);

            if (!String.IsNullOrEmpty(s))
            {
                double[] p = Array.ConvertAll <string, double>(s.Split(','),
                                                               new Converter <string, double>((t) => { return(Double.Parse(t)); }));
                if (p != null && p.Length == 5)
                {
                    Left        = p[0];
                    Top         = p[1];
                    Width       = p[2];
                    Height      = p[3];
                    WindowState = (System.Windows.WindowState)((int)p[4]);
                }
                else if (p != null && p.Length == 6)
                {
                    Left   = p[0];
                    Top    = p[1];
                    Width  = p[2];
                    Height = p[3];
                    var lcWidth = p[4];
                    WindowState = (System.Windows.WindowState)((int)p[5]);

                    this.innerGrid.ColumnDefinitions[0].Width =
                        new System.Windows.GridLength(lcWidth);
                }
            }

            LastUrlViewed = (string)AppCuKey.GetValue(_rvn_LastUrl);

            int x = (Int32)AppCuKey.GetValue(_rvn_ReloadIntervalInMs, 0);

            if ((x != 0) && (x > 1000) && (x < 180 * 1000))
            {
                ReasonableInterval = new TimeSpan(x * 10000);
            }
            else
            {
                ReasonableInterval = new TimeSpan(2800 * 10000);  // 3.2s
                AppCuKey.SetValue(_rvn_ReloadIntervalInMs, 2800);
            }
        }
        private void SaveFormToRegistry()
        {
            if (AppCuKey == null)
            {
                return;
            }

            StoreFileHistory();

            if (!String.IsNullOrEmpty(this.tbXpath.Text))
            {
                AppCuKey.SetValue(_rvn_XPathExpression, this.tbXpath.Text);
            }

            if (!String.IsNullOrEmpty(this.tbPrefix.Text))
            {
                AppCuKey.SetValue(_rvn_Prefix, this.tbPrefix.Text);
            }

            if (!String.IsNullOrEmpty(this.tbXmlns.Text))
            {
                AppCuKey.SetValue(_rvn_Xmlns, this.tbXmlns.Text);
            }

            AppCuKey.SetValue(_rvn_LastRun, System.DateTime.Now.ToString("yyyy MMM dd HH:mm:ss"));
            int x = (Int32)AppCuKey.GetValue(_rvn_Runs, 0);

            x++;
            AppCuKey.SetValue(_rvn_Runs, x);

            // store the size of the form
            int w = 0, h = 0, left = 0, top = 0;

            if (this.Bounds.Width < this.MinimumSize.Width || this.Bounds.Height < this.MinimumSize.Height)
            {
                // RestoreBounds is the size of the window prior to last minimize action.
                // But the form may have been resized since then!
                w    = this.RestoreBounds.Width;
                h    = this.RestoreBounds.Height;
                left = this.RestoreBounds.Location.X;
                top  = this.RestoreBounds.Location.Y;
            }
            else
            {
                w    = this.Bounds.Width;
                h    = this.Bounds.Height;
                left = this.Location.X;
                top  = this.Location.Y;
            }
            AppCuKey.SetValue(_rvn_Geometry,
                              String.Format("{0},{1},{2},{3},{4}",
                                            left, top, w, h, (int)this.WindowState));

            // workitem 3392
            // store the position of splitter
            // AppCuKey.SetValue(_rvn_Splitter, this.splitContainer3.SplitterDistance.ToString());

            // the Xpath expression MRU list
            var    converted = _xpathExpressionMruList.ToList().ConvertAll(z => z.XmlEscapeIexcl());
            string history   = String.Join("¡", converted.ToArray());

            AppCuKey.SetValue(_rvn_History, history);
        }
Esempio n. 5
0
        private void StoreUrlHistory()
        {
            var mruPath = _AppRegyPath + "\\URLs";
            var dirPath = _AppRegyPath + "\\Dirs";

            var mruKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(mruPath, true);

            if (mruKey == null)
            {
                mruKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(mruPath);
            }

            if (mruKey == null)
            {
                return;
            }

            var dirKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(dirPath, true);

            if (dirKey == null)
            {
                dirKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(dirPath);
            }

            if (dirKey == null)
            {
                mruKey.Close();
                return;
            }

            try
            {
                var wantReloads = new System.Collections.Generic.List <String>();
                var list        = watchedUrlHistory.GetKeys();
                for (int i = 0, C = list.Count; i < C; i++)
                {
                    string c = new String((char)(i + 65), 1);
                    mruKey.SetValue(c, list[i]);

                    // store the list of directories for that URL
                    var tab = watchedUrlHistory[list[i]];
                    if (tab.WantReload)
                    {
                        wantReloads.Add(c);
                    }

                    if (tab.PathsToMonitor != null && tab.PathsToMonitor.Count > 0)
                    {
                        var    a = tab.PathsToMonitor.ToArray();
                        string j = String.Join(",", a);
                        dirKey.SetValue(c, j);
                    }
                    else
                    {
                        dirKey.SetValue(c, "");
                    }
                }

                if (wantReloads.Count > 0)
                {
                    string reloads = String.Join("", wantReloads.ToArray());
                    AppCuKey.SetValue(_rvn_WantReloads, reloads);
                }
                else
                {
                    AppCuKey.SetValue(_rvn_WantReloads, "");
                }
            }
            finally
            {
                mruKey.Close();
                dirKey.Close();
            }
        }
Esempio n. 6
0
        private void SaveFormToRegistry()
        {
            if (this.tbExtractDir.InvokeRequired)
            {
                return;                                   // skip it
            }
            if (AppCuKey != null)
            {
                AppCuKey.SetValue(_rvn_DirectoryToZip, this.tbDirectoryToZip.Text);
                AppCuKey.SetValue(_rvn_SelectionToZip, this.tbSelectionToZip.Text);
                AppCuKey.SetValue(_rvn_SelectionToExtract, this.tbSelectionToExtract.Text);
                AppCuKey.SetValue(_rvn_ZipTarget, this.tbZipToCreate.Text);
                AppCuKey.SetValue(_rvn_ZipToOpen, this.tbZipToOpen.Text);
                AppCuKey.SetValue(_rvn_Encoding, this.comboEncoding.SelectedItem.ToString());
                AppCuKey.SetValue(_rvn_Compression, this.comboCompression.SelectedItem.ToString());
                if (this.tbPassword.Text == "")
                {
                    if (!String.IsNullOrEmpty(_mostRecentEncryption))
                    {
                        AppCuKey.SetValue(_rvn_Encryption, _mostRecentEncryption);
                    }
                }
                else
                {
                    AppCuKey.SetValue(_rvn_Encryption, this.comboEncryption.SelectedItem.ToString());
                }

                AppCuKey.SetValue(_rvn_ExtractLoc, this.tbExtractDir.Text);

                int x = this.comboFlavor.SelectedIndex;
                AppCuKey.SetValue(_rvn_ZipFlavor, x);

                x = this.comboZip64.SelectedIndex;
                AppCuKey.SetValue(_rvn_Zip64Option, x);

                x = this.comboExistingFileAction.SelectedIndex;
                AppCuKey.SetValue(_rvn_ExtractExistingFileAction, x);

                AppCuKey.SetValue(_rvn_FormTab, this.tabControl1.SelectedIndex);

                AppCuKey.SetValue(_rvn_LastRun, System.DateTime.Now.ToString("yyyy MMM dd HH:mm:ss"));
                x = (Int32)AppCuKey.GetValue(_rvn_Runs, 0);
                x++;
                AppCuKey.SetValue(_rvn_Runs, x);

                AppCuKey.SetValue(_rvn_HidePassword, this.chkHidePassword.Checked ? 1 : 0);
                AppCuKey.SetValue(_rvn_OpenExplorer, this.chkOpenExplorer.Checked ? 1 : 0);
                AppCuKey.SetValue(_rvn_TraverseJunctions, this.chkTraverseJunctions.Checked ? 1 : 0);
                AppCuKey.SetValue(_rvn_RecurseDirs, this.chkRecurse.Checked ? 1 : 0);
                AppCuKey.SetValue(_rvn_RemoveFiles, this.chkRemoveFiles.Checked ? 1 : 0);

                // the selection completion list
                var    converted = _selectionCompletions.ToList().ConvertAll(z => z.XmlEscapeIexcl());
                string history   = String.Join("¡", converted.ToArray());
                AppCuKey.SetValue(_rvn_SelectionCompletions, history);


                // store the size of the form
                int w = 0, h = 0, left = 0, top = 0;
                if (this.Bounds.Width < this.MinimumSize.Width || this.Bounds.Height < this.MinimumSize.Height)
                {
                    // RestoreBounds is the size of the window prior to last minimize action.
                    // But the form may have been resized since then!
                    w    = this.RestoreBounds.Width;
                    h    = this.RestoreBounds.Height;
                    left = this.RestoreBounds.Location.X;
                    top  = this.RestoreBounds.Location.Y;
                }
                else
                {
                    w    = this.Bounds.Width;
                    h    = this.Bounds.Height;
                    left = this.Location.X;
                    top  = this.Location.Y;
                }
                AppCuKey.SetValue(_rvn_Geometry,
                                  String.Format("{0},{1},{2},{3},{4}",
                                                left, top, w, h, (int)this.WindowState));

                AppCuKey.Close();
            }
        }