Example #1
0
 public ConnectionVM(Platform.Connection con)
 {
     Name      = con.Name;
     Address   = con.Address;
     Target    = con.Target;
     Port      = con.Port;
     Password  = con.Password;
     CanDelete = true;
 }
Example #2
0
 void Select(Platform.Connection connection)
 {
     if (connection != null)
     {
         ConnectionVM item = Connections.FirstOrDefault(c => c.Address == connection.Address && c.Port == connection.Port);
         if (item != null)
         {
             Selection = item;
             return;
         }
     }
     Selection = Connections.FirstOrDefault();
 }
Example #3
0
        public void Update(Platform.Connection connection)
        {
            ConnectionVM item = Connections.FirstOrDefault(c => c.Address == connection.Address && c.Port == connection.Port);

            if (item != null)
            {
                item.Name   = String.IsNullOrEmpty(connection.Name) ? connection.Target.ToString() : connection.Name;
                item.Target = connection.Target;
                if (item.CanEdit)
                {
                    item.CanEdit   = false;
                    item.CanDelete = true;
                }
            }
            else
            {
                item = new ConnectionVM(connection);
                Connections.Add(item);
            }
            AddEditableItem();
            Selection = item;
            Task.Run(() => Save());
        }