示例#1
0
 private void HandleInputFormLoad(object sender, EventArgs e)
 {
     _registrStore = new OptionStore();
     _registrStore.RegisterProtocolHandler();
     _option = _registrStore.Value;
     ModelToView();
 }
示例#2
0
        private DownloadRequest ViewToModel()
        {
            var option = new ConfigOption
            {
                UserName     = textBoxUserName.Text,
                Password     = textBoxPassword.Text,
                Server       = textBoxServer.Text,
                Port         = int.Parse(textBoxPort.Text),
                SavePassword = checkBoxSavePassword.Checked,
                FixIE        = checkBoxFixIE.Checked,
            };
            var req = new DownloadRequest
            {
                Option = option,
                Links  = DownloadRequest.ParseLinks(textBoxLinks.Text)
            };

            return(req);
        }
示例#3
0
        private void HandleButtonOkClick(object sender, EventArgs e)
        {
            if (!ValidateForm())
            {
                return;
            }
            var          req          = ViewToModel();
            ConfigOption configOption = req.Option;

            if (!configOption.Equals(_option))
            {
                _registrStore.Value = configOption;
                _option             = configOption;
            }
            try
            {
                req.Send();
                Close();
            }
            catch (WebException ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }