public static bool EditSettings(IWin32Window owner, TemporaryBlogSettings blogSettings, bool showAccountSettings, Type selectedPanel)
        {
            // make a copy of the blog settings for editing
            TemporaryBlogSettings editableBlogSettings = blogSettings.Clone() as TemporaryBlogSettings;

            // show form
            using (PreferencesForm preferencesForm = new PreferencesForm())
            {
                using (BlogClientUIContextScope uiContextScope = new BlogClientUIContextScope(preferencesForm))
                {
                    // customize form title and behavior
                    preferencesForm.Text = String.Format(CultureInfo.CurrentCulture, Res.Get(StringId.WeblogSettings), blogSettings.BlogName);
                    preferencesForm.HideApplyButton();

                    // panels
                    int iPanel = 0;
                    if (showAccountSettings)
                    {
                        preferencesForm.SetEntry(iPanel++, new AccountPanel(blogSettings, editableBlogSettings));
                    }

                    preferencesForm.SetEntry(iPanel++, new ImagesPanel(blogSettings, editableBlogSettings));
                    preferencesForm.SetEntry(iPanel++, new EditingPanel(blogSettings, editableBlogSettings));
                    preferencesForm.SetEntry(iPanel++, new BlogPluginsPanel(blogSettings, editableBlogSettings));
                    preferencesForm.SetEntry(iPanel++, new AdvancedPanel(blogSettings, editableBlogSettings));
                    preferencesForm.SelectEntry(selectedPanel);

                    // show the dialog
                    return(preferencesForm.ShowDialog(owner) == DialogResult.OK);
                }
            }
        }
Ejemplo n.º 2
0
        private void PreferencesButton_Click(object sender, EventArgs e)
        {
            Form form = new PreferencesForm(this);

            //this.Enabled = false;
            form.ShowDialog();
        }
Ejemplo n.º 3
0
 private void preferencesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     _preferencesForm = new PreferencesForm
     {
         StartPosition = FormStartPosition.CenterScreen,
         MaximizeBox   = false,
         MinimizeBox   = false
     };
     _preferencesForm.ShowDialog();
 }
Ejemplo n.º 4
0
        private void OnPreferencesClick(object sender, EventArgs e)
        {
            var preferencesForm = new PreferencesForm();
            var result          = preferencesForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                _themeFacade.Reload();
            }
        }
Ejemplo n.º 5
0
        private void settingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var f = new PreferencesForm
            {
                MaximizeBox     = false,
                MinimizeBox     = false,
                StartPosition   = FormStartPosition.CenterScreen,
                FormBorderStyle = FormBorderStyle.FixedSingle
            };

            f.ShowDialog();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// A version of show preferences that allows the caller to specify which
        /// panel should be selected when the dialog opens
        /// </summary>
        /// <param name="selectedPanelType"></param>
        public void ShowPreferences(IWin32Window owner, IBlogPostEditingSite editingSite, Type selectedPanelType)
        {
            //	Load preferences panels.
            LoadPreferencesPanels();

            //	Show the preferences form.
            using (new WaitCursor())
            {
                using (PreferencesForm preferencesForm = new PreferencesForm())
                {
                    //	Set the PreferencesPanel entries.
                    for (int i = 0; i < preferencesPanelTypes.Length; i++)
                    {
                        //	Add the entry.
                        Type             type  = preferencesPanelTypes[i];
                        PreferencesPanel panel = Activator.CreateInstance(type) as PreferencesPanel;
                        if (editingSite != null && panel is IBlogPostEditingSitePreferences)
                        {
                            (panel as IBlogPostEditingSitePreferences).EditingSite = editingSite;
                        }
                        preferencesForm.SetEntry(i, panel);

                        //	Select it, if requested.
                        if (type.Equals(selectedPanelType))
                        {
                            preferencesForm.SelectedIndex = i;
                        }
                    }

                    //	Provide a default selected index if none was specified.
                    if (preferencesForm.SelectedIndex == -1)
                    {
                        preferencesForm.SelectedIndex = 0;
                    }

                    //	Show the form.
                    preferencesForm.Win32Owner = owner;
                    preferencesForm.ShowDialog(owner);

                    // if we have an editing site then let it know that the account
                    // list may have been edited (allows it to adapt to the currently
                    // active weblog being deleted)
                    if (editingSite != null)
                    {
                        editingSite.NotifyWeblogAccountListEdited();
                    }
                }
            }
        }
