Widow

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ HEAD  →  ?path2? @ 1
File deleted
\ No newline at end of file
/trunk/Windows/WindowHash.cs
/trunk/Windows/Window.cs
@@ -10,54 +10,22 @@
{
#region Public Enums, Properties and Fields
 
[XmlElement(ElementName = "Process")]
public string Class
{
get => _class;
set
{
if (value == _class)
{
return;
}
 
_class = value;
OnPropertyChanged();
}
}
 
[XmlElement(ElementName = "Name")]
public string Title
public string Name
{
get => _title;
get => _name;
set
{
if (value == _title)
if (value == _name)
{
return;
}
 
_title = value;
_name = value;
OnPropertyChanged();
}
}
 
[XmlElement(ElementName = "IgnoreWidth")]
public bool IgnoreWidth
{
get => _ignoreWidth;
set
{
if (value == _ignoreWidth)
{
return;
}
 
_ignoreWidth = value;
OnPropertyChanged();
}
}
 
[XmlElement(ElementName = "Width")]
public int Width
{
@@ -74,22 +42,6 @@
}
}
 
[XmlElement(ElementName = "IgnoreHeight")]
public bool IgnoreHeight
{
get => _ignoreHeight;
set
{
if (value == _ignoreHeight)
{
return;
}
 
_ignoreHeight = value;
OnPropertyChanged();
}
}
 
[XmlElement(ElementName = "Height")]
public int Height
{
@@ -106,22 +58,6 @@
}
}
 
[XmlElement(ElementName = "IgnoreLeft")]
public bool IgnoreLeft
{
get => _ignoreLeft;
set
{
if (value == _ignoreLeft)
{
return;
}
 
_ignoreLeft = value;
OnPropertyChanged();
}
}
 
[XmlElement(ElementName = "Left")]
public int Left
{
@@ -138,22 +74,6 @@
}
}
 
[XmlElement(ElementName = "IgnoreTop")]
public bool IgnoreTop
{
get => _ignoreTop;
set
{
if (value == _ignoreTop)
{
return;
}
 
_ignoreTop = value;
OnPropertyChanged();
}
}
 
[XmlElement(ElementName = "Top")]
public int Top
{
@@ -174,21 +94,11 @@
 
#region Private Delegates, Events, Enums, Properties, Indexers and Fields
 
private string _class;
 
private int _height;
 
private bool _ignoreHeight;
 
private bool _ignoreLeft;
 
private bool _ignoreTop;
 
private bool _ignoreWidth;
 
private int _left;
 
private string _title;
private string _name;
 
private int _top;
 
@@ -202,11 +112,9 @@
public Window()
{
}
 
public Window(string @class, string title, int top, int left, int width, int height) : this()
public Window(string name, int top, int left, int width, int height) : this()
{
Class = @class;
Title = title;
Name = name;
Top = top;
Left = left;
Width = width;
/trunk/Windows/Windows.cs
@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Xml.Serialization;
using Windows.Annotations;
@@ -11,12 +7,12 @@
namespace Windows
{
[XmlRoot(Namespace = "urn:widow-windows-schema", ElementName = "Windows")]
public class Windows : INotifyPropertyChanged, IDisposable
public class Windows : INotifyPropertyChanged
{
#region Public Enums, Properties and Fields
 
[XmlElement(ElementName = "Window")]
public ObservableCollection<Window> Window
public List<Window> Window
{
get => _window;
set
@@ -26,25 +22,7 @@
return;
}
 
_window.CollectionChanged -= Window_CollectionChanged;
 
_window.Clear();
_windows.Clear();
foreach (var window in value)
{
_window.Add(window);
 
var windowHash = new WindowHash(window.Title, window.Class);
 
if (_windows.ContainsKey(windowHash))
{
continue;
}
 
_windows.Add(windowHash, window);
}
 
_window.CollectionChanged += Window_CollectionChanged;
_window = value;
OnPropertyChanged();
}
}
@@ -53,10 +31,8 @@
 
#region Private Delegates, Events, Enums, Properties, Indexers and Fields
 
private readonly ObservableCollection<Window> _window = new ObservableCollection<Window>();
private List<Window> _window = new List<Window>();
 
private readonly Dictionary<WindowHash, Window> _windows = new Dictionary<WindowHash, Window>();
 
#endregion
 
#region Constructors, Destructors and Finalizers
@@ -64,14 +40,8 @@
[UsedImplicitly]
public Windows()
{
_window.CollectionChanged += Window_CollectionChanged;
}
 
public void Dispose()
{
Window.CollectionChanged -= Window_CollectionChanged;
}
 
#endregion
 
#region Interface
@@ -80,49 +50,6 @@
 
#endregion
 
#region Event Handlers
 
private void Window_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
{
if (e.OldItems != null)
{
foreach (var window in e.OldItems.OfType<Window>())
{
var windowHash = new WindowHash(window.Title, window.Class);
 
if (_windows.ContainsKey(windowHash))
{
_windows.Remove(windowHash);
}
}
}
 
 
if (e.NewItems != null)
{
foreach (var window in e.NewItems.OfType<Window>())
{
var windowHash = new WindowHash(window.Title, window.Class);
 
if (!_windows.ContainsKey(windowHash))
{
_windows.Add(windowHash, window);
}
}
}
}
 
#endregion
 
#region Public Methods
 
public bool TryGetWindow(WindowHash hash, out Window window)
{
return _windows.TryGetValue(hash, out window);
}
 
#endregion
 
#region Private Methods
 
[NotifyPropertyChangedInvocator]
/trunk/Windows/Windows.csproj
@@ -43,7 +43,6 @@
<ItemGroup>
<Compile Include="Properties\Annotations.cs" />
<Compile Include="Window.cs" />
<Compile Include="WindowHash.cs" />
<Compile Include="Windows.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>