void btnDeleteCloudAccount_Click(object sender, RoutedEventArgs e)
        {
            object obj = lbCloudAccounts.SelectedItem;

            if (obj == null)
            {
                return;
            }

            try
            {
                if (obj.GetType() == typeof(SVR_CloudAccount))
                {
                    SVR_CloudAccount ns = (SVR_CloudAccount)obj;

                    MessageBoxResult res = MessageBox.Show(
                        string.Format(Shoko.Commons.Properties.Resources.CloudAccounts_RemoveMessage, ns.Name,
                                      ns.Provider), Shoko.Commons.Properties.Resources.Confirm, MessageBoxButton.YesNo,
                        MessageBoxImage.Question);
                    if (res == MessageBoxResult.Yes)
                    {
                        Cursor = Cursors.Wait;
                        Importer.DeleteCloudAccount(ns.CloudID);
                        Cursor = Cursors.Arrow;
                    }
                }
            }
            catch (Exception ex)
            {
                Cursor = Cursors.Arrow;
                Utils.ShowErrorMessage(ex);
            }
        }
        void EditAccount(SVR_CloudAccount account)
        {
            CloudAccountForm frm = new CloudAccountForm();

            frm.Owner = GetTopParent();
            frm.Init(account);
            frm.ShowDialog();
            ServerInfo.Instance.RefreshCloudAccounts();
        }
Exemplo n.º 3
0
 public static CL_CloudAccount ToClient(this SVR_CloudAccount cloud)
 {
     return(new CL_CloudAccount
     {
         Provider = cloud.Provider,
         Name = cloud.Name,
         CloudID = cloud.CloudID,
         Icon = cloud.Icon
     });
 }
        void lbCloudAccount_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            object obj = lbCloudAccounts.SelectedItem;

            if (obj == null)
            {
                return;
            }
            SVR_CloudAccount ns = (SVR_CloudAccount)obj;

            EditAccount(ns);
        }
Exemplo n.º 5
0
        public void Init(SVR_CloudAccount account)
        {
            SaveAccount = account;

            WorkingAccount = account != null
                ? new SVR_CloudAccount
            {
                CloudID          = account.CloudID,
                Name             = account.Name,
                ConnectionString = account.ConnectionString,
                Provider         = account.Provider
            }
                : new SVR_CloudAccount();
            SetConnectStatus();
            try
            {
                if (!string.IsNullOrEmpty(WorkingAccount.Provider))
                {
                    ServerInfo.CloudProvider v =
                        ServerInfo.Instance.CloudProviders.FirstOrDefault(a => a.Name == WorkingAccount.Provider);
                    if (v != null)
                    {
                        comboProvider.SelectedItem = v;
                    }
                }
                if (!string.IsNullOrEmpty(WorkingAccount.Name))
                {
                    txtCloudAccountName.Text = WorkingAccount.Name;
                }
                comboProvider.Focus();
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
Exemplo n.º 6
0
 public void Init(SVR_ImportFolder acc, string initialpath)
 {
     _account = acc.CloudAccount;
     PopulateMainDir(initialpath);
 }
Exemplo n.º 7
0
 public void RefreshFolderProviders()
 {
     FolderProviders.Clear();
     FolderProviders.Add(SVR_CloudAccount.CreateLocalFileSystemAccount());
     RepoFactory.CloudAccount.GetAll().ForEach(a => FolderProviders.Add(a));
 }