Ejemplo n.º 7
0
 public void ShowWebProxyPreferences(IWin32Window owner)
 {
     //	Show the preferences form.
     using (new WaitCursor())
     {
         using (PreferencesForm preferencesForm = new PreferencesForm())
         {
             preferencesForm.Text = Res.Get(StringId.ProxyPrefTitle);
             preferencesForm.SetEntry(0, new WebProxyPreferencesPanel());
             preferencesForm.SelectedIndex = 0;
             preferencesForm.Win32Owner    = owner;
             preferencesForm.ShowDialog(owner);
         }
     }
 }
        public void ApplyTheme(ThemeType themeType, PreferencesForm form)
        {
            switch (themeType)
            {
            case ThemeType.Dark:

                form.BackColor            = Color.FromArgb(60, 60, 60);
                form.menuStrip1.BackColor = Color.FromArgb(60, 60, 60);
                ApplyDarkMenuItemTheme(form.menuStrip1.Items);
                form.statusStrip1.BackColor          = Color.FromArgb(0, 122, 204);
                form.label1.ForeColor                = Color.FromArgb(190, 190, 190);
                form.toolStripStatusLabel1.ForeColor = Color.FromArgb(255, 255, 255);
                break;
            }
        }
Ejemplo n.º 9
0
        void mPreferencesMenuItem_Click(object sender, EventArgs e)
        {
            if (mPreferencesForm == null)
            {
                mPreferencesForm = new PreferencesForm(mConfiguration, mMix.Devices, mDefaultDirectory);
            }

            var teletypeWasOnTop = DisableTeletypeOnTop();

            if (mPreferencesForm.ShowDialog(this) == DialogResult.OK)
            {
                GuiSettings.ColorProfilingCounts = mConfiguration.ColorProfilingCounts;
                UpdateLayout();
                UpdateDeviceConfig();
                mDeviceEditor.UpdateSettings();
                CardDeckExporter.LoaderCards = mConfiguration.LoaderCards;
            }


            mTeletype.TopMost |= teletypeWasOnTop;
        }
        public void ApplyTheme(ThemeType themeType, PreferencesForm form)
        {
            form.statusStrip1.BackColor          = Color.FromArgb(0, 122, 204);
            form.toolStripStatusLabel1.ForeColor = Color.FromArgb(255, 255, 255);
            switch (themeType)
            {
            case ThemeType.Dark:
                form.BackColor            = Color.FromArgb(60, 60, 60);
                form.menuStrip1.BackColor = Color.FromArgb(60, 60, 60);
                ApplyDarkMenuItemTheme(form.menuStrip1.Items);

                form.chkUseDarkTheme.ForeColor = Color.FromArgb(190, 190, 190);
                form.label1.ForeColor          = Color.FromArgb(190, 190, 190);
                break;

            case ThemeType.Light:
                form.BackColor            = Color.FromArgb(243, 243, 243);
                form.menuStrip1.BackColor = Color.FromArgb(221, 221, 221);
                ApplyLightMenuItemTheme(form.menuStrip1.Items);
                form.label1.ForeColor          = Color.FromArgb(97, 97, 97);
                form.chkUseDarkTheme.ForeColor = Color.FromArgb(97, 97, 97);
                break;
            }
        }
Ejemplo n.º 11
0
        public void CapturePreferences()
        {
            var f = new PreferencesForm();

            f.ShowDialog();
        }
Ejemplo n.º 12
0
        private void FilePreferencesMenuItem_Click(object sender, EventArgs e)
        {
            PreferencesForm form = new PreferencesForm();

            form.ShowDialog();
        }
