示例#1
0
        private FlowLayoutPanel CreateButtons(EntrySettings settings)
        {
            var flow = new FlowLayoutPanel();

            flow.Width         = this.notesCtrl.Width + 10;
            flow.Height        = 50;
            flow.AutoSize      = false;
            flow.FlowDirection = FlowDirection.LeftToRight;
            flow.WrapContents  = true;
            flow.Margin        = new Padding(0);

            int index = 0;

            foreach (var entry in settings.entries)
            {
                flow.Controls.Add(CreateSSHButton(index, entry.title));
                index += 1;
            }

            var btnAdd = CreateNormalButton("Add");

            btnAdd.Click += OnAddButtonClick;
            flow.Controls.Add(btnAdd);
            flow.ResumeLayout(false);
            flow.PerformLayout();

            return(flow);
        }
示例#2
0
        public Entry(ChatViewManager chatViewManager)
        {
            Trace.Call(chatViewManager);

            if (chatViewManager == null)
            {
                throw new ArgumentNullException("chatViewManager");
            }

            _History.Add(String.Empty);

            ChatViewManager = chatViewManager;
            Settings        = new EntrySettings();
            WrapMode        = Gtk.WrapMode.WordChar;

            InitSpellCheck();
            InitCommandManager();
            Frontend.SessionPropertyChanged += delegate {
                InitCommandManager();
            };

            Activated      += _OnActivated;
            KeyPressEvent  += new Gtk.KeyPressEventHandler(_OnKeyPress);
            PasteClipboard += _OnClipboardPasted;
        }
示例#3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var pwEntryForm = ParentForm as PwEntryForm;

            if (pwEntryForm != null)
            {
                InitialSettings = EntrySettings.Load(pwEntryForm.EntryRef);

                if (InitialSettings == null)
                {
                    CurrentSettings = new EntrySettings();
                }
                else
                {
                    CurrentSettings = InitialSettings.Clone();
                }

                UpdateControls(CurrentSettings);
            }

            btnAdd.Enabled    = true;
            btnEdit.Enabled   = false;
            btnRemove.Enabled = false;
            btnLaunch.Enabled = false;

            sshEntries.Items.Add(new ListViewItem(new string[] { "Trigon Worker", "[email protected]:4565" }));
            sshEntries.Items.Add(new ListViewItem(new string[] { "Trigon Manager", "[email protected]:4565" }));
        }
示例#4
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     pwEntryForm = ParentForm as PwEntryForm;
     if (pwEntryForm != null)
     {
         IntialSettings =
             pwEntryForm.EntryRef.GetKeeAgentSettings();
         CurrentSettings = (EntrySettings)IntialSettings.Clone();
         entrySettingsBindingSource.DataSource = CurrentSettings;
         keyLocationPanel.KeyLocationChanged  += delegate {
             UpdateKeyInfoDelayed();
         };
         pwEntryForm.FormClosing += delegate {
             while (delayedUpdateKeyInfoTimer.Enabled)
             {
                 Application.DoEvents();
             }
         };
     }
     else
     {
         Debug.Fail("Don't have settings to bind to");
     }
     // replace the confirm constraint checkbox if the global confirm option is enabled
     if (ext.Options.AlwaysConfirm)
     {
         confirmConstraintCheckBox.ReplaceWithGlobalConfirmMessage();
     }
     UpdateControlStates();
 }
示例#5
0
 public EntriesPool(EntrySettings settings, EntriesContainer container,
                    SceneController controller, int entriesNumber)
 {
     _entrySettings = settings;
     _container     = container;
     _controller    = controller;
     _entries       = new List <GameObject>(entriesNumber);
     CreateEntries(entriesNumber);
 }
示例#6
0
        private void Update()
        {
            initialSettings = EntrySettings.Load(form.EntryRef);
            if (initialSettings == null)
            {
                initialSettings = new EntrySettings();
            }
            currentSettings = initialSettings.Clone();

            Update(currentSettings);
        }
示例#7
0
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
       pwEntryForm = ParentForm as PwEntryForm;
       if (pwEntryForm != null) {
     IntialSettings =
       pwEntryForm.EntryRef.GetKeeAgentSettings();
     CurrentSettings = (EntrySettings)IntialSettings.Clone ();
     entrySettingsBindingSource.DataSource = CurrentSettings;
     keyLocationPanel.KeyLocationChanged += delegate {
       UpdateKeyInfoDelayed();
     };
     pwEntryForm.FormClosing += delegate {
       while (delayedUpdateKeyInfoTimer.Enabled)
     Application.DoEvents();
     };
       } else {
     Debug.Fail("Don't have settings to bind to");
       }
       UpdateControlStates();
 }
