From 7c3f8347863251b5df1030ec96739adf2260cce3 Mon Sep 17 00:00:00 2001 From: Brett Sanderson Date: Tue, 8 Mar 2016 23:22:19 -0500 Subject: [PATCH] crappy little alpha release --- CdgPlayer/CdgPlayer.csproj | 121 +++++++++++ .../KaraokeVideoOverlay.Designer.cs | 2 +- .../KaraokeVideoOverlay.cs | 21 +- .../KaraokeVideoOverlay.resx | 0 .../KaraokeVideoPlayer.Designer.cs | 18 +- .../KaraokeVideoPlayer.cs | 28 +-- .../KaraokeVideoPlayer.resx | 0 CdgPlayer/Properties/AssemblyInfo.cs | 36 ++++ CdgPlayer/Properties/Resources.Designer.cs | 63 ++++++ CdgPlayer/Properties/Resources.resx | 117 +++++++++++ CdgPlayer/Properties/Settings.Designer.cs | 26 +++ CdgPlayer/Properties/Settings.settings | 7 + CdgPlayer/app.config | 3 + CdgPlayer/packages.config | 6 + KaraokePlayer.sln | 12 +- KaraokePlayer/KaraokePlayer.csproj | 45 +--- KaraokePlayer/MainForm.Designer.cs | 194 ++++++++++++++++-- KaraokePlayer/MainForm.cs | 34 ++- KaraokePlayer/MainForm.resx | 3 + KaraokePlayer/TransparentPanel.cs | 39 ---- KaraokePlayer/packages.config | 3 - 21 files changed, 624 insertions(+), 154 deletions(-) create mode 100644 CdgPlayer/CdgPlayer.csproj rename KaraokePlayer/OverlayForm.Designer.cs => CdgPlayer/KaraokeVideoOverlay.Designer.cs (98%) rename KaraokePlayer/OverlayForm.cs => CdgPlayer/KaraokeVideoOverlay.cs (81%) rename KaraokePlayer/KaraokeVideoPlayer.resx => CdgPlayer/KaraokeVideoOverlay.resx (100%) rename {KaraokePlayer => CdgPlayer}/KaraokeVideoPlayer.Designer.cs (77%) rename {KaraokePlayer => CdgPlayer}/KaraokeVideoPlayer.cs (79%) rename KaraokePlayer/OverlayForm.resx => CdgPlayer/KaraokeVideoPlayer.resx (100%) create mode 100644 CdgPlayer/Properties/AssemblyInfo.cs create mode 100644 CdgPlayer/Properties/Resources.Designer.cs create mode 100644 CdgPlayer/Properties/Resources.resx create mode 100644 CdgPlayer/Properties/Settings.Designer.cs create mode 100644 CdgPlayer/Properties/Settings.settings create mode 100644 CdgPlayer/app.config create mode 100644 CdgPlayer/packages.config delete mode 100644 KaraokePlayer/TransparentPanel.cs diff --git a/CdgPlayer/CdgPlayer.csproj b/CdgPlayer/CdgPlayer.csproj new file mode 100644 index 0000000..4452193 --- /dev/null +++ b/CdgPlayer/CdgPlayer.csproj @@ -0,0 +1,121 @@ + + + + + Debug + AnyCPU + {A5324295-6BD2-4415-92CD-6EA77D708E00} + Library + Properties + CdgPlayer + CdgPlayer + v4.6 + 512 + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + ..\packages\Vlc.DotNet.Core.2.1.115\lib\net45\x86\Vlc.DotNet.Core.dll + True + + + ..\packages\Vlc.DotNet.Core.Interops.2.1.115\lib\net45\x86\Vlc.DotNet.Core.Interops.dll + True + + + ..\packages\Vlc.DotNet.Forms.2.1.115\lib\net45\x86\Vlc.DotNet.Forms.dll + True + + + + + Form + + + KaraokeVideoOverlay.cs + + + UserControl + + + KaraokeVideoPlayer.cs + + + + KaraokeVideoOverlay.cs + + + KaraokeVideoPlayer.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + {3203dfd2-da5b-47b3-b009-18dd9c401fc3} + CdgLib + + + + + \ No newline at end of file diff --git a/KaraokePlayer/OverlayForm.Designer.cs b/CdgPlayer/KaraokeVideoOverlay.Designer.cs similarity index 98% rename from KaraokePlayer/OverlayForm.Designer.cs rename to CdgPlayer/KaraokeVideoOverlay.Designer.cs index fe71fef..d70fb02 100644 --- a/KaraokePlayer/OverlayForm.Designer.cs +++ b/CdgPlayer/KaraokeVideoOverlay.Designer.cs @@ -1,6 +1,6 @@ namespace KaraokePlayer { - partial class OverlayForm + partial class KaraokeVideoOverlay { /// /// Required designer variable. diff --git a/KaraokePlayer/OverlayForm.cs b/CdgPlayer/KaraokeVideoOverlay.cs similarity index 81% rename from KaraokePlayer/OverlayForm.cs rename to CdgPlayer/KaraokeVideoOverlay.cs index 76fbf11..e49866e 100644 --- a/KaraokePlayer/OverlayForm.cs +++ b/CdgPlayer/KaraokeVideoOverlay.cs @@ -5,14 +5,14 @@ using System.Windows.Forms; namespace KaraokePlayer { - public partial class OverlayForm : Form + public partial class KaraokeVideoOverlay : Form { private const int DwmwaTransitionsForcedisabled = 3; ContainerControl _parent; - public OverlayForm(ContainerControl parent) + public KaraokeVideoOverlay(ContainerControl parent) { - + var parentForm = parent.FindForm(); InitializeComponent(); Graphic.BackColor = Color.Transparent; _parent = parent; @@ -24,7 +24,7 @@ namespace KaraokePlayer StartPosition = FormStartPosition.Manual; AutoScaleMode = AutoScaleMode.None; Show(parent); - parent.ParentForm.LocationChanged += Cover_LocationChanged; + parentForm.LocationChanged += Cover_LocationChanged; parent.LocationChanged += Cover_LocationChanged; parent.VisibleChanged += Cover_LocationChanged; parent.ClientSizeChanged += Cover_ClientSizeChanged; @@ -32,7 +32,7 @@ namespace KaraokePlayer if (Environment.OSVersion.Version.Major >= 6) { var value = 1; - DwmSetWindowAttribute(parent.ParentForm.Handle, DwmwaTransitionsForcedisabled, ref value, 4); + DwmSetWindowAttribute(parentForm.Handle, DwmwaTransitionsForcedisabled, ref value, 4); } Location = parent.PointToScreen(Point.Empty); ClientSize = parent.ClientSize; @@ -46,12 +46,14 @@ namespace KaraokePlayer private void Cover_LocationChanged(object sender, EventArgs e) { - Location = _parent.PointToScreen(Point.Empty); + ClientSize = _parent.ClientSize; + Location = _parent.PointToScreen(Point.Empty); } private void Cover_ClientSizeChanged(object sender, EventArgs e) { ClientSize = _parent.ClientSize; + Location = _parent.PointToScreen(Point.Empty); } protected override void OnFormClosing(FormClosingEventArgs e) @@ -66,13 +68,6 @@ namespace KaraokePlayer } base.OnFormClosing(e); } - - protected override void OnActivated(EventArgs e) - { - // Always keep the owner activated instead - BeginInvoke(new Action(() => Owner.Activate())); - } - [DllImport("dwmapi.dll")] private static extern int DwmSetWindowAttribute(IntPtr hWnd, int attr, ref int value, int attrLen); diff --git a/KaraokePlayer/KaraokeVideoPlayer.resx b/CdgPlayer/KaraokeVideoOverlay.resx similarity index 100% rename from KaraokePlayer/KaraokeVideoPlayer.resx rename to CdgPlayer/KaraokeVideoOverlay.resx diff --git a/KaraokePlayer/KaraokeVideoPlayer.Designer.cs b/CdgPlayer/KaraokeVideoPlayer.Designer.cs similarity index 77% rename from KaraokePlayer/KaraokeVideoPlayer.Designer.cs rename to CdgPlayer/KaraokeVideoPlayer.Designer.cs index 07183ff..9615fb2 100644 --- a/KaraokePlayer/KaraokeVideoPlayer.Designer.cs +++ b/CdgPlayer/KaraokeVideoPlayer.Designer.cs @@ -29,9 +29,7 @@ private void InitializeComponent() { this.vlcPlayer = new Vlc.DotNet.Forms.VlcControl(); - this.panelVideo = new System.Windows.Forms.Panel(); ((System.ComponentModel.ISupportInitialize)(this.vlcPlayer)).BeginInit(); - this.panelVideo.SuspendLayout(); this.SuspendLayout(); // // vlcPlayer @@ -54,28 +52,17 @@ this.vlcPlayer.VlcLibDirectoryNeeded += new System.EventHandler(this.vlcPlayer_VlcLibDirectoryNeeded); this.vlcPlayer.Playing += new System.EventHandler(this.vlcPlayer_Playing); this.vlcPlayer.TimeChanged += new System.EventHandler(this.vlcPlayer_TimeChanged); - this.vlcPlayer.DoubleClick += new System.EventHandler(this.vlcPlayer_DoubleClick); - // - // panelVideo - // - this.panelVideo.Controls.Add(this.vlcPlayer); - this.panelVideo.Dock = System.Windows.Forms.DockStyle.Fill; - this.panelVideo.Location = new System.Drawing.Point(0, 0); - this.panelVideo.Name = "panelVideo"; - this.panelVideo.Size = new System.Drawing.Size(428, 330); - this.panelVideo.TabIndex = 2; // // KaraokeVideoPlayer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.panelVideo); + this.Controls.Add(this.vlcPlayer); this.Name = "KaraokeVideoPlayer"; this.Size = new System.Drawing.Size(428, 330); - this.DoubleClick += new System.EventHandler(this.KaraokeVideoPlayer_DoubleClick); + this.Load += new System.EventHandler(this.KaraokeVideoPlayer_Load); this.ParentChanged += new System.EventHandler(this.KaraokeVideoPlayer_ParentChanged); ((System.ComponentModel.ISupportInitialize)(this.vlcPlayer)).EndInit(); - this.panelVideo.ResumeLayout(false); this.ResumeLayout(false); } @@ -83,6 +70,5 @@ #endregion private Vlc.DotNet.Forms.VlcControl vlcPlayer; - private System.Windows.Forms.Panel panelVideo; } } diff --git a/KaraokePlayer/KaraokeVideoPlayer.cs b/CdgPlayer/KaraokeVideoPlayer.cs similarity index 79% rename from KaraokePlayer/KaraokeVideoPlayer.cs rename to CdgPlayer/KaraokeVideoPlayer.cs index 3af0b75..00de72a 100644 --- a/KaraokePlayer/KaraokeVideoPlayer.cs +++ b/CdgPlayer/KaraokeVideoPlayer.cs @@ -16,21 +16,21 @@ namespace KaraokePlayer public partial class KaraokeVideoPlayer : UserControl { private GraphicsFile _cdgFile; - private OverlayForm _overlayForm; + private KaraokeVideoOverlay _overlayForm; private DateTime _startTime; private readonly System.Timers.Timer _lyricTimer = new System.Timers.Timer(); public KaraokeVideoPlayer() { InitializeComponent(); - _lyricTimer.Interval = 50; + _lyricTimer.Interval = 33; _lyricTimer.Elapsed += LyricTimerOnElapsed; } private void LyricTimerOnElapsed(object sender, ElapsedEventArgs elapsedEventArgs) { var picture = _cdgFile.RenderAtTime((long)(DateTime.Now - _startTime).TotalMilliseconds); - _overlayForm.Graphic.Image = picture; + BeginInvoke(new MethodInvoker(() => { _overlayForm.Graphic.Image = picture; })); } public async void Play(Uri file) @@ -53,10 +53,7 @@ namespace KaraokePlayer private void KaraokeVideoPlayer_ParentChanged(object sender, EventArgs e) { - if (ParentForm != null) - { - _overlayForm = new OverlayForm(this); - } + } private void vlcPlayer_VlcLibDirectoryNeeded(object sender, Vlc.DotNet.Forms.VlcLibDirectoryNeededEventArgs e) @@ -64,19 +61,12 @@ namespace KaraokePlayer e.VlcLibDirectory = new DirectoryInfo(@"lib\vlc\"); } - private void vlcPlayer_DoubleClick(object sender, EventArgs e) + private void KaraokeVideoPlayer_Load(object sender, EventArgs e) { - - } - - private void KaraokeVideoPlayer_DoubleClick(object sender, EventArgs e) - { - - } - - private void panel1_DoubleClick(object sender, EventArgs e) - { - + if (this.FindForm() != null) + { + _overlayForm = new KaraokeVideoOverlay(this); + } } } } \ No newline at end of file diff --git a/KaraokePlayer/OverlayForm.resx b/CdgPlayer/KaraokeVideoPlayer.resx similarity index 100% rename from KaraokePlayer/OverlayForm.resx rename to CdgPlayer/KaraokeVideoPlayer.resx diff --git a/CdgPlayer/Properties/AssemblyInfo.cs b/CdgPlayer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..1d102a7 --- /dev/null +++ b/CdgPlayer/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CdgPlayer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CdgPlayer")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a5324295-6bd2-4415-92cd-6ea77d708e00")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CdgPlayer/Properties/Resources.Designer.cs b/CdgPlayer/Properties/Resources.Designer.cs new file mode 100644 index 0000000..d20bab6 --- /dev/null +++ b/CdgPlayer/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CdgPlayer.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("CdgPlayer.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/CdgPlayer/Properties/Resources.resx b/CdgPlayer/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/CdgPlayer/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CdgPlayer/Properties/Settings.Designer.cs b/CdgPlayer/Properties/Settings.Designer.cs new file mode 100644 index 0000000..9f03d15 --- /dev/null +++ b/CdgPlayer/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace CdgPlayer.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/CdgPlayer/Properties/Settings.settings b/CdgPlayer/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/CdgPlayer/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/CdgPlayer/app.config b/CdgPlayer/app.config new file mode 100644 index 0000000..b45f31e --- /dev/null +++ b/CdgPlayer/app.config @@ -0,0 +1,3 @@ + + + diff --git a/CdgPlayer/packages.config b/CdgPlayer/packages.config new file mode 100644 index 0000000..992ddc5 --- /dev/null +++ b/CdgPlayer/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/KaraokePlayer.sln b/KaraokePlayer.sln index d0af5c0..8f52ca3 100644 --- a/KaraokePlayer.sln +++ b/KaraokePlayer.sln @@ -1,11 +1,17 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 14 -VisualStudioVersion = 14.0.25008.0 +VisualStudioVersion = 14.0.24720.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CdgLib", "CdgLib\CdgLib.csproj", "{3203DFD2-DA5B-47B3-B009-18DD9C401FC3}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KaraokePlayer", "KaraokePlayer\KaraokePlayer.csproj", "{2CF318E2-04B5-40FC-9577-6DAC62B86FB2}" + ProjectSection(ProjectDependencies) = postProject + {A5324295-6BD2-4415-92CD-6EA77D708E00} = {A5324295-6BD2-4415-92CD-6EA77D708E00} + {3203DFD2-DA5B-47B3-B009-18DD9C401FC3} = {3203DFD2-DA5B-47B3-B009-18DD9C401FC3} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CdgPlayer", "CdgPlayer\CdgPlayer.csproj", "{A5324295-6BD2-4415-92CD-6EA77D708E00}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -21,6 +27,10 @@ Global {2CF318E2-04B5-40FC-9577-6DAC62B86FB2}.Debug|Any CPU.Build.0 = Debug|Any CPU {2CF318E2-04B5-40FC-9577-6DAC62B86FB2}.Release|Any CPU.ActiveCfg = Release|Any CPU {2CF318E2-04B5-40FC-9577-6DAC62B86FB2}.Release|Any CPU.Build.0 = Release|Any CPU + {A5324295-6BD2-4415-92CD-6EA77D708E00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A5324295-6BD2-4415-92CD-6EA77D708E00}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A5324295-6BD2-4415-92CD-6EA77D708E00}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A5324295-6BD2-4415-92CD-6EA77D708E00}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/KaraokePlayer/KaraokePlayer.csproj b/KaraokePlayer/KaraokePlayer.csproj index db3e832..0aa564f 100644 --- a/KaraokePlayer/KaraokePlayer.csproj +++ b/KaraokePlayer/KaraokePlayer.csproj @@ -54,52 +54,19 @@ - - False - ..\packages\Vlc.DotNet.Core.2.1.115\lib\net45\x86\Vlc.DotNet.Core.dll - - - False - ..\packages\Vlc.DotNet.Core.Interops.2.1.115\lib\net45\x86\Vlc.DotNet.Core.Interops.dll - - - False - ..\packages\Vlc.DotNet.Forms.2.1.115\lib\net45\x86\Vlc.DotNet.Forms.dll - - - UserControl - - - KaraokeVideoPlayer.cs - Form MainForm.cs - - Form - - - OverlayForm.cs - - - Component - - - KaraokeVideoPlayer.cs - MainForm.cs - - OverlayForm.cs - ResXFileCodeGenerator Resources.Designer.cs @@ -125,12 +92,6 @@ - - - {3203dfd2-da5b-47b3-b009-18dd9c401fc3} - CdgLib - - @@ -436,6 +397,12 @@ + + + {a5324295-6bd2-4415-92cd-6ea77d708e00} + CdgPlayer + + XCOPY "$(ProjectDir)lib" "$(TargetDir)lib\" /S /y /c diff --git a/KaraokePlayer/MainForm.Designer.cs b/KaraokePlayer/MainForm.Designer.cs index 345aca9..4e878e7 100644 --- a/KaraokePlayer/MainForm.Designer.cs +++ b/KaraokePlayer/MainForm.Designer.cs @@ -28,49 +28,199 @@ /// private void InitializeComponent() { - this.materialRaisedButton1 = new MaterialSkin.Controls.MaterialRaisedButton(); + this.btnPlay = new MaterialSkin.Controls.MaterialRaisedButton(); + this.btnBrowse = new MaterialSkin.Controls.MaterialRaisedButton(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.browseDialog = new System.Windows.Forms.FolderBrowserDialog(); this.karaokeVideoPlayer1 = new KaraokePlayer.KaraokeVideoPlayer(); + this.materialListBox1 = new MaterialSkin.Controls.MaterialListBox(); + this.materialSingleLineTextField1 = new MaterialSkin.Controls.MaterialSingleLineTextField(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel1.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); + this.splitContainer1.Panel1.SuspendLayout(); + this.splitContainer1.Panel2.SuspendLayout(); + this.splitContainer1.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); this.SuspendLayout(); // - // materialRaisedButton1 + // btnPlay // - this.materialRaisedButton1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.materialRaisedButton1.Depth = 0; - this.materialRaisedButton1.Location = new System.Drawing.Point(385, 358); - this.materialRaisedButton1.MouseState = MaterialSkin.MouseState.HOVER; - this.materialRaisedButton1.Name = "materialRaisedButton1"; - this.materialRaisedButton1.Size = new System.Drawing.Size(81, 37); - this.materialRaisedButton1.TabIndex = 1; - this.materialRaisedButton1.Text = "Play"; - this.materialRaisedButton1.UseVisualStyleBackColor = true; - this.materialRaisedButton1.Click += new System.EventHandler(this.materialRaisedButton1_Click); + this.btnPlay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnPlay.Depth = 0; + this.btnPlay.Location = new System.Drawing.Point(629, 3); + this.btnPlay.MouseState = MaterialSkin.MouseState.HOVER; + this.btnPlay.Name = "btnPlay"; + this.btnPlay.Size = new System.Drawing.Size(81, 37); + this.btnPlay.TabIndex = 1; + this.btnPlay.Text = "Play"; + this.btnPlay.UseVisualStyleBackColor = true; + this.btnPlay.Click += new System.EventHandler(this.materialRaisedButton1_Click); + // + // btnBrowse + // + this.btnBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnBrowse.Depth = 0; + this.btnBrowse.Location = new System.Drawing.Point(542, 3); + this.btnBrowse.MouseState = MaterialSkin.MouseState.HOVER; + this.btnBrowse.Name = "btnBrowse"; + this.btnBrowse.Size = new System.Drawing.Size(81, 37); + this.btnBrowse.TabIndex = 2; + this.btnBrowse.Text = "Browse"; + this.btnBrowse.UseVisualStyleBackColor = true; + this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tableLayoutPanel1.BackColor = System.Drawing.Color.Transparent; + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.splitContainer1, 0, 0); + this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 71); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.Size = new System.Drawing.Size(719, 513); + this.tableLayoutPanel1.TabIndex = 5; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.AutoSize = true; + this.flowLayoutPanel1.BackColor = System.Drawing.Color.Transparent; + this.flowLayoutPanel1.Controls.Add(this.btnPlay); + this.flowLayoutPanel1.Controls.Add(this.btnBrowse); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; + this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 467); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(713, 43); + this.flowLayoutPanel1.TabIndex = 6; + // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(3, 3); + this.splitContainer1.Name = "splitContainer1"; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.tableLayoutPanel2); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.karaokeVideoPlayer1); + this.splitContainer1.Size = new System.Drawing.Size(713, 458); + this.splitContainer1.SplitterDistance = 237; + this.splitContainer1.TabIndex = 6; + // + // browseDialog + // + this.browseDialog.SelectedPath = "D:\\Karaoke\\SF360 February 2016\\SF360-01 - Charlie Puth - One Call Away\\"; // // karaokeVideoPlayer1 // - this.karaokeVideoPlayer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.karaokeVideoPlayer1.Location = new System.Drawing.Point(12, 72); + this.karaokeVideoPlayer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.karaokeVideoPlayer1.Location = new System.Drawing.Point(0, 0); this.karaokeVideoPlayer1.Name = "karaokeVideoPlayer1"; - this.karaokeVideoPlayer1.Size = new System.Drawing.Size(454, 280); + this.karaokeVideoPlayer1.Size = new System.Drawing.Size(472, 458); this.karaokeVideoPlayer1.TabIndex = 0; // + // materialListBox1 + // + this.materialListBox1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); + this.materialListBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.materialListBox1.Depth = 0; + this.materialListBox1.Dock = System.Windows.Forms.DockStyle.Fill; + this.materialListBox1.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawVariable; + this.materialListBox1.Font = new System.Drawing.Font("Roboto", 24F); + this.materialListBox1.FormattingEnabled = true; + this.materialListBox1.Items.AddRange(new object[] { + "1", + "2", + "3", + "4"}); + this.materialListBox1.Location = new System.Drawing.Point(3, 32); + this.materialListBox1.MouseLocation = new System.Drawing.Point(-1, -1); + this.materialListBox1.MouseState = MaterialSkin.MouseState.HOVER; + this.materialListBox1.Name = "materialListBox1"; + this.materialListBox1.Size = new System.Drawing.Size(231, 423); + this.materialListBox1.TabIndex = 5; + this.materialListBox1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.materialListBox1_MouseDoubleClick); + // + // materialSingleLineTextField1 + // + this.materialSingleLineTextField1.Depth = 0; + this.materialSingleLineTextField1.Dock = System.Windows.Forms.DockStyle.Fill; + this.materialSingleLineTextField1.Hint = ""; + this.materialSingleLineTextField1.Location = new System.Drawing.Point(3, 3); + this.materialSingleLineTextField1.MaxLength = 32767; + this.materialSingleLineTextField1.MouseState = MaterialSkin.MouseState.HOVER; + this.materialSingleLineTextField1.Name = "materialSingleLineTextField1"; + this.materialSingleLineTextField1.PasswordChar = '\0'; + this.materialSingleLineTextField1.SelectedText = ""; + this.materialSingleLineTextField1.SelectionLength = 0; + this.materialSingleLineTextField1.SelectionStart = 0; + this.materialSingleLineTextField1.Size = new System.Drawing.Size(231, 23); + this.materialSingleLineTextField1.TabIndex = 6; + this.materialSingleLineTextField1.TabStop = false; + this.materialSingleLineTextField1.UseSystemPasswordChar = false; + this.materialSingleLineTextField1.TextChanged += new System.EventHandler(this.materialSingleLineTextField1_TextChanged); + // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.BackColor = System.Drawing.SystemColors.Control; + this.tableLayoutPanel2.ColumnCount = 1; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel2.Controls.Add(this.materialListBox1, 0, 1); + this.tableLayoutPanel2.Controls.Add(this.materialSingleLineTextField1, 0, 0); + this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 2; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel2.Size = new System.Drawing.Size(237, 458); + this.tableLayoutPanel2.TabIndex = 7; + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(478, 407); - this.Controls.Add(this.materialRaisedButton1); - this.Controls.Add(this.karaokeVideoPlayer1); + this.ClientSize = new System.Drawing.Size(743, 596); + this.Controls.Add(this.tableLayoutPanel1); this.Name = "MainForm"; this.Text = "Karaoke Player"; + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.flowLayoutPanel1.ResumeLayout(false); + this.splitContainer1.Panel1.ResumeLayout(false); + this.splitContainer1.Panel2.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); + this.splitContainer1.ResumeLayout(false); + this.tableLayoutPanel2.ResumeLayout(false); this.ResumeLayout(false); } #endregion - + private MaterialSkin.Controls.MaterialRaisedButton btnPlay; + private MaterialSkin.Controls.MaterialRaisedButton btnBrowse; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.FolderBrowserDialog browseDialog; + private System.Windows.Forms.SplitContainer splitContainer1; private KaraokeVideoPlayer karaokeVideoPlayer1; - private MaterialSkin.Controls.MaterialRaisedButton materialRaisedButton1; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + private MaterialSkin.Controls.MaterialListBox materialListBox1; + private MaterialSkin.Controls.MaterialSingleLineTextField materialSingleLineTextField1; } } \ No newline at end of file diff --git a/KaraokePlayer/MainForm.cs b/KaraokePlayer/MainForm.cs index 7caec18..0ded29f 100644 --- a/KaraokePlayer/MainForm.cs +++ b/KaraokePlayer/MainForm.cs @@ -1,19 +1,25 @@ using System; using MaterialSkin; using MaterialSkin.Controls; +using System.IO; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; namespace KaraokePlayer { public partial class MainForm : MaterialForm { private readonly MaterialSkinManager _materialSkinManager; + private List _fileList; + public MainForm() { InitializeComponent(); // Initialize MaterialSkinManager _materialSkinManager = MaterialSkinManager.Instance; _materialSkinManager.AddFormToManage(this); - _materialSkinManager.Theme = new DarkTheme(); + //_materialSkinManager.Theme = new DarkTheme(); _materialSkinManager.ColorScheme = new ColorScheme(Primary.Green600, Primary.Green700, Primary.Green200, Accent.Red100, TextShade.WHITE); } @@ -22,6 +28,32 @@ namespace KaraokePlayer karaokeVideoPlayer1.Play(new Uri(@"D:\Karaoke\SF360 February 2016\SF360-01 - Charlie Puth - One Call Away\SF360-01 - Charlie Puth - One Call Away.mp3")); } + private void btnBrowse_Click(object sender, EventArgs e) + { + if (browseDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + var files = System.IO.Directory.GetFiles(browseDialog.SelectedPath, "*.cdg", searchOption: System.IO.SearchOption.AllDirectories); + _fileList = files.Select(file => new FileInfo(file)).ToList(); + materialListBox1.DataSource = _fileList; + materialListBox1.DisplayMember = "Name"; + + } + } + + private void materialListBox1_MouseDoubleClick(object sender, System.Windows.Forms.MouseEventArgs e) + { + int index = this.materialListBox1.IndexFromPoint(e.Location); + if (index != System.Windows.Forms.ListBox.NoMatches) + { + karaokeVideoPlayer1.Play(new Uri(Path.ChangeExtension(((FileInfo)materialListBox1.Items[index]).FullName,".mp3"))); + } + } + + private void materialSingleLineTextField1_TextChanged(object sender, EventArgs e) + { + materialListBox1.DataSource = _fileList.Where( + file => Regex.IsMatch(file.Name, materialSingleLineTextField1.Text, RegexOptions.IgnoreCase)).ToList(); + } } } diff --git a/KaraokePlayer/MainForm.resx b/KaraokePlayer/MainForm.resx index 1af7de1..5e9a346 100644 --- a/KaraokePlayer/MainForm.resx +++ b/KaraokePlayer/MainForm.resx @@ -117,4 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + \ No newline at end of file diff --git a/KaraokePlayer/TransparentPanel.cs b/KaraokePlayer/TransparentPanel.cs deleted file mode 100644 index 3c7282a..0000000 --- a/KaraokePlayer/TransparentPanel.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace KaraokePlayer -{ - class TransparentPanel : PictureBox - { - public TransparentPanel() - { - this.SetStyle(ControlStyles.DoubleBuffer | - ControlStyles.AllPaintingInWmPaint | - ControlStyles.UserPaint | - ControlStyles.Opaque, true); - - } - - protected override void OnPaintBackground(PaintEventArgs e) - { - - System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red); - e.Graphics.FillRectangle(myBrush, new Rectangle(0, 0, 200, 300)); - //base.OnPaintBackground(e); - } - - protected override void OnPaint(PaintEventArgs e) - { - System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Red); - e.Graphics.FillRectangle(myBrush, new Rectangle(0, 0, 200, 300)); - //base.OnPaintBackground(e); - } - - - } -} diff --git a/KaraokePlayer/packages.config b/KaraokePlayer/packages.config index 08c7285..273ff53 100644 --- a/KaraokePlayer/packages.config +++ b/KaraokePlayer/packages.config @@ -1,7 +1,4 @@  - - - \ No newline at end of file