private void buttonCreateSelectMachine_Click(object sender, RoutedEventArgs e) { if (!LoggedIn) { return; } //temporary UserContents user = connection.GetUserWithMachines(credentials); //new UserContents(credentials, true).Machines; // UserActions.GetContents(this.credentials).Machines; this.machine = connection.GetMachineWithDirs(credentials, user.Machines[0]); //this.machine = user.Machines[0]; //new MachineContents(credentials, machines[0], true, false, true); //MachineActions.GetContets(credentials, machines[0]); RefreshDisplayedMachineInfo(); if (machine != null) { return; } //end of temporary if (new MachineWindow(this).ShowDialog() == false) { return; } if (this.machine == null) { LoggedInAndChosenMachine = false; return; } RefreshDisplayedMachineInfo(); try { //foreach (DirContents dc in MachineActions.GetDirsContents(credentials, machine)) // directories.Add(dc); //if (PropertyChanged != null) // PropertyChanged(this, new PropertyChangedEventArgs("Directories")); } catch (ActionException ex) { MessageBox.Show(ex.Message, ex.Title); } RefreshDisplayedDirectories(); }
private void buttonCreateSubmit_Click(object sender, RoutedEventArgs e) { Credentials c = this.getCredentials(); MachineContents m = this.getMachine(); try { if (connection.AddUser(this.getUser())) { this.DialogResult = true; //MessageBox.Show("User was created!"); connection.Login(c); if (connection.AddMachine(c, m)) { parentWindow.credentials = c; m = connection.GetMachineWithDirs(c, m); //parentWindow.machine = new MachineContents(c, id, false, false, true); m = local.ReadMachineContents(m); //MachineActions.GetContets(c, id); //MessageBox.Show("Machine was created!"); this.Close(); } else { new SystemMessage(new ActionException("Could not create a machine.", ActionType.Machine)).ShowDialog(); } } else { new SystemMessage(new ActionException("Sorry, an error.", ActionType.User)).ShowDialog(); } } catch (ActionException ex) { new SystemMessage(ex).ShowDialog(); } catch (Exception ex) { new SystemMessage(new ActionException("Sorry, an error.", ActionType.User, null, ex)).ShowDialog(); } }