public StorageLinkConnectionManager(Func <ISynchronizeInvoke> synchronizer, ChangeableList <IXenConnection> xenConnections, object xenConnectionsLock)
        {
            Util.ThrowIfParameterNull(xenConnections, "xenConnections");
            Util.ThrowIfParameterNull(xenConnectionsLock, "xenConnectionsLock");

            _synchronizer       = synchronizer;
            _xenConnections     = xenConnections;
            _xenConnectionsLock = xenConnectionsLock;
            _xenConnections.CollectionChanged += XenConnections_CollectionChanged;
        }
Ejemplo n.º 2
0
 public void LaunchIfRequired(bool nag, ChangeableList <IXenConnection> connections, SelectedItemCollection selectedObjects)
 {
     if (selectedObjects != null && selectedObjects.AllItemsAre <IXenObject>(x => x is Pool || x is Host))
     {
         List <IXenObject> itemsSelected = selectedObjects.AsXenObjects <Pool>().ConvertAll(p => p as IXenObject);
         itemsSelected.AddRange(selectedObjects.AsXenObjects <Host>().Where(h => Helpers.GetPool(h.Connection) == null).ToList().ConvertAll(h => h as IXenObject));
         itemsSelected.AddRange(selectedObjects.AsXenObjects <Host>().Where(h => Helpers.GetPool(h.Connection) != null).ToList().ConvertAll(h => Helpers.GetPool(h.Connection)).ConvertAll(p => p as IXenObject).Distinct());
         LaunchIfRequired(nag, connections, itemsSelected);
     }
     else
     {
         LaunchIfRequired(nag, connections);
     }
 }
Ejemplo n.º 3
0
		public void TestCloningChangeableList()
		{
			foreach (int num1 in list)
			{
				Assert.AreEqual(1, num1);
				list.Add(1);
				var testList2 = new ChangeableList<int>(list);
				foreach (int num2 in testList2)
				{
					Assert.AreEqual(1, num2);
					testList2.Add(2);
					// The lists should be different here (testList2 is cloned)
					Assert.False(list == testList2);
					// But the data in it should be still equal.
					Assert.AreEqual(list.ToText(), testList2.ToText());
					break;
				}
				break;
			}
		}
 public void TestCloningChangeableList()
 {
     foreach (int num1 in list)
     {
         Assert.AreEqual(1, num1);
         list.Add(1);
         var testList2 = new ChangeableList <int>(list);
         foreach (int num2 in testList2)
         {
             Assert.AreEqual(1, num2);
             testList2.Add(2);
             // The lists should be different here (testList2 is cloned)
             Assert.False(list == testList2);
             // But the data in it should be still equal.
             Assert.AreEqual(list.ToText(), testList2.ToText());
             break;
         }
         break;
     }
 }
Ejemplo n.º 5
0
 public void LaunchIfRequired(bool nag, ChangeableList<IXenConnection> connections)
 {
     LaunchIfRequired(nag, connections, Enumerable.Empty<IXenObject>());
 }
Ejemplo n.º 6
0
 public void LaunchIfRequired(bool nag, ChangeableList<IXenConnection> connections, SelectedItemCollection selectedObjects)
 {
     if (selectedObjects != null && selectedObjects.AllItemsAre<IXenObject>(x => x is Pool || x is Host))
     {
         List<IXenObject> itemsSelected = selectedObjects.AsXenObjects<Pool>().ConvertAll(p => p as IXenObject);
         itemsSelected.AddRange(selectedObjects.AsXenObjects<Host>().Where(h => Helpers.GetPool(h.Connection) == null).ToList().ConvertAll(h => h as IXenObject));
         itemsSelected.AddRange(selectedObjects.AsXenObjects<Host>().Where(h => Helpers.GetPool(h.Connection) != null).ToList().ConvertAll(h => Helpers.GetPool(h.Connection)).ConvertAll(p => p as IXenObject).Distinct());
         if(itemsSelected.All(xo => Helpers.ClearwaterOrGreater(xo.Connection)) || 
            itemsSelected.All(xo => !Helpers.ClearwaterOrGreater(xo.Connection)))
         {
             LaunchIfRequired(nag, connections, itemsSelected);
         }
         else
             LaunchIfRequired(nag, connections, itemsSelected.Where(xo => Helpers.ClearwaterOrGreater(xo.Connection)));
     }
     else
         LaunchIfRequired(nag, connections);
 }
Ejemplo n.º 7
0
 public void LaunchIfRequired(bool nag, ChangeableList <IXenConnection> connections)
 {
     LaunchIfRequired(nag, connections, Enumerable.Empty <IXenObject>());
 }
Ejemplo n.º 8
0
		public void SetUp()
		{
			list = new ChangeableList<int> { 1, 3, 5 };
		}
 public void SetUp()
 {
     list = new ChangeableList <int> {
         1, 3, 5
     };
 }