public MiscInfoControl() { // Activates double buffering this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); this.UpdateStyles(); InitializeComponent(); // Listen to Messages IMessageQueue queueMessage = ServiceScope.Get <IMessageBroker>().GetOrCreate("message"); queueMessage.OnMessageReceive += OnMessageReceive; // Setup Non-Music ListView listViewNonMusicFiles.View = View.LargeIcon; listViewNonMusicFiles.ShowItemToolTips = true; listViewNonMusicFiles.LabelEdit = true; listViewNonMusicFiles.FullRowSelect = true; listViewNonMusicFiles.GridLines = true; listViewNonMusicFiles.Sorting = SortOrder.Ascending; // Build the Context Menu for the Non Music Files Listview MenuItem[] nonMusicMenuitems = new MenuItem[2]; nonMusicMenuitems[0] = new MenuItem(); nonMusicMenuitems[0].Text = localisation.ToString("main", "NonMusicContextMenuRenameToFolderJpg"); nonMusicMenuitems[0].Click += listViewNonMusicFiles_RenameToFolderJpg; nonMusicMenuitems[0].DefaultItem = true; nonMusicMenuitems[1] = new MenuItem(); nonMusicMenuitems[1].Text = localisation.ToString("main", "NonMusicContextMenuDeleteFiles"); nonMusicMenuitems[1].Click += listViewNonMusicFiles_DeleteFiles; listViewNonMusicFiles.ContextMenu = new ContextMenu(nonMusicMenuitems); }
/// <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; } } }
public About() { InitializeComponent(); lbWikiLink.Text = Options.HelpLocation; lbLinkForum.Text = Options.ForumLocation; BackColor = ServiceScope.Get <IThemeManager>().CurrentTheme.BackColor; lbWikiLink.LinkColor = ServiceScope.Get <IThemeManager>().CurrentTheme.LabelForeColor; lbLinkForum.LinkColor = ServiceScope.Get <IThemeManager>().CurrentTheme.LabelForeColor; tbDescription.BackColor = ServiceScope.Get <IThemeManager>().CurrentTheme.BackColor; tbDescription.ForeColor = ServiceScope.Get <IThemeManager>().CurrentTheme.LabelForeColor; tbContributors.BackColor = ServiceScope.Get <IThemeManager>().CurrentTheme.BackColor; tbContributors.ForeColor = ServiceScope.Get <IThemeManager>().CurrentTheme.LabelForeColor; ServiceScope.Get <IThemeManager>().NotifyThemeChange(); LocaliseScreen(); Assembly assembly = Assembly.GetExecutingAssembly(); AssemblyName assemblyName = assembly.GetName(); Version version = assemblyName.Version; lbVersionDetail.Text = version.ToString(); DateTime lastWrite = File.GetLastWriteTime(assembly.Location); lbDate.Text = string.Format("{0} {1}", lastWrite.ToShortDateString(), lastWrite.ToShortTimeString()); }
public PlayerControl() { // Activates double buffering this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); this.UpdateStyles(); InitializeComponent(); IMessageQueue queueMessage = ServiceScope.Get <IMessageBroker>().GetOrCreate("message"); queueMessage.OnMessageReceive += OnMessageReceive; // Retrieve the default Sound device BASS_DEVICEINFO info; for (int i = 0; (info = Bass.BASS_GetDeviceInfo(i)) != null; i++) { if (info.IsDefault) { _defaultSoundDevice = i; break; } } }
/// <summary> /// Checks if the specified language is a right to left one and commits the necessairy actions. /// </summary> private void CheckRightToLeft() { _rightToLeft = ServiceScope.Get <ILocalisation>().CurrentCulture.TextInfo.IsRightToLeft; if (_rightToLeft) { RightToLeft = System.Windows.Forms.RightToLeft.Yes; _treeSections.RightToLeft = System.Windows.Forms.RightToLeft.Yes; _treeSections.RightToLeftLayout = true; _picSectionIcon.Location = new Point(5, 5); _lblSectionTitle.Size = new Size(_sectionHeader.Size.Width - _picSectionIcon.Size.Width - 5, 16); _lblSectionTitle.Location = new Point(_picSectionIcon.Size.Width + 5, 22); } else { RightToLeft = System.Windows.Forms.RightToLeft.No; _treeSections.RightToLeft = System.Windows.Forms.RightToLeft.No; _treeSections.RightToLeftLayout = false; _picSectionIcon.Location = new Point(_sectionHeader.Size.Width - _picSectionIcon.Size.Width - 5, 5); _lblSectionTitle.Size = new Size(_sectionHeader.Size.Width - _picSectionIcon.Size.Width - 5, 16); _lblSectionTitle.Location = new Point(0, 22); } }
/// <summary> /// Initializes a new instance of SettingsControl, which is used to dynamically build all configuration options. /// </summary> public SettingsControl() { InitializeComponent(); // localise buttons IResourceString save = LocalizationHelper.CreateLabelProperty("[configuration.settings.button.save]"); _btnSave.Tag = save; _btnSave.Text = save.Evaluate(); _btnSave.Enabled = false; IResourceString apply = LocalizationHelper.CreateLabelProperty("[configuration.settings.button.apply]"); _btnApply.Tag = apply; _btnApply.Text = apply.Evaluate(); _btnApply.Enabled = false; _treeSections.ImageList = new ImageList(); _treeSections.ImageList.ColorDepth = ColorDepth.Depth32Bit; _treeSections.ImageList.TransparentColor = Color.Transparent; _treeSections.ImageList.ImageSize = new Size(22, 22); LoadSections(); ServiceScope.Get <ILocalisation>().LanguageChange += LanguageChange; CheckRightToLeft(); }
public GridViewConvert(Main main) { _main = main; InitializeComponent(); // Listen to Messages // Setup message queue for receiving Messages IMessageQueue queueMessage = ServiceScope.Get <IMessageBroker>().GetOrCreate("message"); queueMessage.OnMessageReceive += OnMessageReceive; IMessageQueue queueMessageEncoding = ServiceScope.Get <IMessageBroker>().GetOrCreate("encoding"); queueMessageEncoding.OnMessageReceive += OnMessageReceiveEncoding; audioEncoder = ServiceScope.Get <IAudioEncoder>(); // Load the Settings gridColumns = new GridViewColumnsConvert(); dataGridViewConvert.AutoGenerateColumns = false; dataGridViewConvert.DataSource = bindingList; // Now Setup the columns, we want to display CreateColumns(); CreateContextMenu(); }
public GridViewBurn(Main main) { _main = main; // Setup message queue for receiving Messages IMessageQueue queueMessage = ServiceScope.Get <IMessageBroker>().GetOrCreate("message"); queueMessage.OnMessageReceive += OnMessageReceive; InitializeComponent(); _main.BurnButtonsEnabled = false; // Create the Temp Directory for the burner if (!Directory.Exists(tmpBurnDirectory)) { Directory.CreateDirectory(tmpBurnDirectory); } // Load the Settings gridColumns = new GridViewColumnsBurn(); dataGridViewBurn.AutoGenerateColumns = false; dataGridViewBurn.DataSource = bindingList; // Now Setup the columns, we want to display CreateColumns(); CreateContextMenu(); lbBurningStatus.Text = localisation.ToString("Burning", "DragAndDrop"); // "Use Drag & Drop to order the tracks for burning"; }
private void txtSearch_TextChanged(object sender, EventArgs e) { _treeSections.Nodes.Clear(); if (_txtSearch.Text == "") { LoadSections(); _txtSearch.Tag = null; _btnSearch.Tag = null; } else { SearchResult searchResult = ServiceScope.Get <IConfigurationManager>().Search(_txtSearch.Text); if (searchResult.BestMatch != null) { _txtSearch.Tag = searchResult.BestMatch; _btnSearch.Tag = searchResult.BestMatch; LoadSections(searchResult.Matches, _treeSections.Nodes); ExpandNodeSection(searchResult.BestMatch.Location, true); } else { _panelSectionSettings.Controls.Clear(); // Clear the old bestNode _lblSectionTitle.Text = "MediaPortal 2"; } } }
public ColumnSelect(GridViewTracks grid) { InitializeComponent(); this.grid = grid; BackColor = ServiceScope.Get <IThemeManager>().CurrentTheme.BackColor; ServiceScope.Get <IThemeManager>().NotifyThemeChange(); }
public MPTTabPage() { themeManager = ServiceScope.Get <IThemeManager>(); // Setup message queue for receiving Messages IMessageQueue queueMessage = ServiceScope.Get <IMessageBroker>().GetOrCreate("message"); queueMessage.OnMessageReceive += OnMessageReceive; }
public FreeDBMultiCDSelect() { InitializeComponent(); BackColor = ServiceScope.Get <IThemeManager>().CurrentTheme.BackColor; ServiceScope.Get <IThemeManager>().NotifyThemeChange(); Text = localisation.ToString("FreeDB", "Header"); }
public PlayList(PlayerControl player) { _player = player; InitializeComponent(); IMessageQueue queueMessage = ServiceScope.Get <IMessageBroker>().GetOrCreate("message"); queueMessage.OnMessageReceive += OnMessageReceive; }
public MPTButton() { themeManager = ServiceScope.Get <IThemeManager>(); // Setup message queue for receiving Messages IMessageQueue queueMessage = ServiceScope.Get <IMessageBroker>().GetOrCreate("message"); queueMessage.OnMessageReceive += OnMessageReceive; UseVisualStyleBackColor = true; }
/// <summary> /// A Search is performed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btSearch_Click(object sender, EventArgs e) { _artist = tbArtist.Text; _album = tbAlbum.Text; lvSearchResults.Items.Clear(); imagelist.Images.Clear(); _albums.Clear(); groupBoxAmazonMultipleAlbums.Text = ServiceScope.Get <ILocalisation>().ToString("AmazonAlbumSearch", "Searching"); groupBoxAmazonMultipleAlbums.Refresh(); DoSearchAlbum(); }
static MPTWinControlsCommon() { try { localisation = ServiceScope.Get <ILocalisation>(); } catch (ServiceNotFoundException) { localisation = null; } }
/// <summary> /// Loads all configuration data to the treeview "sections". /// </summary> private void LoadSections() { IConfigurationManager manager = ServiceScope.Get <IConfigurationManager>(); IEnumerable <ConfigSection> sections = GetSections(manager, "/"); foreach (ConfigSection section in sections) { TreeNode node = CreateTreeNode(section); LoadSections(manager, section.Metadata.Id, node.Nodes); _treeSections.Nodes.Add(node); } }
public ArtistAlbumDialog() { InitializeComponent(); BackColor = ServiceScope.Get <IThemeManager>().CurrentTheme.BackColor; ServiceScope.Get <IThemeManager>().NotifyThemeChange(); labelHeader.ForeColor = ServiceScope.Get <IThemeManager>().CurrentTheme.FormHeaderForeColor; labelHeader.Font = ServiceScope.Get <IThemeManager>().CurrentTheme.FormHeaderFont; LocaliseScreen(); }
/// <summary> /// Init Service Thread /// </summary> private static void DoInitService() { ServiceScope.Get <ILogger>().GetLogger.Debug("Registering Script Manager"); ServiceScope.Add <IScriptManager>(new ScriptManager()); ServiceScope.Get <ILogger>().GetLogger.Debug("Registering Audio Encoder"); ServiceScope.Add <IAudioEncoder>(new AudioEncoder()); ServiceScope.Get <ILogger>().GetLogger.Debug("Registering Media Change Monitor"); ServiceScope.Add <IMediaChangeMonitor>(new MediaChangeMonitor()); ServiceScope.Get <ILogger>().GetLogger.Info("Finished registering services"); }
public async Task Basic() { ServiceProvider provider = new ServiceProvider(); { ServiceScope scope = await provider.CreateScope("a"); Assert.AreEqual("a", scope.Name); Assert.IsFalse(scope.TryGet <object>(out _)); scope.Add("str"); Assert.AreEqual("str", scope.Get <string>()); Assert.AreEqual("a", scope.GetSource <string>()); scope.Add("str-id", "id"); Assert.AreEqual("str-id", scope.Get <string>("id")); scope.Remove <string>(); Assert.IsFalse(scope.TryGet <string>(out _)); Assert.IsTrue(scope.TryGet <string>(out _, "id")); scope.Replace(0); Assert.AreEqual(0, scope.Get <int>()); scope.Replace(1); Assert.AreEqual(1, scope.Get <int>()); scope.Add(1.2); scope.Remove <double>(); } { ServiceScope scope = await provider.CreateScope("b"); Assert.AreEqual("b", scope.Name); Assert.IsFalse(scope.TryGet <object>(out _)); Assert.AreEqual("str-id", scope.Get <string>("id")); Assert.AreEqual(1, scope.Get <int>()); } }
public bool FileImport(string filePath) { try { if (String.IsNullOrEmpty(filePath)) { return(false); } if (filePath.ToLower().IndexOf("folder.jpg") >= 0) { return(false); } string fName = System.IO.Path.GetFileName(filePath); if (fName.ToLower().StartsWith("albumart")) { return(false); } string ext = System.IO.Path.GetExtension(filePath).ToLower(); if (!_extensions.Contains(ext)) { return(false); } try { Query imageByFilename = new Query("contentURI", Operator.Same, filePath); IList <IDbItem> result = _pictureDatabase.Query(imageByFilename); if (result.Count > 0) { return(false); } } catch (Exception) { return(false); } IDbItem picture = GetExifFor(filePath); if (picture == null) { return(false); } picture.Save(); return(true); } catch (Exception ex) { ServiceScope.Get <ILogger>().Info("pictureimporter:error ImportFile:{0}", filePath); ServiceScope.Get <ILogger>().Error(ex); return(false); } }
public GridViewRip(Main main) { _main = main; // Setup message queue for receiving Messages IMessageQueue queueMessage = ServiceScope.Get <IMessageBroker>().GetOrCreate("message"); queueMessage.OnMessageReceive += OnMessageReceive; InitializeComponent(); dataGridViewRip.CurrentCellDirtyStateChanged += dataGridViewRip_CurrentCellDirtyStateChanged; // Listen to Messages IMessageQueue queueMessageEncoding = ServiceScope.Get <IMessageBroker>().GetOrCreate("encoding"); queueMessageEncoding.OnMessageReceive += OnMessageReceiveEncoding; audioEncoder = ServiceScope.Get <IAudioEncoder>(); mediaChangeMonitor = ServiceScope.Get <IMediaChangeMonitor>(); mediaChangeMonitor.MediaInserted += mediaChangeMonitor_MediaInserted; mediaChangeMonitor.MediaRemoved += mediaChangeMonitor_MediaRemoved; // Get number of CD Drives found and initialise a Bindinglist for every drove int driveCount = BassCd.BASS_CD_GetDriveCount(); if (driveCount == 0) { bindingList.Add(new SortableBindingList <CDTrackDetail>()); // In case of no CD, we want a Dummy List } _main.RipButtonsEnabled = false; for (int i = 0; i < driveCount; i++) { bindingList.Add(new SortableBindingList <CDTrackDetail>()); if (BassCd.BASS_CD_IsReady(i)) { _main.RipButtonsEnabled = true; } } // Prepare the Gridview gridColumns = new GridViewColumnsRip(); dataGridViewRip.AutoGenerateColumns = false; dataGridViewRip.DataSource = bindingList[0]; // Now Setup the columns, we want to display CreateColumns(); SetStatusLabel(""); }
public MusicBrainzAlbumResults(List <MusicBrainzTrack> tracks) { InitializeComponent(); BackColor = ServiceScope.Get <IThemeManager>().CurrentTheme.BackColor; ServiceScope.Get <IThemeManager>().NotifyThemeChange(); Text = ServiceScope.Get <ILocalisation>().ToString("MusicBrainz", "Header"); chAlbum.Text = ServiceScope.Get <ILocalisation>().ToString("MusicBrainz", "Album"); chDuration.Text = ServiceScope.Get <ILocalisation>().ToString("MusicBrainz", "Duration"); this.tracks = tracks; FillResults(); }
private void LoadSettings() { _settings = new GridViewSettings(); _settings.Name = "Tracks"; ServiceScope.Get <ISettingsManager>().Load(_settings); if (_settings.Columns.Count == 0) { // Setup the Default Columns to display on first use of the program List <GridViewColumn> columnList = new List <GridViewColumn>(); columnList = SetDefaultColumns(); _settings.Columns.Clear(); foreach (GridViewColumn column in columnList) { _settings.Columns.Add(column); } ServiceScope.Get <ISettingsManager>().Save(_settings); } else { // Add / Reorder Columns that have been added after Release, so that the settings don't need to be deleted // Reorder the Status field if (_settings.Columns[0].Name != "Status") { // We still have an old setting with Status at position 1 _settings.Columns.RemoveAt(1); _settings.Columns.Insert(0, _status); } if (_settings.Columns[0].Name == "Status" && _settings.Columns[0].Type != "image") { _settings.Columns[0].Type = "image"; } // FilePath should be column index #2 if (_settings.Columns[2].Name != "FilePath") { _settings.Columns.Insert(2, _filepath); } // Replaygain Columns if (_settings.Columns[17].Name != "ReplayGainTrack") { _settings.Columns.Insert(17, _replayGainTrack); _settings.Columns.Insert(18, _replayGainTrackPeak); _settings.Columns.Insert(19, _replayGainAlbum); _settings.Columns.Insert(20, _replayGainAlbumPeak); } } }
private void OnLoad(object sender, EventArgs e) { log.Trace(">>>"); BackColor = ServiceScope.Get <IThemeManager>().CurrentTheme.BackColor; ServiceScope.Get <IThemeManager>().NotifyThemeChange(); // Load the Settings gridColumns = new GridViewColumnsLyrics(); // Setup Dataview Grid dataGridViewLyrics.AutoGenerateColumns = false; dataGridViewLyrics.DataSource = tracks; // Now Setup the columns, we want to display CreateColumns(); Localisation(); sitesToSearch = Options.MainSettings.LyricSites; // initialize delegates m_DelegateLyricFound = new DelegateLyricFound(lyricFound); m_DelegateLyricNotFound = new DelegateLyricNotFound(lyricNotFound); m_DelegateThreadFinished = new DelegateThreadFinished(threadFinished); m_DelegateThreadException = new DelegateThreadException(threadException); m_EventStopThread = new ManualResetEvent(false); bgWorkerLyrics = new BackgroundWorker(); bgWorkerLyrics.DoWork += bgWorkerLyrics_DoWork; bgWorkerLyrics.ProgressChanged += bgWorkerLyrics_ProgressChanged; bgWorkerLyrics.RunWorkerCompleted += bgWorkerLyrics_RunWorkerCompleted; bgWorkerLyrics.WorkerSupportsCancellation = true; lbFinished.Visible = false; lyricsQueue = new Queue(); dataGridViewLyrics.ReadOnly = true; foreach (TrackData track in tracks) { string[] lyricId = new string[2] { track.Artist, track.Title }; lyricsQueue.Enqueue(lyricId); } bgWorkerLyrics.RunWorkerAsync(); log.Trace("<<<"); }
/// <summary> /// When the Tab Page is clicked the first time, we want to fill the ribbon with the burner. /// Don't do it, when initially loading, as it might cause delays in displaying the Ui /// </summary> public void InitRibbon() { if (burnManager == null) { ServiceScope.Get <ILogger>().GetLogger.Debug("Registering Burn Manager"); ServiceScope.Add <IBurnManager>(new BurnManager()); mediaChangeMonitor = ServiceScope.Get <IMediaChangeMonitor>(); mediaChangeMonitor.MediaInserted += mediaChangeMonitor_MediaInserted; mediaChangeMonitor.MediaRemoved += mediaChangeMonitor_MediaRemoved; burnManager = ServiceScope.Get <IBurnManager>(); GetDrives(); } }
public AlbumDetails() { InitializeComponent(); // Fill the Genre Combo Box cbGenre.Items.AddRange(Genres.Audio); BackColor = ServiceScope.Get <IThemeManager>().CurrentTheme.BackColor; ServiceScope.Get <IThemeManager>().NotifyThemeChange(); labelHeader.ForeColor = ServiceScope.Get <IThemeManager>().CurrentTheme.FormHeaderForeColor; labelHeader.Font = ServiceScope.Get <IThemeManager>().CurrentTheme.FormHeaderFont; LocaliseScreen(); }
/// <summary> /// Create a Picture out of the given filename /// </summary> /// <param name="fileName"></param> public Picture(string fileName) { try { using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { FreeImageBitmap img = new FreeImageBitmap(fs); fs.Close(); Data = ImageToByte((Image)(img.Clone() as FreeImageBitmap)); img.Dispose(); } } catch (Exception ex) { ServiceScope.Get <ILogger>().GetLogger.Error("Error creating picture from file: {0}. Error: {1}", fileName, ex.Message); } }
public FileNameToTag(Main main) { _main = main; InitializeComponent(); BackColor = ServiceScope.Get <IThemeManager>().CurrentTheme.BackColor; ServiceScope.Get <IThemeManager>().NotifyThemeChange(); labelHeader.ForeColor = ServiceScope.Get <IThemeManager>().CurrentTheme.FormHeaderForeColor; labelHeader.Font = ServiceScope.Get <IThemeManager>().CurrentTheme.FormHeaderFont; LoadSettings(); LocaliseScreen(); tabControl1.SelectFirstTab(); }
public CoverSearch() { InitializeComponent(); BackColor = ServiceScope.Get <IThemeManager>().CurrentTheme.BackColor; ServiceScope.Get <IThemeManager>().NotifyThemeChange(); LocaliseScreen(); lbFileDetails.Text = ""; tbArtist.Text = ""; tbAlbum.Text = ""; lvSearchResults.View = View.LargeIcon; imagelist.ImageSize = new Size(128, 128); lvSearchResults.LargeImageList = imagelist; }