コード例 #1
0
 public void NotifyThemeChange()
 {
     QueueMessage msg = new QueueMessage();
       msg.MessageData["action"] = "themechanged";
       IMessageQueue queue = ServiceScope.Get<IMessageBroker>().GetOrCreate("message");
       queue.Send(msg);
 }
コード例 #2
0
 public void Send(QueueMessage message)
 {
     message.MessageQueue = this;
       foreach (IMessageFilter filter in _filters)
       {
     message = filter.Process(message);
     if (message == null) return;
       }
       if (OnMessageReceive != null)
       {
     OnMessageReceive(message);
       }
 }
コード例 #3
0
        /// <summary>
        ///   Handle Messages
        /// </summary>
        /// <param name = "message"></param>
        private void OnMessageReceive(QueueMessage message)
        {
            string action = message.MessageData["action"] as string;

              switch (action.ToLower())
              {
            case "customgenresrefreshed":
              cbGenre.Items.Clear();
              cbGenre.Items.AddRange(Genres.Audio);
              foreach (string customGenre in Options.MainSettings.CustomGenres)
              {
            cbGenre.Items.Add(customGenre);
              }
              break;
              }
        }
コード例 #4
0
ファイル: Util.cs プロジェクト: Erls-Corporation/MPTagThat
 /// <summary>
 /// Sends a Progress Message, so that the status bar can be updated
 /// </summary>
 /// <param name="message"></param>
 public static void SendProgress(string message)
 {
     QueueMessage msg = new QueueMessage();
       msg.MessageData["action"] = "statusprogress";
       msg.MessageData["data"] = message;
       IMessageQueue msgQueue = ServiceScope.Get<IMessageBroker>().GetOrCreate("message");
       msgQueue.Send(msg);
 }
コード例 #5
0
ファイル: Main.cs プロジェクト: MustafaUzumcuCom/MPTagThat
        /// <summary>
        ///   Handle Messages
        /// </summary>
        /// <param name = "message"></param>
        private void OnMessageReceive(QueueMessage message)
        {
            string action = message.MessageData["action"] as string;

              switch (action.ToLower())
              {
            // Message sent, when a Theme is changing
            case "themechanged":
              {
            SetRibbonColorBase();
            textBoxPresetDesc.BackColor = ServiceScope.Get<IThemeManager>().CurrentTheme.BackColor;
            textBoxPresetDesc.ForeColor = ServiceScope.Get<IThemeManager>().CurrentTheme.LabelForeColor;
            treeViewKeys.BackColor = ServiceScope.Get<IThemeManager>().CurrentTheme.BackColor;
            treeViewKeys.ForeColor = ServiceScope.Get<IThemeManager>().CurrentTheme.LabelForeColor;
            break;
              }

            case "languagechanged":
              {
            LanguageChanged();
            Refresh();
            break;
              }
              }
        }
コード例 #6
0
        /// <summary>
        ///   Handle Messages
        /// </summary>
        /// <param name = "message"></param>
        private void OnMessageReceive(QueueMessage message)
        {
            string action = message.MessageData["action"] as string;

              switch (action.ToLower())
              {
            case "languagechanged":
              LanguageChanged();
              Refresh();
              break;

            case "themechanged":
              {
            tracksGrid.BackgroundColor = ServiceScope.Get<IThemeManager>().CurrentTheme.BackColor;
            break;
              }
              }
        }
コード例 #7
0
        /// <summary>
        ///   Handle Messages from the Audio Encoder
        /// </summary>
        /// <param name = "message"></param>
        private void OnMessageReceiveEncoding(QueueMessage message)
        {
            if (_currentRow < 0)
            return;

              double percentComplete = (double)message.MessageData["progress"];
              dataGridViewConvert.Rows[_currentRow].Cells[0].Value = (int)percentComplete;
              dataGridViewConvert.Update();
              Application.DoEvents();
        }
コード例 #8
0
        /// <summary>
        ///   Handle Messages
        /// </summary>
        /// <param name = "message"></param>
        private void OnMessageReceive(QueueMessage message)
        {
            string action = message.MessageData["action"] as string;

              switch (action.ToLower())
              {
            case "themechanged":
              {
            SetColorBase();
            break;
              }

            case "languagechanged":
              {
            Refresh();
            break;
              }
              }
        }