示例#8
0
文件: Entry.cs 项目: shubhtr/smuxi
        public Entry(MainWindow mainWindow, ChatViewManager chatViewManager)
        {
            if (mainWindow == null)
            {
                throw new ArgumentNullException("mainWindow");
            }
            if (chatViewManager == null)
            {
                throw new ArgumentNullException("chatViewManager");
            }

            f_MainWindow             = mainWindow;
            f_MainWindow.KeyPressed += OnKeyPressed;

            f_ChatViewManager = chatViewManager;

            Frontend.SessionPropertyChanged += delegate {
                InitCommandManager();
            };

            Settings      = new EntrySettings();
            NickCompleter = new TabCycleNickCompleter();
        }
示例#9
0
        /*
         * public StringCollection History {
         *  get {
         *      return _History;
         *  }
         * }
         */

        /*
         * public int HistoryPosition {
         *  get {
         *      return _HistoryPosition;
         *  }
         *  set {
         *      _HistoryPosition = value;
         *  }
         * }
         */

        /*
         * public bool HistoryChangedLine {
         *  get {
         *      return _HistoryChangedLine;
         *  }
         *  set {
         *      _HistoryChangedLine = value;
         *  }
         * }
         */

        public Entry(ChatViewManager chatViewManager)
        {
            Trace.Call(chatViewManager);

            if (chatViewManager == null)
            {
                throw new ArgumentNullException("chatViewManager");
            }

            _History.Add(String.Empty);

            ChatViewManager = chatViewManager;
            Settings        = new EntrySettings();

            InitCommandManager();
            Frontend.SessionPropertyChanged += delegate {
                InitCommandManager();
            };

            Activated       += new EventHandler(_OnActivated);
            KeyPressEvent   += new Gtk.KeyPressEventHandler(_OnKeyPress);
            FocusOutEvent   += new Gtk.FocusOutEventHandler(_OnFocusOut);
            ClipboardPasted += new EventHandler(_OnClipboardPasted);
        }
示例#10
0
        private void Update(EntrySettings settings)
        {
            var container = notesCtrl.Parent;

            if (sshButtons != null)
            {
                container.Controls.Remove(sshButtons);
                sshButtons.Dispose();
                sshButtons = null;
            }

            if (sshLabel == null)
            {
                sshLabel          = new Label();
                sshLabel.Location = notesLabelLocation;
                sshLabel.Width    = 70;
                sshLabel.Text     = "AutoGen:";
                container.Controls.Add(sshLabel);
            }

            sshButtons          = CreateButtons(settings);
            sshButtons.Location = new Point(notesLocation.X - 5, notesLocation.Y - 5);

            var lastBtn       = sshButtons.Controls[sshButtons.Controls.Count - 1] as Button;
            var buttonsHeight = lastBtn.Location.Y + lastBtn.Height;

            sshButtons.Height = buttonsHeight;

            notesLabel.Location = new Point(notesLabelLocation.X, notesLabelLocation.Y + buttonsHeight);
            notesCtrl.Location  = new Point(notesLocation.X, notesLocation.Y + buttonsHeight);
            notesCtrl.Height    = notesHeight - buttonsHeight;

            container.Controls.Add(sshButtons);
            container.ResumeLayout(false);
            container.PerformLayout();
        }
示例#11
0
 public static void SetKeeAgentSettings(this ProtectedBinaryDictionary binaries,
     EntrySettings settings)
 {
     // only save if there is an existing entry or AllowUseOfSshKey is checked
       // this way we don't pollute entries that don't have SSH keys
       if (binaries.Get(settingsBinaryId) != null ||
     settings.AllowUseOfSshKey)
       {
     using (var writer = new StringWriter()) {
       EntrySettingsSerializer.Serialize(writer, settings);
       // string is protected just to make UI look cleaner
       binaries.Set(settingsBinaryId,
     new ProtectedBinary(false, Encoding.Unicode.GetBytes(writer.ToString())));
     }
       }
 }
示例#12
0
 public static void SetKeeAgentSettings(this PwEntry entry,
     EntrySettings settings)
 {
     entry.Binaries.SetKeeAgentSettings(settings);
       // remove old settings string
       if (entry.Strings.GetKeys().Contains(settingsStringId)) {
     entry.Strings.Remove(settingsStringId);
       }
 }
示例#13
0
 private void UpdateControls(EntrySettings settings)
 {
     // testValueInp.Text = settings.test;
 }