Ejemplo n.º 1
0
    /// <summary>
    /// Initializes a new instance of the <see cref="FormSavedQueues"/> class.
    /// </summary>
    public FormSavedQueues()
    {
        InitializeComponent();
        colQueueSaveTime.Name = "colQueueSaveTime"; // the columns have only a design name.. LangLib doesn't apply on the nameless components
        colQueueName.Name     = "colQueueName";     // the columns have only a design name.. LangLib doesn't apply on the nameless components

        // ReSharper disable once StringLiteralTypo
        DBLangEngine.DBName = "lang.sqlite";
        if (Utils.ShouldLocalize() != null)
        {
            DBLangEngine.InitializeLanguage("amp.Messages", Utils.ShouldLocalize(), false);
            return; // After localization don't do anything more.
        }
        DBLangEngine.InitializeLanguage("amp.Messages");

        try // as this can be translated to a invalid format :-)
        {
            odExportQueue.Filter = DBLangEngine.GetMessage("msgFileExt_amp_qex", "amp# queue export files (*.amp#_qex)|*.amp#_qex|as in the combo box to select file type from a dialog");
            sdExportQueue.Filter = DBLangEngine.GetMessage("msgFileExt_amp_qex", "amp# queue export files (*.amp#_qex)|*.amp#_qex|as in the combo box to select file type from a dialog");
        }
        catch
        {
            // ignored..
        }

        odExportQueue.Title = DBLangEngine.GetMessage("msgImportQueueFrom", "Import queue from file|As in import a queue snapshot from a file");
        sdExportQueue.Title = DBLangEngine.GetMessage("msgExportQueueTo", "Export queue to file|As in export a queue snapshot to a file");

        fbdDirectory.Description = DBLangEngine.GetMessage("msgQueueCopyFlat",
                                                           "Copy songs into a single directory|A title to a folder select dialog indicating that files in a queue should be copied into a single directory.");
    }
        /// <summary>
        /// Displays the goto dialog with a specified <see cref="Scintilla"/> instance.
        /// </summary>
        /// <param name="scintilla">The Scintilla instance to use with the dialog.</param>
        public static void Execute(Scintilla scintilla)
        {
            if (1 >= scintilla.Lines.Count)
            {
                return;
            }

            var form = new FormDialogQueryJumpLocation
            {
                Scintilla = scintilla,
                nudGoto   =
                {
                    Minimum =                     1,
                    Maximum = scintilla.Lines.Count,
                    Value   = scintilla.LineFromPosition(scintilla.CurrentPosition)
                },
                lbEnterLineNumber =
                {
                    Text = DBLangEngine.GetStatMessage("msgEnterALineNumber",
                                                       "Enter a line number ({0} - {1}):|A message for a label describing an input control to select a line number",
                                                       1, scintilla.Lines.Count)
                }
            };

            form.ShowDialog();
        }
