コード例 #1
0
 private void saveAppButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (validations.ValidateApp(nameValue.Text, filePath))
         {
             requestor.AddApplication(new AppModel {
                 FilePath = filePath, Name = nameValue.Text
             });
             Close();
         }
     }
     catch (ValidationException ex)
     {
         MessageBoxes.InformationMessageBox(ex.Message, "Not valid input");
     }
 }
コード例 #2
0
 private void editLayoutButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (manager.EditLayoutModel(nameValue.Text, logic.GetCheckedListBoxItems(aviableAppsCheckListBox), layoutToEdit.Id, layoutToEdit))
         {
             this.Close();
         }
     }
     catch (ValidationException ex)
     {
         MessageBoxes.InformationMessageBox(ex.Message, "Not valid input");
     }
     catch (Exception ex)
     {
         MessageBoxes.WarningMessageBox(ex.Message, "Data files opened");
     }
 }
コード例 #3
0
        private void SetBindings()
        {
            layoutsListBox.Items.Clear();
            try
            {
                layoutsListBox.Items.AddRange(manager.GetLayoutModels().OrderBy(x => x.Name).ToArray());
            }
            catch (IOException e)
            {
                MessageBoxes.WarningMessageBox(e.Message, "Data files opened!");
            }

            layoutsListBox.DisplayMember = "Name";

            if (layoutsListBox.Items.Count != 0)
            {
                layoutsListBox.SetSelected(0, true);
            }
        }
コード例 #4
0
        private void createLayoutButton_Click(object sender, EventArgs e)
        {
            List <AppModel> selectedApps = logic.GetCheckedApps(aviableAppsCheckListBox);

            try
            {
                if (manager.CreateNewLayoutModels(nameValue.Text, selectedApps))
                {
                    Close();
                }
            }
            catch (ValidationException ex)
            {
                MessageBoxes.InformationMessageBox(ex.Message, "Not valid input");
            }
            catch (IOException IOe)
            {
                MessageBoxes.WarningMessageBox(IOe.Message, "Data files opened!");
            }
        }
コード例 #5
0
        private void deleteLinkLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            if (layoutsListBox.SelectedItem == null)
            {
                return;
            }
            LayoutModel layoutToDelete = (LayoutModel)layoutsListBox.SelectedItem;

            if (MessageBoxes.AskMessageBox($"Delete {layoutToDelete.Name} layout?", "Delete layout") == DialogResult.Yes)
            {
                try
                {
                    manager.DeleteLayoutModel(layoutToDelete);
                }
                catch (Exception ex)
                {
                    MessageBoxes.WarningMessageBox(ex.Message, "Data files opened.");
                }
                SetBindings();
            }
        }