private void HandleInputFormLoad(object sender, EventArgs e) { _registrStore = new OptionStore(); _registrStore.RegisterProtocolHandler(); _option = _registrStore.Value; ModelToView(); }
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); }
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); } }