Ejemplo n.º 3
0
        public FormMain()
        {
            InitializeComponent();

            DBLangEngine.DBName = "LangLibTestWinforms.sqlite";

            if (Utils.ShouldLocalize() != null)
            {
                DBLangEngine.InitalizeLanguage("LangLibTestWinforms.Messages", Utils.ShouldLocalize(), false);
                return; // After localization don't do anything more.
            }


            DBLangEngine.InitalizeLanguage("LangLibTestWinforms.Messages");

            lbFallbackCulture.Text   = DBLangEngine.FallBackCulture.ToString();
            lbCurrentSysCulture.Text = System.Globalization.CultureInfo.CurrentCulture.ToString();
            try
            {
                Text = "LangLibTestWinforms - " + ((AssemblyCopyrightAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false)[0]).Copyright;
            }
            catch
            {
            }
            lbLoadSec.Text = DBLangEngine.InitTime.ToString();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Displays the dialog asking for a name to the queue snapshot.
        /// </summary>
        /// <param name="albumName">Name of the album to be used as a suggestion for a name for the snapshot.</param>
        /// <param name="overrideName">if set to <c>true</c> the name will contain the <paramref name="albumName"/> value.</param>
        /// <returns>A <see cref="string"/> the user gave for the dialog if the user accepted and the album name wasn't the temporary album; otherwise <see cref="string.Empty"/>.</returns>
        public static string Execute(string albumName, bool overrideName = false)
        {
            if (albumName == "tmp")
            {
                MessageBox.Show(
                    DBLangEngine.GetStatMessage("msgTmpAlbumError", "The current album is temporary album.{0}Please create an album with a name before continuing.|Album is a temporary one i.e. you clicked a music file and the program started. Can't save a anything against a temporary album.", Environment.NewLine),
                    DBLangEngine.GetStatMessage("msgError", "Error|A common error that should be defined in another message"), MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(string.Empty);
            }
            FormQueueSnapshotName queueName = new FormQueueSnapshotName();
            string namePart = DBLangEngine.GetStatMessage("msgQueue", "Queue|As in a queue snapshot");

            if (overrideName)
            {
                queueName.tbQueueName.Text = albumName;
            }
            else
            {
                queueName.tbQueueName.Text = namePart + @": " + albumName + @" - " + DateTime.Now.ToLongDateString() +
                                             @" (" + DateTime.Now.ToShortTimeString() + @")";
            }

            if (queueName.ShowDialog() == DialogResult.OK)
            {
                return(queueName.tbQueueName.Text);
            }

            if (overrideName)
            {
                return(albumName);
            }

            return(string.Empty);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Displays the dialog with a given <paramref name="queueIndex"/> (SQLite database ID number).
        /// </summary>
        /// <param name="conn">A reference to a <see cref="SQLiteConnection"/> class instance.</param>
        /// <param name="queueIndex">The index of the queue snapshot (SQLite database ID number).</param>
        /// <returns><c>true</c> if the user chose to accept the changes made to the queue snapshot, <c>false</c> otherwise.</returns>
        public static bool Execute(ref SQLiteConnection conn, int queueIndex)
        {
            FormModifySavedQueue frm = new FormModifySavedQueue
            {
                queueIndex = queueIndex,
                conn       = conn
            };

            frm.GetQueue();

            using (SQLiteCommand command = new SQLiteCommand(conn))
            {
                command.CommandText = "SELECT SNAPSHOTNAME FROM QUEUE_SNAPSHOT WHERE ID = " + queueIndex + " ";
                frm.Text            = DBLangEngine.GetStatMessage("msgModifyQueueCaption", "Modify saved queue [{0}]|A text to display in the window title where a saved queue is being modified",
                                                                  Convert.ToString(command.ExecuteScalar()));
            }

            if (frm.ShowDialog() == DialogResult.OK)
            {
                frm.SaveQueue();
                return(true);
            }

            return(false);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormSplash"/> class.
        /// </summary>
        public FormSplash()
        {
            InitializeComponent();

            DBLangEngine.DBName = "lang.sqlite"; // Do the VPKSoft.LangLib == translation..

            if (VPKSoft.LangLib.Utils.ShouldLocalize() != null)
            {
                DBLangEngine.InitalizeLanguage("vamp.Messages", VPKSoft.LangLib.Utils.ShouldLocalize(), false);
                return; // After localization don't do anything more..
            }

            DBLangEngine.InitalizeLanguage("vamp.Messages");

            // initialize static localized messages..
            MsgBindExceptionLogger = DBLangEngine.GetMessage("msgBindExceptionLogger", "Binding exception logger|As in bind the application global exception logger");
            MsgVisualStyles        = DBLangEngine.GetMessage("msgVisualStyles", "Visual styles|As in initializing the visual styles");
            MsgInitGeckoFXEngine   = DBLangEngine.GetMessage("msgInitGeckoFXEngine", "Initialize GeckoFx engine|As in initialize the GeckoFX web browser engine");
            MsgInitChromiumEmbeddedFrameworkSettings = DBLangEngine.GetMessage("msgInitChromiumEmbeddedFrameworkSettings", "Initialize Chromium Embedded Framework settings");
            MsgLoadChromiumEmbeddedFramework         = DBLangEngine.GetMessage("msgLoadChromiumEmbeddedFramework", "Load Chromium Embedded Framework");
            MsgLocalization         = DBLangEngine.GetMessage("msgLocalization", "Localization|As in localize the main form");
            MsgInitDatabase         = DBLangEngine.GetMessage("msgInitDatabase", "Initialize database|As in initialize the SQLite database connection and do some caching");
            MsgConfigureTMDbClient  = DBLangEngine.GetMessage("msgConfigureTMDbClient", "Configure the TMDb client|As in configure the TMdbEasy client and get its configuration");
            MsgDatabaseCacheLoading = DBLangEngine.GetMessage("msgDatabaseCacheLoading", "Database cache loading|As in data from the SQLite database is being cached in to the memory");
            MsgDatabaseMediaLocationCacheLoading = DBLangEngine.GetMessage("msgMsgDatabaseMediaLocationCacheLoading", "Database media location cache loading|As in data from the SQLite database from the MEDIALOCATION and from the PHOTOALBUM tables are being cached in to the memory");
            MsgDatabasePhotoCacheLoading         = DBLangEngine.GetMessage("msgDatabasePhotoCacheLoading", "Database photo file information cache loading|As in data from the SQLite database from the V_PHOTOALBUM view is being cached in to the memory");
            MsgInitializeVLCDotNet = DBLangEngine.GetMessage("msgInitializeVLCDotNet", "Initialize the VLC.DotNet|As in initialize the Vcl.DotNet library and underlying VLC native library");
            MsgDone       = DBLangEngine.GetMessage("msgDone", "..done.|As in some operation is done");
            MsgReady      = DBLangEngine.GetMessage("msgReady", "Ready|As in some operation is ready");
            MsgPercentage = DBLangEngine.GetMessage("msgPercentage", "{0} %|An indicator of percentage");
            // END: initialize static localized messages..

            // set the version to be seen..
            lbVersion.Text = "v." + Assembly.GetExecutingAssembly().GetName().Version.ToString();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormSettings"/> class.
        /// </summary>
        public FormSettings()
        {
            InitializeComponent();

            DBLangEngine.DBName = "lang.sqlite";              // Do the VPKSoft.LangLib == translation..

            DBLangEngine.AddNameSpace("VPKSoft.ImageButton"); // no localization from a foreign name space..

            if (Utils.ShouldLocalize() != null)
            {
                DBLangEngine.InitalizeLanguage("vamp.Messages", Utils.ShouldLocalize(), false);
                return; // After localization don't do anything more..
            }
            DBLangEngine.InitalizeLanguage("vamp.Messages");

            // prevent the form from growing larger than the size of the screen..
            //MaximumSize = Screen.PrimaryScreen.Bounds.Size;

            cmbItemDisplayCountValue.Items.Clear();
            cmbItemDisplayCountValue.Items.Add(
                DBLangEngine.GetMessage("msgItemCount",
                                        "Count|Watched items of a location should be displayed as how many items has been watched compared to total item count."));

            cmbItemDisplayCountValue.Items.Add(
                DBLangEngine.GetMessage("msgItemPercentage",
                                        "Percentage|Watched items of a location should be displayed as a percentage number of how many items has been watched compared to total item count."));

            // load the settings..
            LoadSettings();
        }
Ejemplo n.º 8
0
        // Messages for the translated tool-tips
        private void ToolTipEnter(object sender, EventArgs e)
        {
            string toolTip = string.Empty;

            if (sender.Equals(btnPervious))
            {
                toolTip = DBLangEngine.GetMessage("msgPhotoAlbumPrevious", "Previous photo|A tool-tip to indicate that a button would select a previous photo from a photo album");
            }
            else if (sender.Equals(btnNext))
            {
                toolTip = DBLangEngine.GetMessage("msgPhotoAlbumNext", "Next photo|A tool-tip to indicate that a button would select a next photo from a photo album");
            }
            else if (sender.Equals(btnRotateClockwise))
            {
                toolTip = DBLangEngine.GetMessage("msgPhotoRotateClockwise", "Rotate clockwise|A tool-tip to indicate that a button would rotate a photo clockwise");
            }
            else if (sender.Equals(btnRotateCounterClockwise))
            {
                toolTip = DBLangEngine.GetMessage("msgPhotoRotateCounterClockwise", "Rotate counterclockwise|A tool-tip to indicate that a button would rotate a photo counterclockwise");
            }
            else if (sender.Equals(btnExit))
            {
                toolTip = DBLangEngine.GetMessage("msgPhotoAlbumExit", "Exit|A tool-tip for a photo album browser exit button");
            }

            lbToolTip.Text = toolTip;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Displays the image with a given index.
        /// </summary>
        /// <param name="index">The index of an image display within the album.</param>
        private void DisplayImage(int index)
        {
            // only if the image exists..
            if (File.Exists(Path.Combine(basePath, albumContents[index].FILENAME)))
            {
                // ..load the image from a file to the VPKSoft.ImageViewer control..
                pbPhoto.Image = Image.FromFile(Path.Combine(basePath, albumContents[index].FILENAME));
            }
            // indicate a missing image..
            else
            {
                pbPhoto.Image = Properties.Resources.image_not_found;
            }

            // give a description for the image..
            lbImageDesc.Text = DBLangEngine.GetMessage(
                "msgPhotoDescription",
                "{0}/{1}: '{2}' [{3}]|A tool-tip for a position of a photo in a photo album, description for a photo and its take time",
                index + 1,
                albumContents.Count,
                albumContents[index].DESCRIPTION,
                albumContents[index].DATETIME_FREE == string.Empty ? albumContents[index].DATETIME.ToString() : albumContents[index].DATETIME_FREE);

            // ..give the previous description for the image's full screen mode label..
            lbFullScreenDescription.Text = lbImageDesc.Text;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="FormDialogQueryEncoding"/> class.
        /// </summary>
        public FormDialogQueryEncoding()
        {
            InitializeComponent();

            DBLangEngine.DBName = "lang.sqlite"; // Do the VPKSoft.LangLib == translation..

            if (Utils.ShouldLocalize() != null)
            {
                DBLangEngine.InitializeLanguage("ScriptNotepad.Localization.Messages", Utils.ShouldLocalize(), false);
                return; // After localization don't do anything more..
            }

            // initialize the language/localization database..
            DBLangEngine.InitializeLanguage("ScriptNotepad.Localization.Messages");

            // create a new instance of the CharacterSetComboBuilder class..
            CharacterSetComboBuilder = new CharacterSetComboBuilder(cmbCharacterSet, cmbEncoding, tbFilterEncodings, false, "encoding");

            Encoding = CharacterSetComboBuilder.CurrentEncoding;

            // subscribe the encoding selected event..
            CharacterSetComboBuilder.EncodingSelected += CharacterSetComboBuilder_EncodingSelected;

            // translate the tool tips..
            ttMain.SetToolTip(btUTF8,
                              DBLangEngine.GetMessage("msgUTF8Encoding", "Set to Unicode (UTF8)|Set the selected encoding to UTF8 via a button click"));

            // translate the tool tips..
            ttMain.SetToolTip(btSystemDefaultEncoding,
                              DBLangEngine.GetMessage("msgSysDefaultEncoding", "Set to system default|Set the selected encoding to system's default encoding via a button click"));
        }
Ejemplo n.º 11
0
        private void BtExportUserData_Click(object sender, EventArgs e)
        {
            sdZip.FileName = "amp_" + DateTime.Now.ToString("yyyy'-'MM'-'dd HH'_'mm") + "_backup";
            if (sdZip.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    using (ZipFile zip = new ZipFile())
                    {
                        zip.AddFile(Path.Combine(Paths.GetAppSettingsFolder(Misc.AppType.Winforms), "amp.sqlite"), "");
                        // Removed as useless: if a new version is installed and a backup is restored the
                        // localization will revert to the moment of the backup:
                        // ReSharper disable once CommentTypo
                        // zip.AddFile(Path.Combine(Paths.GetAppSettingsFolder(), "lang.sqlite"),"");

                        zip.AddFile(Path.Combine(Paths.GetAppSettingsFolder(Misc.AppType.Winforms), "settings.vnml"), "");
                        zip.AddFile(Path.Combine(Paths.GetAppSettingsFolder(Misc.AppType.Winforms), "position.vnml"), "");
                        zip.Save(sdZip.FileName);
                    }
                }
                catch (Exception ex)
                {
                    ExceptionLogger.LogError(ex);
                    MessageBox.Show(
                        DBLangEngine.GetMessage("msgUserDataExportError",
                                                "An error occurred while exporting the user data.|Something failed during compressing the user data to a ZIP file"),
                        DBLangEngine.GetMessage("msgError", "Error|A message describing that some kind of error occurred."),
                        MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                }
            }
        }
        /// <summary>
        /// Handles the Click event of the pbRenameSelectedSession control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void pbRenameSelectedSession_Click(object sender, EventArgs e)
        {
            if (cmbSessions.SelectedItem != null)
            {
                var session = (FileSession)cmbSessions.SelectedItem;

                if (ValidateSessionName(tbRenameSession, false, session.Id))
                {
                    // set the session name to the instance..
                    session.SessionName = tbRenameSession.Text.Trim(' ');

                    ScriptNotepadDbContext.DbContext.SaveChanges();

                    // set the session to the settings as it's saved as string using the session name..
                    FormSettings.Settings.CurrentSessionEntity = session;

                    // set the instance back to the combo box..
                    cmbSessions.SelectedItem = session;

                    MessageBoxExtended.Show(
                        DBLangEngine.GetMessage("msgSessionRenameSuccess",
                                                "The session was successfully renamed.|A message indicating a successful session rename."),
                        DBLangEngine.GetMessage("msgSuccess", "Success|A message indicating a successful operation."),
                        MessageBoxButtonsExtended.OK, MessageBoxIcon.Information, ExtendedDefaultButtons.Button1);
                }
                else
                {
                    MessageBoxExtended.Show(
                        DBLangEngine.GetMessage("msgWarningInvalidSessionName",
                                                "The session name '{0}' is either invalid or already exists in the database|The given session name is invalid (white space or null) or the given session name already exists in the database", tbRenameSession.Text),
                        DBLangEngine.GetMessage("msgWarning", "Warning|A message warning of some kind problem."),
                        MessageBoxButtonsExtended.OK, MessageBoxIcon.Warning, ExtendedDefaultButtons.Button1);
                }
            }
        }
Ejemplo n.º 13
0
    // validates the "recipe" for the song naming..
    private void tbCommonNaming_TextChanged(object sender, EventArgs e)
    {
        // avoid replicating the code..
        Label   label   = sender.Equals(tbAlbumNaming) ? lbNamingSampleValue : lbNamingSampleRenamedValue;
        TextBox textBox = (TextBox)sender;

        label.Text =
            MusicFile.GetString(textBox.Text,
                                DBLangEngine.GetMessage("msgArtists", "Artist|As in an artist(s) of a music file"),
                                DBLangEngine.GetMessage("msgAlbum", "Album|As in a name of an album of a music file"),
                                1,
                                DBLangEngine.GetMessage("msgTitle", "Title|As in a title of a music file"),
                                DBLangEngine.GetMessage("msgMusicFile", "A01 Song Name|A sample file name without path of a music file name"),
                                1, 2,
                                DBLangEngine.GetMessage("msgMusicFileRenamed", "I named this song my self|The user has renamed the song him self"),
                                DBLangEngine.GetStatMessage("msgError", "Error|A common error that should be defined in another message"), out bool error);

        bool formulaInText = // check that the formula has been parsed properly..
                             label.Text.Contains("#ARTIST") ||
                             label.Text.Contains("#ALBUM") ||
                             // ReSharper disable once StringLiteralTypo
                             label.Text.Contains("#TRACKNO") ||
                             label.Text.Contains("#QUEUE") ||
                             label.Text.Contains("#ALTERNATE_QUEUE") ||
                             label.Text.Contains("#RENAMED");

        error |= formulaInText;


        // indicate invalid naming formula..
        textBox.ForeColor = error || string.IsNullOrWhiteSpace(Text) ? Color.Red : SystemColors.WindowText;


        bOK.Enabled = !error && textBox.Text.Trim() != string.Empty;
    }
Ejemplo n.º 14
0
        private void cbRestEnabled_CheckedChanged(object sender, EventArgs e)
        {
            if (SettingsLoading)
            {
                return;
            }

            var checkBox = (CheckBox)sender;

            if (checkBox.Checked)
            {
                try
                {
                    AmpRemoteController.Dispose();
                    RestInitializer.InitializeRest("http://localhost/", (int)nudRestPort.Value,
                                                   FormMain.RemoteProvider);
                }
                catch (Exception exception)
                {
                    MessageBox.Show(
                        DBLangEngine.GetMessage("msgErrorRest",
                                                "Error initializing the RESTful API with port: {0} with exception: '{1}'.",
                                                nudRestPort.Value, exception.Message),
                        DBLangEngine.GetMessage("msgError",
                                                "Error|A message describing that some kind of error occurred."), MessageBoxButtons.OK,
                        MessageBoxIcon.Error);
                }
            }
            else
            {
                AmpRemoteController.Dispose();
            }
        }
Ejemplo n.º 15
0
        // Messages for the translated tool-tips
        private void ToolTipEnter(object sender, EventArgs e)
        {
            string toolTip = string.Empty;

            if (sender.Equals(btnBack))
            {
                toolTip = DBLangEngine.GetMessage("msgBrowserBack", "Back|A tool-tip for a browser back button");
            }
            else if (sender.Equals(btnForward))
            {
                toolTip = DBLangEngine.GetMessage("msgBrowserForward", "Forward|A tool-tip for a browser forward button");
            }
            else if (sender.Equals(btnRefresh))
            {
                toolTip = DBLangEngine.GetMessage("msgBrowserRefresh", "Refresh|A tool-tip for a browser refresh button");
            }
            else if (sender.Equals(btnCloseBrowser))
            {
                toolTip = DBLangEngine.GetMessage("msgBrowserExit", "Exit|A tool-tip for a browser exit button");
            }
            else if (sender.Equals(lbUrl))
            {
                toolTip = DBLangEngine.GetMessage("msgUrl", "URL|A tool-tip for a browser URL address");
            }
            else if (sender.Equals(btnBrowserHome))
            {
                toolTip = DBLangEngine.GetMessage("msgBrowserHome", "Home|A tool tip to indicate that the browser navigates to the page it was started from");
            }

            lbToolTip.Text = toolTip;
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormDialogQuerySortTextStyle"/> class.
        /// </summary>
        public FormDialogQuerySortTextStyle()
        {
            InitializeComponent();

            DBLangEngine.DBName = "lang.sqlite"; // Do the VPKSoft.LangLib == translation..

            if (Utils.ShouldLocalize() != null)
            {
                DBLangEngine.InitializeLanguage("ScriptNotepad.Localization.Messages", Utils.ShouldLocalize(), false);
                return; // After localization don't do anything more..
            }

            // initialize the language/localization database..
            DBLangEngine.InitializeLanguage("ScriptNotepad.Localization.Messages");

            ListSortStyles();

            btSort.Enabled = listCheckSortStyles.Items.Count > 0;

            #region NoDesignerVisibility
            pictureBox1.AllowDrop = true;
            pictureBox2.AllowDrop = true;
            #endregion

            var savedRegexs = ScriptNotepadDbContext.DbContext.MiscellaneousTextEntries.Where(f =>
                                                                                              f.TextType == MiscellaneousTextType.RegexSorting &&
                                                                                              f.Session.Id == FormSettings.Settings.CurrentSessionEntity.Id).OrderBy(f => f.Added);

            foreach (var savedRegex in savedRegexs)
            {
                tbRegex.Items.Add(savedRegex.TextValue);
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Displays the data of the given plug-in.
        /// </summary>
        /// <param name="plugin">The plug-in which data to display.</param>
        private void DisplayPluginData(Plugin plugin)
        {
            tbPluginName.Text        = plugin == null ? string.Empty : plugin.PluginName;
            tbPluginDescription.Text = plugin == null ? string.Empty : plugin.PluginDescription;
            tbPluginVersion.Text     = plugin == null ? string.Empty : plugin.PluginVersion;
            tbExceptionsThrown.Text  = plugin == null ? string.Empty : plugin.ExceptionCount.ToString();
            tbLoadFailures.Text      = plugin == null ? string.Empty : plugin.LoadFailures.ToString();
            tbAppCrashes.Text        = plugin == null ? string.Empty : plugin.ApplicationCrashes.ToString();
            tbInstalledAt.Text       = plugin == null ? string.Empty : plugin.PluginInstalled.ToShortDateString();
            tbUpdatedAt.Text         = plugin == null ? string.Empty : (plugin.PluginUpdated == DateTime.MinValue ?
                                                                        DBLangEngine.GetMessage("msgNA", "N/A|A message indicating a none value") :
                                                                        plugin.PluginUpdated.ToShortDateString());
            nudRating.Value = plugin?.Rating ?? 0;

            cbPluginActive.Checked = plugin != null && plugin.IsActive;
            cbPluginExists.Checked = plugin != null && File.Exists(plugin.FileNameFull);

            nudRating.Enabled      = plugin != null;
            btDeletePlugin.Enabled = plugin != null;
            cbPluginActive.Enabled = plugin != null;

            // indicate a serious flaw with the plug-in..
            if (plugin != null && plugin.ApplicationCrashes > 0)
            {
                lbAppCrashes.Font      = new Font(Font, FontStyle.Bold);
                lbAppCrashes.ForeColor = Color.Red;
            }
            // the plug-in is more or less safe..
            else
            {
                lbAppCrashes.Font      = Font;
                lbAppCrashes.ForeColor = SystemColors.ControlText;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="FormDialogSearchReplaceProgressFiles"/> class.
        /// </summary>
        /// <param name="crawler">An instance for the <see cref="DirectoryCrawler"/> class initialized elsewhere.</param>
        /// <param name="requestNextAction">A delegate for the <see cref="RequestNextAction"/> event as this class also unsubscribes the event handler.</param>
        public FormDialogSearchReplaceProgressFiles(DirectoryCrawler crawler, OnRequestNextAction requestNextAction)
        {
            InitializeComponent();

            DBLangEngine.DBName = "lang.sqlite"; // Do the VPKSoft.LangLib == translation..

            // initialize the language/localization database..
            DBLangEngine.InitializeLanguage("ScriptNotepad.Localization.Messages");

            // subscribe the disposed event..
            Disposed += FormDialogSearchReplaceProgressFiles_Disposed;

            // save the delegate for the RequestNextAction so it can be unsubscribed on this form's disposal..
            this.requestNextAction = requestNextAction;

            // subscribe the event with the delegate given in the parameter..
            RequestNextAction += requestNextAction;

            // subscribe to the ReportProgress event of the DirectoryCrawler instance..
            crawler.ReportProgress += Crawler_ReportProgress;

            // save the directory crawler instance..
            Crawler = crawler;

            // show this form as a dialog..
            ShowDialog();
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Localizes the texts used to build the <see cref="ContextMenuStrip"/> with the <seealso cref="CreateBasicContextMenuStrip"/> method.
        /// This should be called before any context menu strips have been created but after the <see cref="DBLangEngine"/> has been initialized.
        /// </summary>
        public static void LocalizeTexts()
        {
            TextUndo = DBLangEngine.GetStatMessage("msgContextUndo",
                                                   "Undo|A message for a context menu to describe an undo action");

            TextRedo = DBLangEngine.GetStatMessage("msgContextRedo",
                                                   "Redo|A message for a context menu to describe a redo action");

            TextCut = DBLangEngine.GetStatMessage("msgContextCut",
                                                  "Cut|A message for a context menu to describe a cut action");

            TextCopy = DBLangEngine.GetStatMessage("msgContextCopy",
                                                   "Copy|A message for a context menu to describe a copy action");

            TextPaste = DBLangEngine.GetStatMessage("msgContextPaste",
                                                    "Paste|A message for a context menu to describe a paste action");

            TextDelete = DBLangEngine.GetStatMessage("msgContextDelete",
                                                     "Delete|A message for a context menu to describe a delete text action");

            TextSelectAll = DBLangEngine.GetStatMessage("msgContextSelectAll",
                                                        "Select All|A message for a context menu to describe a select all text action");

            TextHexadecimalColor = DBLangEngine.GetStatMessage("msgPickAColor",
                                                               "Pick a color|A message for a context menu to describe a hexadecimal color in the text file converted to a color");

            TextInsertSpecialCharacter = DBLangEngine.GetStatMessage("msgInsertSpecialCharacter",
                                                                     "Insert special character...|A message for a context menu to describe drop down menu items to insert a special character into the document");
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormViewPDF"/> class.
        /// </summary>
        public FormViewPDF()
        {
            InitializeComponent();

            DBLangEngine.DBName = "lang.sqlite"; // Do the VPKSoft.LangLib == translation

            if (VPKSoft.LangLib.Utils.ShouldLocalize() != null)
            {
                DBLangEngine.InitalizeLanguage("vamp.Messages", VPKSoft.LangLib.Utils.ShouldLocalize(), false);
                return; // After localization don't do anything more.
            }

            DBLangEngine.InitalizeLanguage("vamp.Messages");

            // add the PdfViewer control to the form
            pnMain.Controls.Add(pdfViewer);                     // add the PdfViewer control to the container panel..
            pdfViewer.Parent      = pnMain;                     // set a parent control for the PdfViewer control..
            pdfViewer.ShowToolbar = false;                      // hide the PdfViewer control from the tool bar..
            pdfViewer.ZoomMode    = PdfViewerZoomMode.FitWidth; // set the PdfViewer control to zoom to document's width..
            pdfViewer.Dock        = DockStyle.Fill;             // dock the PdfViewer control to fill the form..
            pdfViewer.LinkClick  += PdfViewer_LinkClick;        // assign a link click handler to the PdfViewer control..

            m_GlobalHook = Hook.GlobalEvents();                 // The PdfViewer prevents the Form from getting mouse signals, so we add this (Gma.System.MouseKeyHook) event handler..
                                                                // (C): https://github.com/gmamaladze/globalmousekeyhook, MIT license

            m_GlobalHook.MouseMove += M_GlobalHook_MouseMove;   // Add a global MouseMove event..
            m_GlobalHook.MouseDown += M_GlobalHook_MouseDown;   // Add a global MouseDown event..
            m_GlobalHook.KeyDown   += GlobalKeyDown;            // Add a global KeyDown event..
        }
        /// <summary>
        /// Handles the Click event of the pbAddNewSessionWithName control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void pbAddNewSessionWithName_Click(object sender, EventArgs e)
        {
            // a user wishes to add a new session with a name..
            if (ValidateSessionName(tbAddNewSessionWithName, true))
            {
                ScriptNotepadDbContext.DbContext.FileSessions.Add(new FileSession
                {
                    SessionName = tbAddNewSessionWithName.Text.Trim(' ')
                });

                ScriptNotepadDbContext.DbContext.SaveChanges();

                // list the sessions to the combo box..
                ListSessions();

                MessageBoxExtended.Show(
                    DBLangEngine.GetMessage("msgSessionCreateSuccess",
                                            "The session was successfully created.|A message indicating a successful session creation."),
                    DBLangEngine.GetMessage("msgSuccess", "Success|A message indicating a successful operation."),
                    MessageBoxButtonsExtended.OK, MessageBoxIcon.Information, ExtendedDefaultButtons.Button1);
            }
            else
            {
                MessageBoxExtended.Show(
                    DBLangEngine.GetMessage("msgWarningInvalidSessionName",
                                            "The session name '{0}' is either invalid or already exists in the database|The given session name is invalid (white space or null) or the given session name already exists in the database", tbAddNewSessionWithName.Text),
                    DBLangEngine.GetMessage("msgWarning", "Warning|A message warning of some kind problem."),
                    MessageBoxButtonsExtended.OK, MessageBoxIcon.Warning, ExtendedDefaultButtons.Button1);
            }
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Localizes a given file dialog and adds the localized lexer file types to it's Filter property.
 /// </summary>
 /// <param name="dialog">The file dialog to localize.</param>
 public static void InitFileDialog(FileDialog dialog)
 {
     dialog.Filter  = string.Empty;
     dialog.Filter += DBLangEngine.GetStatMessage("msgAllFileTypes", "All types|*.*|A text in a file dialog indicating all files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgNormalTextFile", "Normal text file|*.txt|A text in a file dialog indicating .txt files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgFlashActionScriptFile", "Flash ActionScript file|*.as;*.mx|A text in a file dialog indicating Flash ActionScript files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgAdaFile", "Ada file|*.ada;*.ads;*.adb|A text in a file dialog indicating Ada files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgAssemblySourceFile", "Assembly language source file|*.asm|A text in a file dialog indicating Assembly language source files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgActiveServerPagesScriptFile", "Active Server Pages script file|*.asp|A text in a file dialog indicating Active Server Pages script files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgAutoItFile", "AutoIt|*.au3|A text in a file dialog indicating AutoIt files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgUnixScriptFile", "Unix script file|*.sh;*.bsh|A text in a file dialog indicating Unix script files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgBatchFile", "Batch file|*.bat;*.cmd;*.nt|A text in a file dialog indicating Batch files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgCSourceFile", "C source file|*.c|A text in a file dialog indicating C source files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgCategoricalAbstractMachineLanguageFile", "Categorical Abstract Machine Language|*.ml;*.mli;*.sml;*.thy|A text in a file dialog indicating Categorical Abstract Machine Language files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgCMakeFile", "CMake file|*.cmake|A text in a file dialog indicating CMake files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgCommonBusinessOrientedLanguage", "Common Business Oriented Language|*.cbl;*.cbd;*.cdb;*.cdc;*.cob|A text in a file dialog indicating Common Business Oriented Language files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgCoffeeScriptLanguage", "Coffee Script file|*.litcoffee|A text in a file dialog indicating Coffee Script files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgCPPSourceFile", "C++ source file|*.h;*.hpp;*.hxx;*.cpp;*.cxx;*.cc|A text in a file dialog indicating C++ source files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgCSSourceFile", "C# source file|*.cs|A text in a file dialog indicating C# source files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgCSSSourceFile", "Cascading Style Sheets File|*.css|A text in a file dialog indicating Cascading Style Sheets files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgDSourceFile", "D programming language|*.d|A text in a file dialog indicating D programming language files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgDiffFile", "Diff file|*.diff;*.patch|A text in a file dialog indicating Diff files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgFortranFreeFormSourceFile", "Fortran free form source file|*.f;*.for;*.f90;*.f95;*.f2k|A text in a file dialog indicating Fortran free form source files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgHaskellSourceFile", "Haskell source file|*.hs;*.lhs;*.as;*.las|A text in a file dialog indicating Haskell source files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgHyperTextMarkupLanguageFile", "Hyper Text Markup Language file|*.html;*.htm;*.shtml;*.shtm;*.xhtml;*.hta|A text in a file dialog indicating Hyper Text Markup Language files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgMSIniFile", "MS INI file|*.ini;*.inf;*.reg;*.url|A text in a file dialog indicating MS INI files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgInnoSetupScriptFile", "Inno Setup Script File|*.iss|A text in a file dialog indicating Inno Setup Script files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgJavaSourceFile", "Java source file|*.java|A text in a file dialog indicating Java source files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgJavaScriptFile", "Java script file|*.js|A text in a file dialog indicating Java script files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgJavaServerPagesFile", "JavaServer pages file|*.jsp|A text in a file dialog indicating JavaServer pages files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgKiXtartFile", "KiXtart file|*.kix|A text in a file dialog indicating KiXtart files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgListProcessingLanguageFile", "List Processing language file|*.lsp;*.lisp|A text in a file dialog indicating List Processing language files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgLuaSourceFile", "Lua source file|*.lua|A text in a file dialog indicating Lua source files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgMakeFile", "Makefile|*.mak|A text in a file dialog indicating Makefile files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgMATrixLABoratoryFile", "MATrix LABoratory file|*.m|A text in a file dialog indicating MATrix LABoratory files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgMSDOSStyleAsciiArtFile", "MSDOS Style/ASCII Art file|*.nfo|A text in a file dialog indicating MSDOS Style/ASCII Art file files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgNullsoftScriptableInstallSystemScriptFile", "Nullsoft Scriptable Install System script file|*.nsi;*.nsh|A text in a file dialog indicating Nullsoft Scriptable Install System script files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgPascalSourceFile", "Pascal source file|*.pas|A text in a file dialog indicating Pascal source files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgPerlSourceFile", "Perl source file|*.pl;*.pm;*.plx|A text in a file dialog indicating Perl source files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgPHPHypertextPreprocessorFile", "PHP Hypertext Preprocessor file|*.php;*.php3;*.phtml|A text in a file dialog indicating PHP Hypertext Preprocessor files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgPostScriptFile", "PostScript file|*.ps|A text in a file dialog indicating PostScript files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgWindowsPowerShellFile", "Windows PowerShell file|*.ps1;*.psm1|A text in a file dialog indicating Windows PowerShell files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgPropertiesFile", "Properties file|*.properties|A text in a file dialog indicating Properties files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgPythonFile", "Python file|*.py;*.pyw|A text in a file dialog indicating Python files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgRProgrammingLanguageFile", "R programming language file|*.r|A text in a file dialog indicating R programming language files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgWindowsResourceFile", "Windows resource file|*.rc|A text in a file dialog indicating Windows resource files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgRubyFile", "Ruby file|*.rb;*.rbw|A text in a file dialog indicating Ruby files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgSchemeFile", "Scheme file|*.scm;*.smd;*.ss|A text in a file dialog indicating Scheme files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgSmalltalkFile", "Smalltalk file|*.st|A text in a file dialog indicating Smalltalk files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgStructuredQueryLanguageFile", "Structured Query Language file|*.sql;*.sql_script|A text in a file dialog indicating Structured Query Language files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgToolCommandLanguageFile", "Tool Command Language file|*.tlc|A text in a file dialog indicating Tool Command Language files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgTeXFile", "TeX file|*.tex|A text in a file dialog indicating TeX files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgVisualBasicFile", "Visual Basic file|*.vb;*.vbs|A text in a file dialog indicating Visual Basic files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgVerilogFile", "Verilog file|*.vs;*.sv;*.vh;*.svh|A text in a file dialog indicating Verilog files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgVHSICHardwareDescriptionLanguageFile", "VHSIC Hardware Description Language file|*.vhd;*.vhdl|A text in a file dialog indicating VHSIC Hardware Description Language files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgeXtensibleMarkupLanguageFile", "eXtensible Markup Language file|*.xml;*.xsml;*.xls;*.xsd;*.kml;*.wsdl;*.xlf;*.xliff|A text in a file dialog indicating eXtensible Markup Language files");
     dialog.Filter += @"|" + DBLangEngine.GetStatMessage("msgYAMLFile", "YAML Ain't a Markup Language file|*.yml|A text in a file dialog indicating YAML Ain't a Markup Language files");
 }
Ejemplo n.º 23
0
 void MainInit()
 {
     Title = DBLangEngine.GetMessage("msgAboutTitle", "About - {0}|About as in about", AssemblyTitle);
     lbProductName.Content = AssemblyProduct;
     lbVersion.Content     = DBLangEngine.GetMessage("msgVersionText", "Version {0}|As in version", AssemblyVersion);
     lbCopyright.Content   = AssemblyCopyright;
     lbCompanyName.Content = AssemblyCompany;
     tbBoxDescription.Text = AssemblyDescription;
     btOK.Focus();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="FormDialogSearchReplaceProgressFiles"/> class. This is just for localization.
        /// </summary>
        public FormDialogSearchReplaceProgressFiles()
        {
            InitializeComponent();

            DBLangEngine.DBName = "lang.sqlite"; // Do the VPKSoft.LangLib == translation..

            if (Utils.ShouldLocalize() != null)
            {
                DBLangEngine.InitializeLanguage("ScriptNotepad.Localization.Messages", Utils.ShouldLocalize(), false);
            }
        }
 /// <summary>
 /// Handles the SearchProgress event of the SearchOpenDocuments control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="TextSearcherEventArgs"/> instance containing the event data.</param>
 private void SearchOpenDocuments_SearchProgress(object sender, TextSearcherEventArgs e)
 {
     // invocation is required as this is coming from another thread..
     pbMain.Invoke(new MethodInvoker(delegate { pbMain.Value = e.Percentage; }));
     lbProgressDesc.Invoke(new MethodInvoker(delegate
     {
         lbProgressDesc.Text = DBLangEngine.GetMessage("msgSearchProgress",
                                                       "File: {0}, Progress: {1}|A message describing a search or replace progress with a file name and a progress percentage",
                                                       e.FileName, e.Percentage);
     }));
 }
Ejemplo n.º 26
0
 private void FormDatabaseMigrate_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (FormMain.RestartRequired)
     {
         MessageBox.Show(
             DBLangEngine.GetMessage("msgSoftwareWillRestart",
                                     "The software will now restart for the changes to take affect.|A message informing the user that the software will restart for the changes to take affect."),
             DBLangEngine.GetMessage("msgInformation",
                                     "Information|Some information is given to the user, do add more definitive message to make some sense to the 'information'..."),
             MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
     }
 }
Ejemplo n.º 27
0
 void MainInit()
 {
     Text = DBLangEngine.GetMessage("msgAboutTitle", "About - {0}|About as in about", AssemblyTitle);
     lbProductName.Text               = AssemblyProduct;
     lbVersion.Text                   = DBLangEngine.GetMessage("msgVersionText", "Version {0}|As in version", AssemblyVersion);
     lbCopyright.Text                 = AssemblyCopyright;
     lbCompanyName.Text               = AssemblyCompany;
     tbBoxDescription.Text            = AssemblyDescription;
     tbBoxDescription.HideSelection   = true;
     tbBoxDescription.SelectionLength = 0;
     btOK.Focus();
 }
Ejemplo n.º 28
0
        /// <summary>
        /// Compiles the script in the view and outputs the compilation results.
        /// </summary>
        /// <returns>True if the compilation was successful; otherwise false.</returns>
        private bool Compile()
        {
            tbCompilerResults.Text = string.Empty; // clear the previous results..

            IScriptRunner scriptRunnerParent;

            if (SelectedScriptType == 0)
            {
                scriptRunnerParent = scriptRunnerText;
            }
            else if (SelectedScriptType == 1)
            {
                scriptRunnerParent = scriptRunnerLines;
            }
            else
            {
                tbCompilerResults.Text +=
                    DBLangEngine.GetMessage("msgScriptCompileFailed", "Compile failed.|A text to be shown if a script snippet compilation wasn't successful.") +
                    Environment.NewLine;
                return(false);
            }

            // set the script code from the Scintilla document contents..
            scriptRunnerParent.ScriptCode = scintillaScript.Text;

            if (scriptRunnerParent.CompileFailed)
            {
                // loop through the compilation results..
                tbCompilerResults.Text += scriptRunnerParent.CompileException?.Message + Environment.NewLine;

                Exception exception;

                while ((exception = scriptRunnerParent.CompileException?.InnerException) != null)
                {
                    tbCompilerResults.Text += exception.Message + Environment.NewLine;
                }
            }

            // no need to continue if the script compilation failed..
            if (scriptRunnerParent.CompileFailed)
            {
                tbCompilerResults.Text +=
                    DBLangEngine.GetMessage("msgScriptCompileFailed", "Compile failed.|A text to be shown if a script snippet compilation wasn't successful.") +
                    Environment.NewLine;
                return(false);
            }

            tbCompilerResults.Text +=
                DBLangEngine.GetMessage("msgScriptCompileSuccess", "Compile successful.|A text to be shown if a script snippet compilation was successful.") +
                Environment.NewLine;

            return(true);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FormSelectMovie"/> class.
        /// </summary>
        public FormSelectMovie()
        {
            InitializeComponent();

            DBLangEngine.DBName = "lang.sqlite"; // Do the VPKSoft.LangLib == translation..

            if (VPKSoft.LangLib.Utils.ShouldLocalize() != null)
            {
                DBLangEngine.InitalizeLanguage("vamp.Messages", VPKSoft.LangLib.Utils.ShouldLocalize(), false);
                return; // After localization don't do anything more..
            }
        }
Ejemplo n.º 30
0
        private void FormSettings_Shown(object sender, EventArgs e)
        {
            SettingsLoading      = true;
            cbQuietHours.Checked = Program.Settings.QuietHours;

            dtpFrom.Value = DateTime.ParseExact(Program.Settings.QuietHoursFrom, "HH':'mm", CultureInfo.InvariantCulture);
            dtpTo.Value   = DateTime.ParseExact(Program.Settings.QuietHoursTo, "HH':'mm", CultureInfo.InvariantCulture);
            nudQuietHourPercentage.Value       = (decimal)Program.Settings.QuietHoursVolPercentage;
            rbPauseQuiet.Checked               = true;
            rbPauseQuiet.Checked               = Program.Settings.QuietHoursPause;
            rbDecreaseVolumeQuietHours.Checked = !rbPauseQuiet.Checked;

            nudBarAmount.Value = Program.Settings.BarAmount < 20 ? 92 : Program.Settings.BarAmount;

            tbStackQueueRandom.Value = Program.Settings.StackRandomPercentage;

            switch (Program.Settings.AudioVisualizationStyle)
            {
            case 0: rbAudioVisualizationOff.Checked = true; break;

            case 1: rbAudioVisualizationBars.Checked = true; break;

            case 2: rbAudioVisualizationLines.Checked = true; break;

            default: rbAudioVisualizationOff.Checked = true; break;
            }

            nudAudioVisualizationSize.Value = Program.Settings.AudioVisualizationVisualPercentage;

            cbAudioVisualizationCombineChannels.Checked = Program.Settings.AudioVisualizationCombineChannels;
            cbBalancedBars.Checked = Program.Settings.BalancedBars;

            // the user decides if an internet request is allowed..
            cbCheckUpdatesStartup.Checked = Program.Settings.AutoCheckUpdates;

            cbHideAlbumImage.Checked = Program.Settings.AutoHideAlbumImage;

            List <CultureInfo> cultures = DBLangEngine.GetLocalizedCultures();

            if (cultures != null)
            {
                // ReSharper disable once CoVariantArrayConversion
                cmbSelectLanguageValue.Items.AddRange(cultures.ToArray());
            }
            cmbSelectLanguageValue.SelectedItem = Program.Settings.Culture;

            cbDisplayVolumeAndPoints.Checked = Program.Settings.DisplayVolumeAndPoints;
            cbRestEnabled.Checked            = Program.Settings.RestApiEnabled;

            nudRestPort.Value = Program.Settings.RestApiPort == 0 ? 11316 : Program.Settings.RestApiPort;

            SettingsLoading = false;
        }