using System.Drawing.Imaging;\r
using System.Drawing.Drawing2D;\r
using System.Collections.Generic;\r
+using Myriadbits.MXF;\r
\r
namespace DxPlay {\r
\r
private IBaseFilter m_videoRenderer = null;\r
private object tcLock = new object();\r
Bitmap m_Bitmap = null;\r
-\r
+ public bool IsError { get; set; }\r
#if DEBUG\r
// Allow you to "Connect to remote graph" from GraphEdit\r
DsROTEntry m_DsRot;\r
//}\r
\r
try {\r
+ IsError = false;\r
m_FilterGraph = new FilterGraph() as IFilterGraph2;\r
\r
IGraphBuilder graphBuilder = m_FilterGraph as IGraphBuilder;\r
}\r
catch (Exception e) {\r
Debug.WriteLine(e.Message);\r
+ IsError = true;\r
}\r
finally {\r
}\r
DsError.ThrowExceptionForHR(hr);\r
MediaDescription.duration = new Timecode();\r
MediaDescription.Duration.Set(ReferenceTimeToFrames(duration));\r
- MediaDescription.firstFrame = new Timecode();\r
+ //MXFFile mxf = new MXFFile(MediaDescription.FileName);\r
+ //mxf.Inspect();\r
+ //MediaDescription.firstFrame = new Timecode(mxf.FirstSystemItem.UserDateFullFrameNb, MediaDescription.FrameRate);\r
+ //MediaDescription.firstFrame = new Timecode();\r
CurrentTC = new Timecode(MediaDescription.FirstFrame);\r
}\r
\r
private void cueue() {\r
m_play = null;\r
try {\r
- //m_mediaDescription = MediaDetector.GetDescription(selectedFile);\r
- m_mediaDescription = new MediaDescription() { fileName = selectedFile };\r
+ m_mediaDescription = MediaDetector.GetDescription(selectedFile);\r
+ //m_mediaDescription = new MediaDescription() { fileName = selectedFile };\r
trackBar1.Value = 0;\r
trackBar1.Minimum = 0;\r
m_play = new DxPlayer(panelVideo, ref m_mediaDescription);\r
+ if (m_play.IsError)\r
+ throw new Exception(selectedFile); \r
+\r
m_play.PlayEvent += new DxPlayEvent(playEvent);\r
if (m_mediaDescription != null) {\r
trackBar1.Maximum = m_mediaDescription.Duration.Frames;\r
}\r
}\r
catch (Exception ce) {\r
- MessageBox.Show("Failed to open file: " + ce.Message, "Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ MessageBox.Show("Az állomány nem tölthetõ be: " + ce.Message, "Open Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+ Close();\r
}\r
}\r
\r
m_play = null;\r
}\r
cueue();\r
- BringToFront();\r
- Activate();\r
+ //BringToFront();\r
+ //Activate();\r
}\r
\r
private void Form1_DragDrop(object sender, DragEventArgs e) {\r
{\r
"title": "Szerkesztő",\r
- "active": true,\r
+ "active": false,\r
"startInTray": false,\r
"enableCustomMetadataId": true,\r
"player": {\r
{\r
"title": "Lebony betöltő",\r
- "active": false,\r
+ "active": true,\r
"startInTray": false,\r
"enableCustomMetadataId": true,\r
"player": {\r
this.dgSource.Dock = System.Windows.Forms.DockStyle.Fill;\r
this.dgSource.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;\r
this.dgSource.EnableHeadersVisualStyles = false;\r
- this.dgSource.Location = new System.Drawing.Point(10, 51);\r
+ this.dgSource.Location = new System.Drawing.Point(10, 47);\r
this.dgSource.Name = "dgSource";\r
this.dgSource.RowHeadersVisible = false;\r
dataGridViewCellStyle17.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
this.dgSource.RowsDefaultCellStyle = dataGridViewCellStyle17;\r
this.dgSource.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));\r
this.dgSource.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;\r
- this.dgSource.Size = new System.Drawing.Size(347, 348);\r
+ this.dgSource.Size = new System.Drawing.Size(347, 352);\r
this.dgSource.TabIndex = 0;\r
this.dgSource.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.sourceGridView_CellContentClick);\r
this.dgSource.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridSource_CellEnter);\r
// \r
this.pSourceFilter.AutoSize = true;\r
this.pSourceFilter.ColumnCount = 2;\r
- this.pSourceFilter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 94.5245F));\r
- this.pSourceFilter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 5.475504F));\r
+ this.pSourceFilter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));\r
+ this.pSourceFilter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());\r
this.pSourceFilter.Controls.Add(this.txtSourceFilter, 0, 0);\r
this.pSourceFilter.Controls.Add(this.btnClearFilter, 1, 0);\r
this.pSourceFilter.Dock = System.Windows.Forms.DockStyle.Top;\r
this.pSourceFilter.Location = new System.Drawing.Point(10, 23);\r
this.pSourceFilter.Margin = new System.Windows.Forms.Padding(0);\r
this.pSourceFilter.Name = "pSourceFilter";\r
- this.pSourceFilter.Padding = new System.Windows.Forms.Padding(0, 4, 0, 4);\r
+ this.pSourceFilter.Padding = new System.Windows.Forms.Padding(0, 0, 0, 4);\r
this.pSourceFilter.RowCount = 1;\r
- this.pSourceFilter.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));\r
- this.pSourceFilter.Size = new System.Drawing.Size(347, 28);\r
+ this.pSourceFilter.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));\r
+ this.pSourceFilter.Size = new System.Drawing.Size(347, 24);\r
this.pSourceFilter.TabIndex = 17;\r
// \r
// txtSourceFilter\r
// \r
this.txtSourceFilter.Dock = System.Windows.Forms.DockStyle.Fill;\r
- this.txtSourceFilter.Location = new System.Drawing.Point(0, 4);\r
+ this.txtSourceFilter.Location = new System.Drawing.Point(0, 0);\r
this.txtSourceFilter.Margin = new System.Windows.Forms.Padding(0);\r
this.txtSourceFilter.Name = "txtSourceFilter";\r
this.txtSourceFilter.Size = new System.Drawing.Size(328, 20);\r
// btnClearFilter\r
// \r
this.btnClearFilter.Image = global::Maestro.Properties.Resources.ic_clear_black_24dp_1x;\r
- this.btnClearFilter.Location = new System.Drawing.Point(328, 4);\r
+ this.btnClearFilter.Location = new System.Drawing.Point(328, 0);\r
this.btnClearFilter.Margin = new System.Windows.Forms.Padding(0);\r
this.btnClearFilter.Name = "btnClearFilter";\r
this.btnClearFilter.Size = new System.Drawing.Size(19, 20);\r
}\r
\r
private void dataGridSource_CellMouseEnter(object sender, DataGridViewCellEventArgs e) {\r
- if (IsPlayColumn(e.ColumnIndex))\r
+ if (e.RowIndex > -1 && IsPlayColumn(e.ColumnIndex))\r
dgSource.Cursor = Cursors.Hand;\r
}\r
\r
PlayerForm player = new PlayerForm();\r
player.AutoStart = Configuration.Player.AutoStart;\r
player.Open(fileSourceItem.FileInfo);\r
- player.ShowDialog();\r
+ if (!player.IsDisposed)\r
+ player.ShowDialog();\r
Cursor = Cursors.Default;\r
}));\r
}\r
using System;\r
using System.Collections.Concurrent;\r
using System.Collections.Generic;\r
+using System.Diagnostics;\r
using System.Drawing;\r
using System.IO;\r
using System.Linq;\r
}\r
finally {\r
if (hasHandle) {\r
- Application.EnableVisualStyles();\r
- Application.SetCompatibleTextRenderingDefault(false);\r
- Application.Run(new TrayApplicationContext());\r
- mutex.ReleaseMutex();\r
+ try {\r
+ Application.EnableVisualStyles();\r
+ Application.SetCompatibleTextRenderingDefault(false);\r
+ Application.Run(new TrayApplicationContext());\r
+ }\r
+ catch (Exception e) {\r
+ Debug.WriteLine(e.Message);\r
+ }\r
+ finally {\r
+ mutex.ReleaseMutex();\r
+ }\r
}\r
}\r
}\r
DataPropertyName = "Name",\r
HeaderText = StringResources.NEV,\r
AutoSizeMode = DataGridViewAutoSizeColumnMode.None,\r
- Width = 200\r
+ Width = 200,\r
+ SortMode = DataGridViewColumnSortMode.Automatic\r
},\r
new DataGridViewTextBoxColumn(){\r
DataPropertyName = "FormattedSize",\r
HeaderText = StringResources.MERET,\r
AutoSizeMode = DataGridViewAutoSizeColumnMode.None,\r
- Width = 100\r
+ Width = 100,\r
+ SortMode = DataGridViewColumnSortMode.Automatic\r
},\r
new DataGridViewTextBoxColumn() {\r
DataPropertyName = "Created",\r
HeaderText = StringResources.LETREHOZVA,\r
- AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells\r
+ AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells,\r
+ SortMode = DataGridViewColumnSortMode.Automatic\r
}\r
};\r
foreach (DataGridViewColumn column in result) {\r
}\r
}\r
\r
+ public bool SupportsSorting {\r
+ get => false;\r
+ }\r
+\r
+ public bool IsSorted {\r
+ get => true;\r
+ }\r
+\r
+ public PropertyDescriptor SortProperty {\r
+ get; set;\r
+ }\r
+\r
+ public ListSortDirection SortDirection { get; set; }\r
+\r
+ public void ApplySort(PropertyDescriptor property, ListSortDirection direction) {\r
+ SortProperty = property;\r
+ SortDirection = direction;\r
+ if (cache == null) {\r
+\r
+ }\r
+ \r
+ }\r
+\r
+ public void RemoveSort(PropertyDescriptor property, ListSortDirection direction) {\r
+ }\r
+\r
public string Filter {\r
- get => filter; set {\r
+ get => filter;\r
+ set {\r
filter = value;\r
- if (String.IsNullOrEmpty(filter)) {\r
+ if (String.IsNullOrEmpty(filter))\r
RemoveFilter();\r
- } else {\r
+ else\r
ApplyFilter(filter);\r
- }\r
}\r
}\r
\r
cache = new List<FileSourceItem>(this);\r
Clear();\r
IEnumerable<FileSourceItem> filteredItems = cache.Where(i => (i.Name == null) ? false : i.Name.ToLower().Contains(filter.ToLower()));\r
- filteredItems.ToList().ForEach(i => parent.SafeCall(() => Add(i)));\r
\r
+ switch (SortDirection) {\r
+ case ListSortDirection.Ascending:\r
+ filteredItems.OrderBy(i => getValue(i)).ToList().ForEach(i => Add(i));\r
+ break;\r
+ case ListSortDirection.Descending:\r
+ filteredItems.OrderByDescending(i => getValue(i)).ToList().ForEach(i => Add(i));\r
+ break;\r
+ }\r
+ }\r
+\r
+ private object getValue(FileSourceItem i) {\r
+ object result = null;\r
+ switch (SortProperty.Name) {\r
+ case "Name":\r
+ result = i.Name;\r
+ break;\r
+ case "FormattedSize":\r
+ result = i.FormattedSize;\r
+ break;\r
+ case "Created":\r
+ result = i.Created;\r
+ break;\r
+ }\r
+ return result;\r
}\r
\r
public void RemoveFilter() {\r
Shutdown();\r
}\r
\r
- public ListSortDescriptionCollection SortDescriptions => throw new NotImplementedException();\r
+ public ListSortDescriptionCollection SortDescriptions => null;\r
\r
public bool SupportsAdvancedSorting => throw new NotImplementedException();\r
\r
private void initializeList(string path) {\r
string[] files = Directory.GetFiles(path);\r
var fileSourceItems = files.Select(f => CreateItem(new FileInfo(f), false)).OrderByDescending(i => i.Created);\r
+ SortProperty = TypeDescriptor.GetProperties(typeof(FileSourceItem)).Find("Created", false);\r
+ SortDirection = ListSortDirection.Descending; \r
try {\r
fileSourceItems.Where(x => x.CanHandle(acceptableExtensions)).ToList().ForEach(i => parent.SafeCall(() => Add(i)));\r
}\r