From 52042d79676b793518dab5e3ff4c6c94252aecd2 Mon Sep 17 00:00:00 2001 From: Codeusa Date: Mon, 13 Jan 2014 20:33:47 -0500 Subject: [PATCH] Made code easier to understand --- Borderless.cs | 27 +++++++++++++++++---------- Program.cs | 2 +- Properties/AssemblyInfo.cs | 4 ++-- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/Borderless.cs b/Borderless.cs index 257eec6..9f82557 100644 --- a/Borderless.cs +++ b/Borderless.cs @@ -80,7 +80,7 @@ private void _BackgroundWork(object sender, DoWorkEventArgs e) var windowText = ""; while (true) { - processList.Invoke((MethodInvoker) delegate + processList.Invoke((MethodInvoker)delegate { //Code to modify control will go here processList.DataSource = null; @@ -125,17 +125,24 @@ private void PopulateList() //Adds active windows to the processDataList processList.DataSource = _tempList; var processlist = Process.GetProcesses(); - foreach ( - var process in - processlist.Where(process => process != null) - .Where(process => !process.ProcessName.Equals("explorer"))) + foreach (var process in processlist) { + if (process == null) + { + continue; + } + if (process.ProcessName.Equals("explorer")) + { + continue; + } if (String.IsNullOrEmpty(process.MainWindowTitle)) { Native.SetWindowText(process.MainWindowHandle, process.ProcessName); } - if (process.MainWindowTitle.Length <= 0) continue; - _processDataList.Add(process.ProcessName); + if (process.MainWindowTitle.Length > 0) + { + _processDataList.Add(process.ProcessName); + } } @@ -189,7 +196,7 @@ private void RemoveBorder(String procName) //actually make it frameless //If on multiple screens it will grab bounds from the screen it is most on. //If not on any screen it grabs bounds from the screen closest var bounds = Screen.FromHandle(pFoundWindow).Bounds; - + if (!_borderlessWindows.Contains(pFoundWindow.ToInt32().ToString())) { //Using bounds.X and bounds.Y instead of 0, 0 so it will orient the window @@ -197,8 +204,8 @@ private void RemoveBorder(String procName) //actually make it frameless Native.SetWindowPos(pFoundWindow, 0, bounds.X, bounds.Y, bounds.Width, bounds.Height, SWP_NOZORDER | SWP_SHOWWINDOW); _borderlessWindows.Add(pFoundWindow.ToInt32().ToString()); } //today I learn the definition of a hot fix - - + + //no more outside window // CheckNativeResult(() => Native.MoveWindow(pFoundWindow, 0, 0, bounds.Width, bounds.Height, true)); //resets window to main monito diff --git a/Program.cs b/Program.cs index 8a0e37e..98a26fe 100644 --- a/Program.cs +++ b/Program.cs @@ -19,7 +19,7 @@ private static void Main() Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Borderless()); - /* AppDomain.CurrentDomain.FirstChanceException += (sender, args) => + /* AppDomain.CurrentDomain.FirstChanceException += (sender, args) => { MessageBox.Show(args.Exception.Message, "FirstChanceException"); diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index dbca34d..1e4eae6 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -33,6 +33,6 @@ // 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("4.5.0.0")] -[assembly: AssemblyFileVersion("4.5.0.0")] +[assembly: AssemblyVersion("4.6.0.0")] +[assembly: AssemblyFileVersion("4.6.0.0")] [assembly: NeutralResourcesLanguageAttribute("en-US")]