Beispiel #1
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!closeProject)
            {
                DialogResult result = MetroMessageBox.Show(this, "\nDo u want to save your current project ?", "Exit?", MessageBoxButtons.YesNoCancel);

                if (result == DialogResult.Cancel)
                {
                    e.Cancel = true;
                }
                else if (result == DialogResult.Yes)
                {
                    e.Cancel = false;
                    ProjectHandler.saveProject();
                }
                else
                {
                    e.Cancel = false;
                }
            }
            else
            {
                e.Cancel = false;
            }
        }
Beispiel #2
0
 public void RemoveHost(string id)
 {
     foreach (Survey survey in projet.model.surveys)
     {
         if (survey.host != null && survey.host.id != null)
         {
             survey.host = null;
             break;
         }
     }
     ProjectHandler.saveProject();
 }
Beispiel #3
0
        private void ButtonRemove_Click(object sender, EventArgs e)
        {
            DialogResult msgBox = MessageBox.Show("The survey will be removed completely and the project will be saved automaticly, Do you realy want to remove this survey ?", "Advertissement", MessageBoxButtons.YesNo);

            if (msgBox == DialogResult.Yes)
            {
                Task.Run(async() => await RestHelper.deleteSurvey(this.viewModel.survey.id));
                this.viewModel.surveys.Remove(this.viewModel.survey);
                this.Parent.Controls.Remove(this);
                ProjectHandler.saveProject();
            }
        }
Beispiel #4
0
        private void buttonCloseProject_Click(object sender, EventArgs e)
        {
            DialogResult result = MetroMessageBox.Show(this, "\nDo u want to save your current project ?", "Exit?", MessageBoxButtons.YesNoCancel);

            if (result == DialogResult.No)
            {
                closeProject = true;
                this.Hide();
                OnNotifyPropertyChanged("close");
            }
            else if (result == DialogResult.Yes)
            {
                closeProject = true;
                ProjectHandler.saveProject();
                this.Hide();
                OnNotifyPropertyChanged("close");
            }
        }
Beispiel #5
0
        public async Task <Survey> hostSurvey()
        {
            try
            {
                String res = await RestHelper.hostSurvey(this.survey);

                Survey survey = JsonConvert.DeserializeObject <Survey>(res);
                if (survey != null)
                {
                    this.survey.host     = survey.host;
                    this.survey.id       = survey.id;
                    this.survey.model.id = survey.model.id;
                    ProjectHandler.saveProject();
                    return(survey);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                return(null);
            }
            return(new Survey());
        }
Beispiel #6
0
 private void saveButton_Click(object sender, EventArgs e)
 {
     ProjectHandler.saveProject();
     MessageBox.Show("Project Successfully Saved");
 }