Skip to content

Commit

Permalink
Made code easier to understand
Browse files Browse the repository at this point in the history
  • Loading branch information
Codeusa committed Jan 14, 2014
1 parent dfd4184 commit 52042d7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
27 changes: 17 additions & 10 deletions Borderless.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
}


Expand Down Expand Up @@ -189,16 +196,16 @@ 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
//on the screen it is currently occupying instead of using the primary screen
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
Expand Down
2 changes: 1 addition & 1 deletion Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]

0 comments on commit 52042d7

Please sign in to comment.