コード例 #1
0
 public bool Equals(ConnectionItemViewModel dest)
 {
     if (this.Name != dest.Name)
     {
         return(false);
     }
     if (this.Address != dest.Address)
     {
         return(false);
     }
     if (this.DataBaseName != dest.DataBaseName)
     {
         return(false);
     }
     if (this.ID != dest.ID)
     {
         return(false);
     }
     if (this.themeColor != dest.themeColor)
     {
         return(false);
     }
     if (this.theme != dest.theme)
     {
         return(false);
     }
     return(true);
 }
コード例 #2
0
 public void RemoveConnectionItem(ConnectionItemViewModel connectionItem)
 {
     if (this.ConnectionItem == connectionItem)
     {
         this.ConnectionItem = null;
     }
     this.connectionItems.Remove(connectionItem);
 }
コード例 #3
0
 private void ValidateSetConnectionItem(ConnectionItemViewModel value)
 {
     if (this.IsOpened == true)
     {
         if (value == null)
         {
             throw new ArgumentNullException(nameof(value));
         }
         if (this.connectionItem.Address != value.Address || this.connectionItem.ID != value.ID || this.connectionItem.PasswordID != value.PasswordID)
         {
             throw new ArgumentException(Resources.Exception_InvalidConnectionItem, nameof(value));
         }
     }
 }
コード例 #4
0
 public void Assign(ConnectionItemViewModel connectionInfo)
 {
     this.name                  = connectionInfo.name;
     this.address               = connectionInfo.address;
     this.dataBaseName          = connectionInfo.dataBaseName;
     this.userID                = connectionInfo.userID;
     this.password              = connectionInfo.password;
     this.themeColor            = connectionInfo.themeColor;
     this.theme                 = connectionInfo.theme;
     this.isDefault             = connectionInfo.isDefault;
     this.lastConnectedDateTime = connectionInfo.lastConnectedDateTime;
     this.Refresh();
     this.RefreshIsCurrentThemeProperty();
 }
コード例 #5
0
        public void EditConnectionItem(ConnectionItemViewModel connectionItem)
        {
            var dialog = new ConnectionItemEditViewModel(connectionItem.Clone());

            if (dialog.ShowDialog() == true)
            {
                connectionItem.Assign(dialog.ConnectionInfo);
                this.connectionItems.Write();
                if (this.ConnectionItem == connectionItem)
                {
                    FirstFloor.ModernUI.Presentation.AppearanceManager.Current.AccentColor = connectionItem.ThemeColor;
                    FirstFloor.ModernUI.Presentation.AppearanceManager.Current.ThemeSource = themes[connectionItem.Theme];
                    this.SetPassword(this.ConnectionItem.Password, true);
                }
            }
        }
コード例 #6
0
        void ICremaAppHost.Login(string address, string userID, string password, string dataBaseName)
        {
            var connectionItem = new ConnectionItemViewModel()
            {
                Name         = "Temporary",
                Address      = address,
                ID           = userID,
                Password     = StringUtility.Encrypt(password, userID),
                DataBaseName = dataBaseName,
                IsTemporary  = true,
                Theme        = this.Theme,
                ThemeColor   = this.ThemeColor,
            };

            this.ConnectionItems.Add(connectionItem);
            this.ConnectionItem = connectionItem;
            this.Login();
        }
コード例 #7
0
 private bool Filter(ConnectionItemViewModel connectionItem)
 {
     if (this.Filter(connectionItem.Name) == true)
     {
         return(true);
     }
     if (this.Filter(connectionItem.Address) == true)
     {
         return(true);
     }
     if (this.Filter(connectionItem.DataBaseName) == true)
     {
         return(true);
     }
     if (this.Filter(connectionItem.ID) == true)
     {
         return(true);
     }
     return(false);
 }