예제 #1
0
        void SetAccount(IFsAccount acc)
        {
            this.account = acc;
            foreach (IAccountEditor ed in editors)
            {
                if (!ed.TrySetAccount(acc))
                {
                    continue;
                }
                this.CurrentEditor = ed;
                return;
            }

            // 新しいエディタインスタンス
            IAccountEditor newEditor = acc.CreateEditorInstance();
            Forms::Control ctrl      = newEditor as Forms::Control;

            if (ctrl == null)
            {
                throw new System.Exception("IAccountEditor を実装するクラスは System.Windows.Forms.Control を継承しなければなりません。");
            }
            if (!newEditor.TrySetAccount(acc))
            {
                throw new System.Exception("IAccount.CreateEditorInstance によって得られたエディタは、TrySetAccount で元のアカウントを受理する必要があります。");
            }

            // 登録
            this.editors.Add(newEditor);
            this.editorContainer.Controls.Add(ctrl);
            this.CurrentEditor = newEditor;
        }
예제 #2
0
 private bool AccExchange(int i, int j)
 {
     if (i < 0 || j < 0 || i >= setting.accounts.Count || j >= setting.accounts.Count)
     {
         return(false);
     }
     lock (setting.accounts){
         IFsAccount tmp = setting.accounts[i];
         setting.accounts[i] = setting.accounts[j];
         setting.accounts[j] = tmp;
     }
     lock (listBox1.Items){
         object tmp = this.listBox1.Items[i];
         this.listBox1.Items[i] = this.listBox1.Items[j];
         this.listBox1.Items[j] = tmp;
     }
     return(true);
 }
예제 #3
0
 public ListBoxItem(IFsAccount acc)
 {
     this.acc = acc;
 }
예제 #4
0
 public void AddAccount(IFsAccount account)
 {
     this.accounts.Add(account);
 }