コード例 #9
0
        /// <summary>
        ///   Handle Messages
        /// </summary>
        /// <param name = "message"></param>
        private void OnMessageReceive(QueueMessage message)
        {
            string action = message.MessageData["action"] as string;

              switch (action.ToLower())
              {
              // Message sent, when a Theme is changing
            case "themechanged":
              {
            BackColor = ServiceScope.Get<IThemeManager>().CurrentTheme.BackColor;
            playListGrid.BackgroundColor = ServiceScope.Get<IThemeManager>().CurrentTheme.BackColor;
            playListGrid.DefaultCellStyle.BackColor = ServiceScope.Get<IThemeManager>().CurrentTheme.BackColor;
            playListGrid.DefaultCellStyle.ForeColor = ServiceScope.Get<IThemeManager>().CurrentTheme.LabelForeColor;
            playListGrid.DefaultCellStyle.SelectionForeColor = Color.OrangeRed;
            playListGrid.DefaultCellStyle.SelectionBackColor = ServiceScope.Get<IThemeManager>().CurrentTheme.BackColor;
            playListGrid.GridColor = ServiceScope.Get<IThemeManager>().CurrentTheme.BackColor;
            break;
              }

            case "languagechanged":
              {
            Localisation();
            break;
              }
              }
        }
コード例 #10
0
        /// <summary>
        ///   Handle Messages
        /// </summary>
        /// <param name = "message"></param>
        private void OnMessageReceive(QueueMessage message)
        {
            string action = message.MessageData["action"] as string;

              switch (action.ToLower())
              {
              // Message sent, when a Theme is changing
            case "themechanged":
              {
            if (ServiceScope.Get<IThemeManager>().CurrentTheme.ThemeName == _currentTheme)
            {
              return;
            }

            _currentTheme = ServiceScope.Get<IThemeManager>().CurrentTheme.ThemeName;
            string imageDir = Path.Combine(Application.StartupPath, "Themes\\" + _currentTheme);
            _imgPlay = Image.FromFile(Path.Combine(imageDir, "Play_btn.png"));
            _imgPause = Image.FromFile(Path.Combine(imageDir, "Pause_btn.png"));
            break;
              }
              }
        }
