From: Vásáry Dániel Date: Mon, 6 Nov 2017 17:10:17 +0000 (+0000) Subject: git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube... X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=c3e12792a2ec7c5af1c25f2035f2cb9b1e69d0b4;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C30692 --- diff --git a/client/DxPlay/DxPlayer.cs b/client/DxPlay/DxPlayer.cs index b1e9f86e..828c73c0 100644 --- a/client/DxPlay/DxPlayer.cs +++ b/client/DxPlay/DxPlayer.cs @@ -12,6 +12,7 @@ using System.ComponentModel; using System.Drawing.Imaging; using System.Drawing.Drawing2D; using System.Collections.Generic; +using Myriadbits.MXF; namespace DxPlay { @@ -55,7 +56,7 @@ namespace DxPlay { private IBaseFilter m_videoRenderer = null; private object tcLock = new object(); Bitmap m_Bitmap = null; - + public bool IsError { get; set; } #if DEBUG // Allow you to "Connect to remote graph" from GraphEdit DsROTEntry m_DsRot; @@ -226,6 +227,7 @@ namespace DxPlay { //} try { + IsError = false; m_FilterGraph = new FilterGraph() as IFilterGraph2; IGraphBuilder graphBuilder = m_FilterGraph as IGraphBuilder; @@ -298,6 +300,7 @@ namespace DxPlay { } catch (Exception e) { Debug.WriteLine(e.Message); + IsError = true; } finally { } @@ -316,7 +319,10 @@ namespace DxPlay { DsError.ThrowExceptionForHR(hr); MediaDescription.duration = new Timecode(); MediaDescription.Duration.Set(ReferenceTimeToFrames(duration)); - MediaDescription.firstFrame = new Timecode(); + //MXFFile mxf = new MXFFile(MediaDescription.FileName); + //mxf.Inspect(); + //MediaDescription.firstFrame = new Timecode(mxf.FirstSystemItem.UserDateFullFrameNb, MediaDescription.FrameRate); + //MediaDescription.firstFrame = new Timecode(); CurrentTC = new Timecode(MediaDescription.FirstFrame); } diff --git a/client/DxPlay/PlayerForm.cs b/client/DxPlay/PlayerForm.cs index 83a7e899..cd8ce243 100644 --- a/client/DxPlay/PlayerForm.cs +++ b/client/DxPlay/PlayerForm.cs @@ -60,11 +60,14 @@ namespace DxPlay { private void cueue() { m_play = null; try { - //m_mediaDescription = MediaDetector.GetDescription(selectedFile); - m_mediaDescription = new MediaDescription() { fileName = selectedFile }; + m_mediaDescription = MediaDetector.GetDescription(selectedFile); + //m_mediaDescription = new MediaDescription() { fileName = selectedFile }; trackBar1.Value = 0; trackBar1.Minimum = 0; m_play = new DxPlayer(panelVideo, ref m_mediaDescription); + if (m_play.IsError) + throw new Exception(selectedFile); + m_play.PlayEvent += new DxPlayEvent(playEvent); if (m_mediaDescription != null) { trackBar1.Maximum = m_mediaDescription.Duration.Frames; @@ -73,7 +76,8 @@ namespace DxPlay { } } catch (Exception ce) { - MessageBox.Show("Failed to open file: " + ce.Message, "Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show("Az állomány nem tölthetõ be: " + ce.Message, "Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + Close(); } } @@ -122,8 +126,8 @@ namespace DxPlay { m_play = null; } cueue(); - BringToFront(); - Activate(); + //BringToFront(); + //Activate(); } private void Form1_DragDrop(object sender, DragEventArgs e) { diff --git a/client/Maestro/Configuration/configuration-editor.json b/client/Maestro/Configuration/configuration-editor.json index 8b84f8a3..fee8893a 100644 --- a/client/Maestro/Configuration/configuration-editor.json +++ b/client/Maestro/Configuration/configuration-editor.json @@ -1,6 +1,6 @@ { "title": "Szerkesztő", - "active": true, + "active": false, "startInTray": false, "enableCustomMetadataId": true, "player": { diff --git a/client/Maestro/Configuration/configuration-playout-ingest.json b/client/Maestro/Configuration/configuration-playout-ingest.json index 26deea8e..bb755209 100644 --- a/client/Maestro/Configuration/configuration-playout-ingest.json +++ b/client/Maestro/Configuration/configuration-playout-ingest.json @@ -1,6 +1,6 @@ { "title": "Lebony betöltő", - "active": false, + "active": true, "startInTray": false, "enableCustomMetadataId": true, "player": { diff --git a/client/Maestro/MaestroForm.Designer.cs b/client/Maestro/MaestroForm.Designer.cs index 04146eb2..0dc81cd3 100644 --- a/client/Maestro/MaestroForm.Designer.cs +++ b/client/Maestro/MaestroForm.Designer.cs @@ -177,14 +177,14 @@ namespace Maestro { this.dgSource.Dock = System.Windows.Forms.DockStyle.Fill; this.dgSource.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; this.dgSource.EnableHeadersVisualStyles = false; - this.dgSource.Location = new System.Drawing.Point(10, 51); + this.dgSource.Location = new System.Drawing.Point(10, 47); this.dgSource.Name = "dgSource"; this.dgSource.RowHeadersVisible = false; dataGridViewCellStyle17.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.dgSource.RowsDefaultCellStyle = dataGridViewCellStyle17; this.dgSource.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); this.dgSource.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dgSource.Size = new System.Drawing.Size(347, 348); + this.dgSource.Size = new System.Drawing.Size(347, 352); this.dgSource.TabIndex = 0; this.dgSource.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.sourceGridView_CellContentClick); this.dgSource.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridSource_CellEnter); @@ -198,24 +198,24 @@ namespace Maestro { // this.pSourceFilter.AutoSize = true; this.pSourceFilter.ColumnCount = 2; - this.pSourceFilter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 94.5245F)); - this.pSourceFilter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.475504F)); + this.pSourceFilter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.pSourceFilter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.pSourceFilter.Controls.Add(this.txtSourceFilter, 0, 0); this.pSourceFilter.Controls.Add(this.btnClearFilter, 1, 0); this.pSourceFilter.Dock = System.Windows.Forms.DockStyle.Top; this.pSourceFilter.Location = new System.Drawing.Point(10, 23); this.pSourceFilter.Margin = new System.Windows.Forms.Padding(0); this.pSourceFilter.Name = "pSourceFilter"; - this.pSourceFilter.Padding = new System.Windows.Forms.Padding(0, 4, 0, 4); + this.pSourceFilter.Padding = new System.Windows.Forms.Padding(0, 0, 0, 4); this.pSourceFilter.RowCount = 1; - this.pSourceFilter.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.pSourceFilter.Size = new System.Drawing.Size(347, 28); + this.pSourceFilter.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.pSourceFilter.Size = new System.Drawing.Size(347, 24); this.pSourceFilter.TabIndex = 17; // // txtSourceFilter // this.txtSourceFilter.Dock = System.Windows.Forms.DockStyle.Fill; - this.txtSourceFilter.Location = new System.Drawing.Point(0, 4); + this.txtSourceFilter.Location = new System.Drawing.Point(0, 0); this.txtSourceFilter.Margin = new System.Windows.Forms.Padding(0); this.txtSourceFilter.Name = "txtSourceFilter"; this.txtSourceFilter.Size = new System.Drawing.Size(328, 20); @@ -225,7 +225,7 @@ namespace Maestro { // btnClearFilter // this.btnClearFilter.Image = global::Maestro.Properties.Resources.ic_clear_black_24dp_1x; - this.btnClearFilter.Location = new System.Drawing.Point(328, 4); + this.btnClearFilter.Location = new System.Drawing.Point(328, 0); this.btnClearFilter.Margin = new System.Windows.Forms.Padding(0); this.btnClearFilter.Name = "btnClearFilter"; this.btnClearFilter.Size = new System.Drawing.Size(19, 20); diff --git a/client/Maestro/MaestroForm.Source.cs b/client/Maestro/MaestroForm.Source.cs index 0587ec38..b8d28d3f 100644 --- a/client/Maestro/MaestroForm.Source.cs +++ b/client/Maestro/MaestroForm.Source.cs @@ -70,7 +70,7 @@ namespace Maestro { } private void dataGridSource_CellMouseEnter(object sender, DataGridViewCellEventArgs e) { - if (IsPlayColumn(e.ColumnIndex)) + if (e.RowIndex > -1 && IsPlayColumn(e.ColumnIndex)) dgSource.Cursor = Cursors.Hand; } @@ -107,7 +107,8 @@ namespace Maestro { PlayerForm player = new PlayerForm(); player.AutoStart = Configuration.Player.AutoStart; player.Open(fileSourceItem.FileInfo); - player.ShowDialog(); + if (!player.IsDisposed) + player.ShowDialog(); Cursor = Cursors.Default; })); } diff --git a/client/Maestro/Program.cs b/client/Maestro/Program.cs index 784c5681..9f1ab25f 100644 --- a/client/Maestro/Program.cs +++ b/client/Maestro/Program.cs @@ -7,6 +7,7 @@ using NLog.Targets; using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; @@ -47,10 +48,17 @@ namespace Maestro { } finally { if (hasHandle) { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new TrayApplicationContext()); - mutex.ReleaseMutex(); + try { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new TrayApplicationContext()); + } + catch (Exception e) { + Debug.WriteLine(e.Message); + } + finally { + mutex.ReleaseMutex(); + } } } } diff --git a/client/Maestro/Resources/installforge-installer-project.ifp b/client/Maestro/Resources/installforge-installer-project.ifp index dd18bcad..6fcbde34 100644 Binary files a/client/Maestro/Resources/installforge-installer-project.ifp and b/client/Maestro/Resources/installforge-installer-project.ifp differ diff --git a/client/Maestro/Sources/FileSystemSource.cs b/client/Maestro/Sources/FileSystemSource.cs index 7c4f65ed..cea9113d 100644 --- a/client/Maestro/Sources/FileSystemSource.cs +++ b/client/Maestro/Sources/FileSystemSource.cs @@ -40,18 +40,21 @@ namespace Maestro.Sources { DataPropertyName = "Name", HeaderText = StringResources.NEV, AutoSizeMode = DataGridViewAutoSizeColumnMode.None, - Width = 200 + Width = 200, + SortMode = DataGridViewColumnSortMode.Automatic }, new DataGridViewTextBoxColumn(){ DataPropertyName = "FormattedSize", HeaderText = StringResources.MERET, AutoSizeMode = DataGridViewAutoSizeColumnMode.None, - Width = 100 + Width = 100, + SortMode = DataGridViewColumnSortMode.Automatic }, new DataGridViewTextBoxColumn() { DataPropertyName = "Created", HeaderText = StringResources.LETREHOZVA, - AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells + AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells, + SortMode = DataGridViewColumnSortMode.Automatic } }; foreach (DataGridViewColumn column in result) { @@ -61,14 +64,40 @@ namespace Maestro.Sources { } } + public bool SupportsSorting { + get => false; + } + + public bool IsSorted { + get => true; + } + + public PropertyDescriptor SortProperty { + get; set; + } + + public ListSortDirection SortDirection { get; set; } + + public void ApplySort(PropertyDescriptor property, ListSortDirection direction) { + SortProperty = property; + SortDirection = direction; + if (cache == null) { + + } + + } + + public void RemoveSort(PropertyDescriptor property, ListSortDirection direction) { + } + public string Filter { - get => filter; set { + get => filter; + set { filter = value; - if (String.IsNullOrEmpty(filter)) { + if (String.IsNullOrEmpty(filter)) RemoveFilter(); - } else { + else ApplyFilter(filter); - } } } @@ -77,8 +106,31 @@ namespace Maestro.Sources { cache = new List(this); Clear(); IEnumerable filteredItems = cache.Where(i => (i.Name == null) ? false : i.Name.ToLower().Contains(filter.ToLower())); - filteredItems.ToList().ForEach(i => parent.SafeCall(() => Add(i))); + switch (SortDirection) { + case ListSortDirection.Ascending: + filteredItems.OrderBy(i => getValue(i)).ToList().ForEach(i => Add(i)); + break; + case ListSortDirection.Descending: + filteredItems.OrderByDescending(i => getValue(i)).ToList().ForEach(i => Add(i)); + break; + } + } + + private object getValue(FileSourceItem i) { + object result = null; + switch (SortProperty.Name) { + case "Name": + result = i.Name; + break; + case "FormattedSize": + result = i.FormattedSize; + break; + case "Created": + result = i.Created; + break; + } + return result; } public void RemoveFilter() { @@ -87,7 +139,7 @@ namespace Maestro.Sources { Shutdown(); } - public ListSortDescriptionCollection SortDescriptions => throw new NotImplementedException(); + public ListSortDescriptionCollection SortDescriptions => null; public bool SupportsAdvancedSorting => throw new NotImplementedException(); @@ -156,6 +208,8 @@ namespace Maestro.Sources { private void initializeList(string path) { string[] files = Directory.GetFiles(path); var fileSourceItems = files.Select(f => CreateItem(new FileInfo(f), false)).OrderByDescending(i => i.Created); + SortProperty = TypeDescriptor.GetProperties(typeof(FileSourceItem)).Find("Created", false); + SortDirection = ListSortDirection.Descending; try { fileSourceItems.Where(x => x.CanHandle(acceptableExtensions)).ToList().ForEach(i => parent.SafeCall(() => Add(i))); }