Ejemplo n.º 13
0
        private bool LoadClient(Plugin plugin, uint otbVersion)
        {
            SupportedClient client = plugin.Instance.SupportedClients.Find(
                delegate(SupportedClient sc)
            {
                return(sc.OtbVersion == otbVersion);
            });

            if (client == null)
            {
                MessageBox.Show("The selected plugin does not support this version.");
                return(false);
            }

            uint datSignature = (uint)Properties.Settings.Default["DatSignature"];
            uint sprSignature = (uint)Properties.Settings.Default["SprSignature"];

            if (client.DatSignature != datSignature || client.SprSignature != sprSignature)
            {
                string message;
                if (datSignature == 0 || sprSignature == 0)
                {
                    message = "No client is selected. Please navigate to the client folder.";
                }
                else
                {
                    message = string.Format("The selected client is not compatible with this otb. Please navigate to the folder of a compatible client {0}.", client.Version);
                }

                MessageBox.Show(message);

                PreferencesForm form = new PreferencesForm();
                if (form.ShowDialog() == DialogResult.OK && form.Plugin != null)
                {
                    return(this.LoadClient(form.Plugin, otbVersion));
                }
                else
                {
                    return(false);
                }
            }

            string clientFolder = (string)Properties.Settings.Default["ClientDirectory"];

            if (string.IsNullOrEmpty(clientFolder))
            {
                return(false);
            }

            string datPath      = Utils.FindClientFile(clientFolder, ".dat");
            string sprPath      = Utils.FindClientFile(clientFolder, ".spr");
            bool   extended     = (bool)Properties.Settings.Default["Extended"];
            bool   transparency = (bool)Properties.Settings.Default["Transparency"];

            extended = extended || client.Version >= 960;

            if (!File.Exists(datPath) || !File.Exists(sprPath))
            {
                MessageBox.Show("Client files not found.");
                return(false);
            }

            Trace.WriteLine(string.Format("OTB version {0}.", otbVersion));

            bool result;

            try
            {
                result = plugin.Instance.LoadClient(client, extended, transparency, datPath, sprPath);
            }
            catch (UnauthorizedAccessException error)
            {
                MessageBox.Show(error.Message + " Please run this program as administrator.");
                return(false);
            }

            Trace.WriteLine("Loading client files.");
            if (!result)
            {
                MessageBox.Show(string.Format("The plugin could not load dat or spr."));
            }

            this.serverItems.ClientVersion = client.Version;
            Trace.WriteLine(string.Format("Client version {0}.", client.Version));
            return(result);
        }