コード例 #11
0
ファイル: Main.cs プロジェクト: nus-ii/MPTagThat
        /// <summary>
        ///   Apply the Changes to the Options
        /// </summary>
        /// <param name = "sender"></param>
        /// <param name = "e"></param>
        private void buttonSettingsApply_Click(object sender, EventArgs e)
        {
            log.Trace(">>>");
              bool bErrors = false;
              string message = "";

              #region General

              string currentLanguage = ServiceScope.Get<ILocalisation>().CurrentCulture.Name;
              string selectedLanguage = (string)(comboBoxLanguage.SelectedItem as Item).Value;

              // Notify about language change
              if (currentLanguage != selectedLanguage)
            ServiceScope.Get<ILocalisation>().ChangeLanguage(selectedLanguage);

              Options.MainSettings.Theme = comboBoxThemes.SelectedIndex;
              Options.MainSettings.DebugLevel = comboBoxDebugLevel.Text;
              ServiceScope.Get<ILogger>().Level = NLog.LogLevel.FromString(Options.MainSettings.DebugLevel);

              if (SaveKeyMap())
            ServiceScope.Get<IActionHandler>().LoadKeyMap();

              #endregion

              #region Ripping

              Options.MainSettings.RipEncoder = (string)(comboBoxEncoder.SelectedItem as Item).Value;
              Options.MainSettings.RipTargetFolder = tbTargetFolder.Text;
              Options.MainSettings.RipEjectCD = ckRipEjectCD.Checked;
              Options.MainSettings.RipActivateTargetFolder = ckActivateTargetFolder.Checked;

              if (!Util.CheckParameterFormat(textBoxRippingFilenameFormat.Text, Options.ParameterFormat.RipFileName))
              {
            message += localisation.ToString("settings", "InvalidParm") + "\r\n";
            bErrors = true;
              }
              else
            Options.MainSettings.RipFileNameFormat = textBoxRippingFilenameFormat.Text;

              // MP3 Encoder Settings
              Options.MainSettings.RipLamePreset = comboBoxLamePresets.SelectedIndex;
              try
              {
            Options.MainSettings.RipLameABRBitRate = comboBoxLamePresets.SelectedIndex == 4
                                                   ? Convert.ToInt32(textBoxABRBitrate.Text)
                                                   : 0;
              }
              catch (FormatException) { }
              Options.MainSettings.RipLameExpert = textBoxLameParms.Text.Trim();

              // Ogg Encoder Settings
              Options.MainSettings.RipOggQuality = hScrollBarOggEncodingQuality.Value;
              Options.MainSettings.RipOggExpert = textBoxOggParms.Text.Trim();

              // Flac Encoder Settings
              Options.MainSettings.RipFlacQuality = hScrollBarFlacEncodingQuality.Value;
              Options.MainSettings.RipFlacExpert = textBoxFlacParms.Text.Trim();

              // AAC Encoder Settings
              Options.MainSettings.RipEncoderAACBitRate = comboBoxAACBitrates.SelectedItem != null
                                                    ? comboBoxAACBitrates.SelectedItem.ToString()
                                                    : "";
              // WMA Encoder Settings
              Options.MainSettings.RipEncoderWMA = (string)(comboBoxWMAEncoderFormat.SelectedItem as Item).Value;
              Options.MainSettings.RipEncoderWMASample = (string)(comboBoxWMASampleFormat.SelectedItem as Item).Value;
              Options.MainSettings.RipEncoderWMACbrVbr = (string)(comboBoxWMACbrVbr.SelectedItem as Item).Value;
              Options.MainSettings.RipEncoderWMABitRate = comboBoxWMABitRate.SelectedItem.ToString();

              // MPC Encoder Settings
              Options.MainSettings.RipEncoderMPCPreset = (string)(comboBoxMPCPresets.SelectedItem as Item).Value;
              Options.MainSettings.RipEncoderMPCExpert = textBoxMPCParms.Text.Trim();

              // WV Encoder Settings
              Options.MainSettings.RipEncoderWVPreset = (string)(comboBoxWVPresets.SelectedItem as Item).Value;
              Options.MainSettings.RipEncoderWVExpert = textBoxWVParms.Text.Trim();

              #endregion

              #region Tags

              Options.MainSettings.CharacterEncoding = comboBoxCharacterEncoding.SelectedIndex;
              Options.MainSettings.CopyArtist = ckCopyArtistToAlbumArtist.Checked;
              Options.MainSettings.AutoFillNumberOfTracks = ckAutoFillNumberOfTracks.Checked;
              Options.MainSettings.UseCaseConversion = ckUseCaseConversionWhenSaving.Checked;
              Options.MainSettings.ChangeReadOnlyAttributte = ckChangeReadonlyAttributte.Checked;
              Options.MainSettings.CreateFolderThumb = ckCreateMissingFolderThumb.Checked;
              Options.MainSettings.EmbedFolderThumb = ckUseExistinbgThumb.Checked;
              Options.MainSettings.OverwriteExistingCovers = ckOverwriteExistingCovers.Checked;
              Options.MainSettings.OnlySaveFolderThumb = ckOnlySaveFolderThumb.Checked;
              Options.MainSettings.ChangeCoverSize = ckChangeCoverSize.Checked;
              Options.MainSettings.MaxCoverWidth = Convert.ToInt32(tbCoverSize.Text);
              Options.MainSettings.OverwriteExistingLyrics = ckOverwriteExistingLyrics.Checked;
              Options.MainSettings.ClearUserFrames = ckClearUserFramesOnSave.Checked;
              Options.MainSettings.MP3Validate = ckValidateMP3.Checked;
              Options.MainSettings.MP3AutoFix = ckAutoFixMp3.Checked;

              if (ckUseMediaPortalDatabase.Checked && System.IO.File.Exists(tbMediaPortalDatabase.Text))
              {
            Options.MainSettings.UseMediaPortalDatabase = true;
            Options.MainSettings.MediaPortalDatabase = tbMediaPortalDatabase.Text;
              }
              else
              {
            Options.MainSettings.UseMediaPortalDatabase = false;
            Options.MainSettings.MediaPortalDatabase = "";
              }

              if (radioButtonUseV3.Checked)
            Options.MainSettings.ID3V2Version = 3;
              else if (radioButtonUseV4.Checked)
            Options.MainSettings.ID3V2Version = 4;
              else
            Options.MainSettings.ID3V2Version = 0; // APE Support

              if (radioButtonID3V1.Checked)
            Options.MainSettings.ID3Version = 1;
              else if (radioButtonID3V2.Checked)
            Options.MainSettings.ID3Version = 2;
              else
            Options.MainSettings.ID3Version = 3;

              Options.MainSettings.RemoveID3V1 = checkBoxRemoveID3V1.Checked;
              Options.MainSettings.RemoveID3V2 = checkBoxRemoveID3V2.Checked;

              var lyricsSites = new List<string>();
              foreach (ListViewItem lyricsSite in listViewLyricsSites.Items)
              {
            if (lyricsSite.Checked)
            {
              lyricsSites.Add(lyricsSite.Text);
            }
              }
              Options.MainSettings.LyricSites = lyricsSites;

              Options.MainSettings.CustomGenres.Clear();
              foreach (ListViewItem item in listViewCustomGenres.Items)
              {
            Options.MainSettings.CustomGenres.Add(item.Text);
              }

              // Tell the Tag Ediit Control to refresh the Custom Genres
              QueueMessage msg = new QueueMessage();
              msg.MessageData["action"] = "customgenresrefreshed";
              IMessageQueue msgQueue = ServiceScope.Get<IMessageBroker>().GetOrCreate("message");
              msgQueue.Send(msg);

              Options.MainSettings.SwitchArtist = ckSwitchArtist.Checked;
              Options.MainSettings.AmazonSite = (string)(comboBoxAmazonSite.SelectedItem as Item).Value;

              #endregion

              if (bErrors)
              {
            MessageBox.Show(message, localisation.ToString("message", "Error_Title"), MessageBoxButtons.OK);
              }
              else
              {
            Options.SaveAllSettings();
            this.backstageView.Visible = false;
              }
              log.Trace("<<<");
        }
