Beispiel #1
0
        private void buttonCreateSubmit_Click(object sender, RoutedEventArgs e)
        {
            Credentials     c = this.getCredentials();
            MachineContents m = this.getMachine();

            try {
                Ref.AddUser(c, this.getUser());

                this.DialogResult = true;
                //MessageBox.Show("User was created!");

                Ref.Login(c);
                Ref.AddMachine(c, m);

                parentWindow.credentials = c;
                Ref.GetDirList(c, m);
                //parentWindow.machine = new MachineContents(c, id, false, false, true);
                Ref.AddLocalDirs(m);
                //MachineActions.GetContets(c, id);

                //MessageBox.Show("Machine was created!");
                this.Close();
            } catch (ActionException ex) {
                new SystemMessage(ex).ShowDialog();
            }
        }
Beispiel #2
0
        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();
            }
        }