Ejemplo n.º 14
0
        public virtual void ExploreMenuItem_Click(object sender, EventArgs e)
        {
            if (Verb.Equals(ConsoleVerb))
            {
                ConsoleForm cf = new ConsoleForm();
                cf.ShowDialog();
            }
            else
            if (Verb.Equals(PreferencesVerb))
            {
                ContextMenuEventArgs c = (ContextMenuEventArgs)e;

                //NativeWindow nativeWindow = new NativeWindow();
                //nativeWindow.AssignHandle(c.CommandInfo.hwnd);

                PreferencesForm pf = new PreferencesForm();
                pf.ShowDialog();
            }
            else if (Verb.Equals(ConnectVerb))
            {
                DeviseAddr addr = new DeviseAddr();
                if (!string.IsNullOrEmpty(addr.ConnectionType) && addr.ConnectionType.Equals("usb") &&
                    !string.IsNullOrEmpty(addr.UsbDevice))
                {
                    //ADBCommand commandD = new ADBCommand();
                    //CommandResult retD = commandD.Disconnect(true);
                }
                else
                {
                    ADBCommand    commandD = new ADBCommand();
                    CommandResult retD     = commandD.Disconnect();
                }

                ADBCommand    command = new ADBCommand();
                CommandResult ret     = command.Connect();
                ret.ShowMessage();
                ADBCommand    commandDev = new ADBCommand();
                CommandResult retDev     = commandDev.Devices();
                if (retDev.IsSuccess)
                {
                    Dictionary <string, string> dicDev = new Dictionary <string, string>();
                    foreach (var str in retDev.Message.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        if (!string.IsNullOrEmpty(str))
                        {
                            string[] s = str.Split(' ');
                            if (s.Any())
                            {
                                string sDevType = string.Empty;
                                if (s.Length > 1)
                                {
                                    sDevType = s[1];
                                }
                                if (!dicDev.ContainsKey(s[0]))
                                {
                                    dicDev.Add(s[0], sDevType);
                                }
                            }
                        }
                    }

                    if (dicDev.Count == 0)
                    {
                        MessageBox.Show("List of devices attached - is empty",
                                        "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    if (!dicDev.ContainsKey(commandDev.CurrentDevice()))
                    {
                        MessageBox.Show("List of devices attached - does not contain selected device",
                                        "Warning!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }

                    if (dicDev.ContainsKey(commandDev.CurrentDevice()) && dicDev[commandDev.CurrentDevice()].Equals("unauthorized"))
                    {
                        MessageBox.Show("Please authorize this computer on dialog in device,\r\nAnd after that, click Ok button to continue",
                                        "Warning! " + retDev.Message.Replace("\t", " - "), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    IntPtr pParrent = ItemIdList.Create(null, _folderObj.PathData).Ptr;
                    Shell32.SHChangeNotify(ShellChangeEvents.UpdateDir,
                                           ShellChangeFlags.IdList | ShellChangeFlags.Flush,
                                           pParrent,
                                           IntPtr.Zero);
                    Marshal.FreeCoTaskMem(pParrent);
                }
            }
            else if (Verb.Equals(DisconnectVerb))
            {
                ADBCommand    command = new ADBCommand();
                CommandResult ret     = command.Disconnect();
                ret.ShowMessage();

                IntPtr pParrent = ItemIdList.Create(null, _folderObj.PathData).Ptr;
                Shell32.SHChangeNotify(ShellChangeEvents.UpdateDir,
                                       ShellChangeFlags.IdList | ShellChangeFlags.Flush,
                                       pParrent,
                                       IntPtr.Zero);
                Marshal.FreeCoTaskMem(pParrent);
            }
            else if (Verb.Equals(InstallApkVerb))
            {
                ADBCommand    command = new ADBCommand();
                CommandResult ret     = command.Install(_folderObj.PathString);
                ret.ShowMessage();
            }
            else if (Verb.Equals(CreateScreenshotVerb))
            {
                ADBCommand    command = new ADBCommand();
                CommandResult ret     = command.CreateScreenShot(_folderObj.PathString);
                ret.ShowMessage();
                // MessageBox.Show("Create Screenshot to: " + _folderObj.PathString);
            }
            else if (Verb.Equals(InfoVerb))
            {
                StringCollection sc = new StringCollection();

                PermissionsForm pf = new PermissionsForm();
                pf.SetData(_items, _folderObj);
                pf.ShowDialog();

                /*
                 * if (_folderObj.GetParrent() != null)
                 * {
                 *  _folderObj.GetParrent().RefreshItems(_items);
                 * }
                 */
                //_folderObj.RefreshItems(_items);
            }
            else if (Verb.Equals(NewFolderVerb))
            {
                _folderObj.NewFolder();
            }
            else if (Verb.Equals(RenameVerb))
            {
                using (Malloc m = Shell32.GetMalloc())
                {
                    byte[][]      clone = (byte[][])fqPidl.Clone();
                    List <byte[]> lsn   = clone.ToList();
                    lsn.RemoveAt(lsn.Count - 1);
                    clone = lsn.ToArray();
                    ItemIdList itemIdList       = ItemIdList.Create(m, fqPidl);
                    ItemIdList itemIdListFolder = ItemIdList.Create(m, clone);
                    Shell32.SHOpenFolderAndSelectItems(itemIdListFolder.Ptr, 1, new[] { itemIdList.Ptr }, Shell32.OFASI_EDIT);
                }
            }
            else if (Verb.Equals(CopyVerb))
            {
                DataObject       dobj      = new DataObject();
                List <string>    file_list = new List <string>();
                StringCollection sc        = new StringCollection();
                foreach (IFolderObject folderObject in _items)
                {
                    string sAdd = ((folderObject.Attributes & FolderAttributes.Folder) == FolderAttributes.Folder)
                            ? "[virtualfolder]"
                            : "[virtualfile]";
                    file_list.Add(string.Format("{0}{1}\\{2}", sAdd, CodePath.Code(folderObject.PathData), folderObject.PathString));
                    sc.Add(string.Format("{0}{1}\\{2}", sAdd, CodePath.Code(folderObject.PathData), folderObject.PathString));
                    //sc.Add(folderObject.PathString);
                    //file_list.Add(string.Format("{0}\\{1}", sAdd, folderObject.PathString));
                }
                dobj.SetData(DataFormats.FileDrop, (System.String[])file_list.ToArray());
                dobj.SetData(typeof(StringCollection), sc);
                Clipboard.SetDataObject(dobj, false);
                //Clipboard.SetFileDropList(sc);
            }
            else if (Verb.Equals(PasteLinkVerb))
            {
                List <string> lFiles = new List <string>();
                if (_folderObj.DataObject != null)
                {
                    DataObject       dobj = _folderObj.DataObject;
                    StringCollection z    = (StringCollection)dobj.GetData(typeof(StringCollection));
                    foreach (string s in z)
                    {
                        if (s.StartsWith("[virtualfolder]") || s.StartsWith("[virtualfile]"))
                        {
                            lFiles.Add(s);
                        }
                    }

                    lFiles.Add(_folderObj.PathString);
                    _folderObj.CopyItems(null, lFiles);

                    _folderObj.DataObject = null;
                }
                else
                if (Clipboard.ContainsData("DataObject"))
                {
                    DataObject       dobj = (DataObject)Clipboard.GetDataObject();
                    StringCollection z    = (StringCollection)dobj.GetData(typeof(StringCollection));
                    if (z != null)
                    {
                        foreach (string s in z)
                        {
                            if (s.StartsWith("[virtualfolder]"))
                            {
                                lFiles.Add(s);
                            }
                        }

                        lFiles.Add(_folderObj.PathString);
                        _folderObj.CopyItems(null, lFiles);
                    }
                }
            }
            else if (Verb.Equals(PasteVerb))
            {
                List <string> lFiles = new List <string>();
                //only for external
                if (Clipboard.ContainsFileDropList())
                {
                    StringCollection files = Clipboard.GetFileDropList();
                    foreach (string file in files)
                    {
                        if (!file.StartsWith("[virtualfolder]") && !file.StartsWith("[virtualfile]"))
                        {
                            lFiles.Add(file);
                        }
                    }
                }

                if (_folderObj.DataObject != null)
                {
                    DataObject       dobj = _folderObj.DataObject;
                    StringCollection z    = (StringCollection)dobj.GetData(typeof(StringCollection));
                    foreach (string s in z)
                    {
                        lFiles.Add(s);
                    }
                    _folderObj.DataObject = null;
                }
                else
                if (Clipboard.ContainsData("DataObject"))
                {
                    DataObject       dobj = (DataObject)Clipboard.GetDataObject();
                    StringCollection z    = (StringCollection)dobj.GetData(typeof(StringCollection));
                    if (z != null)
                    {
                        foreach (string s in z)
                        {
                            lFiles.Add(s);
                        }
                        //lFiles = DataObjectHelper.GetFiles(dobj);
                    }
                }

                string sr = string.Empty;
                foreach (string file in lFiles)
                {
                    sr += file + "\r\n";
                }
                sr += "to\r\n" + _folderObj.PathString;
                //MessageBox.Show(sr);
                Debug.WriteLine(sr);
                _folderObj.CopyItems(_folderObj, lFiles);
            }
            else if (Verb.Equals(DeleteVerb))
            {
                _folderObj.DeleteItems(_items);
            }
            else
            {
                using (Malloc m = Shell32.GetMalloc())
                {
                    ContextMenuEventArgs c = (ContextMenuEventArgs)e;

                    ShellExecuteInfo sei = new ShellExecuteInfo();
                    sei.cbSize = (uint)Marshal.SizeOf(typeof(ShellExecuteInfo));
                    sei.fMask  = ShellExecuteOptions.IdList | ShellExecuteOptions.ClassName;
                    ItemIdList itemIdList = ItemIdList.Create(m, fqPidl);
                    sei.lpIDList = itemIdList.Ptr;
                    sei.lpClass  = "folder";
                    sei.hwnd     = c.CommandInfo.hwnd;
                    sei.nShow    = c.CommandInfo.nShow;
                    sei.lpVerb   = Verb;

                    int result = Shell32.ShellExecuteEx(ref sei);

                    //m.Free(itemIdList.Ptr);

                    if (result == 0)
                    {
                        int lastError = Marshal.GetLastWin32Error();
                        throw new Exception("ShellExecuteEx failed; last error = " + lastError);
                    }
                }
            }
        }
Ejemplo n.º 15
0
        private void ShowPreferences(bool showAbout)
        {
            Cursor.Current = Cursors.WaitCursor;
            using (PreferencesForm form = new PreferencesForm(showAbout))
            {
                Cursor.Current = Cursors.Default;
                form.ShowDialog();
            }

            Language.Load(Program.Settings.General.Language);

            if (!Program.Settings.General.IsRecentFilesSaved)
            {
                using (SqlCeCommand cmd = new SqlCeCommand("delete from RecentFile", Program.GetOpenSettingsConnection()))
                {
                    cmd.ExecuteNonQuery();
                }
            }

            SetAlwaysOnTop();
        }