コード例 #12
0
        /// <summary>
        ///   Handle Messages
        /// </summary>
        /// <param name = "message"></param>
        private void OnMessageReceive(QueueMessage message)
        {
            string action = message.MessageData["action"] as string;

              switch (action.ToLower())
              {
            case "languagechanged":
              {
            LocaliseScreen();
            Refresh();
            break;
              }

            case "themechanged":
              {
            dataGridViewTagFilter.BackgroundColor = ServiceScope.Get<IThemeManager>().CurrentTheme.BackColor;
            treeViewFolderBrowser.BackColor = ServiceScope.Get<IThemeManager>().CurrentTheme.BackColor;
            treeViewFolderBrowser.ForeColor = ServiceScope.Get<IThemeManager>().CurrentTheme.LabelForeColor;
            break;
              }
              }
        }
コード例 #13
0
        public void ChangeLanguage(string cultureName)
        {
            if (!_availableLanguages.ContainsKey(cultureName))
            throw new ArgumentException("Language not available");

              _currentLanguage = _availableLanguages[cultureName];

              ReloadAll();

              QueueMessage msg = new QueueMessage();
              msg.MessageData["action"] = "languagechanged";
              IMessageQueue queue = ServiceScope.Get<IMessageBroker>().GetOrCreate("message");
              queue.Send(msg);
        }
コード例 #14
0
ファイル: Util.cs プロジェクト: MediaPortal/MPTagThat
 /// <summary>
 /// Sends a message
 /// </summary>
 /// <param name="action"></param>
 /// <param name="data"></param>
 public static void SendMessage(string action, string data)
 {
     QueueMessage msg = new QueueMessage();
       msg.MessageData["action"] = action;
       msg.MessageData["data"] = data;
       IMessageQueue msgQueue = ServiceScope.Get<IMessageBroker>().GetOrCreate("message");
       msgQueue.Send(msg);
 }
コード例 #15
0
        /// <summary>
        ///   Handle Messages from the Audio Encoder
        /// </summary>
        /// <param name = "message"></param>
        private void OnMessageReceiveEncoding(QueueMessage message)
        {
            if (!_conversionActive)
              {
            return; // Prevent collision with Rip
              }

              if (InvokeRequired)
              {
            ThreadSafeMessageDelegate d = OnMessageReceiveEncoding;
            Invoke(d, new object[] { message });
            return;
              }

              string action = message.MessageData["action"] as string;
              int rowIndex = (int)message.MessageData["rowindex"];

              if (action != null)
            switch (action.ToLower())
            {
              case "progress":
            double percentComplete = (double)message.MessageData["percent"];
            dataGridViewConvert.Rows[rowIndex].Cells[0].Value = (int)percentComplete;
            break;

              case "newfilename":
            _bindingList[rowIndex].NewFileName = (string)message.MessageData["filename"];
            dataGridViewConvert.Refresh();
            break;

              case "error":
              {
            dataGridViewConvert.Rows[rowIndex].Cells[0].Value = (string)message.MessageData["error"];
            dataGridViewConvert.Rows[rowIndex].Cells[0].ToolTipText = (string)message.MessageData["tooltip"];
            break;
              }
            }

              dataGridViewConvert.Update();
              Application.DoEvents();
        }
コード例 #16
0
ファイル: GridViewRip.cs プロジェクト: MediaPortal/MPTagThat
        /// <summary>
        ///   Handle Messages from the Audio Encoder
        /// </summary>
        /// <param name = "message"></param>
        private void OnMessageReceiveEncoding(QueueMessage message)
        {
            if (_currentRow < 0)
            return;

            string action = message.MessageData["action"] as string;

            if (action != null)
                switch (action.ToLower())
                {
                    case "progress":
                        double percentComplete = (double)message.MessageData["percent"];
                        dataGridViewRip.Rows[_currentRow].Cells[1].Value = (int)percentComplete;
                        break;
                }

              dataGridViewRip.Update();
              Application.DoEvents();
        }