private void OkButton_Click(object sender, EventArgs e) { store.Username = UsernameTextBox.Text; store.Password = PasswordTextBox.Text; try { Random rand = new Random(); int r = rand.Next(); CodinggainClipboardService.ClipboardInterfaceClient remoteClipboard = new CodinggainClipboardService.ClipboardInterfaceClient(); //ClipboardServiceTest.ClipboardInterfaceClient remoteClipboard = new ClipboardServiceTest.ClipboardInterfaceClient(); store.Valid = remoteClipboard.checkCredantials(store.Username, store.getPassword(r), r); remoteClipboard.Close(); } catch (Exception ex) { store.Valid = false; } DialogResult = DialogResult.OK; Close(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { scratchPad.FormClosed += ScratchPad_FormClosed; scratchPad.Show(); enabledToolStripMenuItem.Checked = true; if (File.Exists("userinfo.dat")) { XmlSerializer ser = new XmlSerializer(typeof(User)); UserCredentialsStore store = UserCredentialsStore.GetInstance(); Random rand = new Random(); int r = rand.Next(); StreamReader file = new StreamReader("userinfo.dat"); User user = (User)ser.Deserialize(file); store.Credentials = user; CodinggainClipboardService.ClipboardInterfaceClient remoteClipboard = new CodinggainClipboardService.ClipboardInterfaceClient(); //ClipboardServiceTest.ClipboardInterfaceClient remoteClipboard = new ClipboardServiceTest.ClipboardInterfaceClient(); store.Valid = remoteClipboard.checkCredantials(store.Username, store.getPassword(r), r); SendButton.Enabled = store.Valid; uploadScheduleToolStripMenuItem.Enabled = store.Valid; if (store.Valid) { MaxUploadSize = remoteClipboard.getMaxSize(); uploadTimer.Interval = 60 * 1000 * 5; uploadTimer.Start(); } remoteClipboard.Close(); } scratchPad.LoadScratchDates(); scratchPad.intialise(); } catch (Exception ex) { } }