Пример #1
0
        private void btnDuplicate_Click(object sender, EventArgs e)
        {
            if (lstShortcuts.SelectedIndex != -1)
            {
                AubitDesktop.Xml.Shortcut s;
                int idx;
                AubitDesktop.Xml.Shortcut snew;
                s                      = Program.AppSettings.Shortcuts[lstShortcuts.SelectedIndex];
                snew                   = new AubitDesktop.Xml.Shortcut();
                snew.Application       = s.Application;
                snew.Password          = s.Password;
                snew.Port              = s.Port;
                snew.PromptForPassword = s.PromptForPassword;
                snew.Protocol          = s.Protocol;
                snew.Server            = s.Server;
                snew.Title             = s.Title.Trim() + "(Copy)";
                snew.User              = s.User;


                Program.AppSettings.Shortcuts.Add(snew);
                Program.SaveSettings();
                ShowShortcuts();
                idx = lstShortcuts.FindString(snew.Title);
                if (idx >= 0)
                {
                    lstShortcuts.SelectedIndex = idx;
                }
            }
        }
Пример #2
0
        public frmShortcut(AubitDesktop.Xml.Shortcut sc)
        {
            InitializeComponent();
            this.shortcut = sc;

            lstProtocol.Items.Clear();
            foreach (AubitDesktop.Xml.Protocol p in Program.AppSettings.Protocols)

            {
                lstProtocol.Items.Add(p.Name);
            }


            if (this.shortcut != null)
            {
                int cnt = 0;
                txtApplication.Text = shortcut.Application;

                txtPassword.Text = shortcut.Password;

                cbPromptPassword.Checked = shortcut.PromptForPassword;
                txtServer.Text           = shortcut.Server;

                txtTitle.Text = shortcut.Title;

                txtUser.Text = shortcut.User;


                lstProtocol.ClearSelected();

                for (cnt = 0; cnt < Program.AppSettings.Protocols.Length; cnt++)
                {
                    if (Program.AppSettings.Protocols[cnt].Code == shortcut.Protocol)
                    {
                        this.lstProtocol.SelectedIndex = cnt;
                        break;
                    }
                }
                if (shortcut.Port != null && shortcut.Port.Length > 0)
                {
                    txtPort.Text = shortcut.Port;
                }
            }
        }
Пример #3
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (this.lstProtocol.SelectedIndex == -1)
            {
                Program.Show("You must select a protocol");
                lstProtocol.Focus();
                return;
            }
            if (shortcut == null)
            {
                shortcut = new AubitDesktop.Xml.Shortcut();
            }

            shortcut.Application       = txtApplication.Text;
            shortcut.Password          = txtPassword.Text;
            shortcut.PromptForPassword = cbPromptPassword.Checked;
            shortcut.Protocol          = Program.AppSettings.Protocols[this.lstProtocol.SelectedIndex].Code;
            shortcut.Server            = txtServer.Text;
            shortcut.Port  = txtPort.Text;
            shortcut.Title = txtTitle.Text;
            shortcut.User  = txtUser.Text;

            this.Visible = false;
        }