Exemplo n.º 1
0
 private void CmiDeleteResource_Click(object sender, EventArgs e)
 {
     if (tvItems.SelectedNode?.Tag is Resource resource &&
         ConfirmBox.Show(Lng.Elem("Confirmation"),
                         Lng.Elem("Are you sure you want to delete the selected resource?"), Decide.No) == DialogResult.Yes)
     {
         resourceRepository.Remove(resource.Id);
         resourceListProvider.GetResources(tvItems);
     }
 }
Exemplo n.º 2
0
 private void CmiDeleteCamera_Click(object sender, EventArgs e)
 {
     if (tvItems.SelectedNode?.Tag is Camera camera &&
         ConfirmBox.Show(Lng.Elem("Confirmation"),
                         Lng.Elem("Are you sure you want to delete the selected camera?"), Decide.No) == DialogResult.Yes)
     {
         cameraRepository.Remove(camera.Id);
         serverListProvider.GetServersAndCamera(tvItems);
     }
 }
Exemplo n.º 3
0
 private void CmiDeleteIssue_Click(object sender, EventArgs e)
 {
     if (tvItems.SelectedNode?.Tag is Issue issue &&
         ConfirmBox.Show(Lng.Elem("Confirmation"),
                         Lng.Elem("Are you sure you want to delete the selected issue?"), Decide.No) == DialogResult.Yes)
     {
         issueRepository.Remove(issue.Id);
         GetIssues();
     }
 }
Exemplo n.º 4
0
 private void CmiDeleteMeeting_Click(object sender, EventArgs e)
 {
     if (tvItems.SelectedNode?.Tag is Meeting meeting &&
         ConfirmBox.Show(Lng.Elem("Confirmation"),
                         Lng.Elem("Are you sure you want to delete the selected meeting?"), Decide.No) == DialogResult.Yes)
     {
         meetingRepository.Remove(meeting.Id);
         meetingsListProvider.GetUpcomingMeetings(tvItems);
         calendarItemsProvider.SetBoldDates(monthCalendar);
     }
 }
Exemplo n.º 5
0
 private void CmiDeleteEvent_Click(object sender, EventArgs e)
 {
     if (tvItems.SelectedNode?.Tag is Event myEvent &&
         ConfirmBox.Show(Lng.Elem("Confirmation"),
                         Lng.Elem("Are you sure you want to delete the selected event?"), Decide.No) == DialogResult.Yes)
     {
         eventRepository.Remove(myEvent.Id);
         eventListProvider.GetUpcomingEvents(tvItems);
         calendarItemsProvider.SetBoldDates(monthCalendar);
     }
 }
        private void BtnDone_Click(object sender, EventArgs e)
        {
            var  charactersDirectory = Path.Combine(PathProvider.Characters, tbName.Text);
            bool createCharacter     = !Directory.Exists(charactersDirectory) || ConfirmBox.Show(Lng.Elem("Character already exists, do you want to owerwrite it?"));

            if (createCharacter)
            {
                DirectoryExtension.CreateIfNotExists(charactersDirectory);
                character.Save(Path.Combine(charactersDirectory, String.Concat("character", ExtensionProvider.CharacterSheetExtension)), images);
            }
        }
Exemplo n.º 7
0
 public static void Check()
 {
     BaseBox.Yes = Lng.Elem("Yes");
     BaseBox.No  = Lng.Elem("No");
     try
     {
         if (ConfirmBox.Show(Lng.Elem("Confirmation"), Lng.Elem("Are you sure you want to exit? This will interrupt the setup progress."), Decide.No) == DialogResult.Yes)
         {
             Environment.Exit(1);
         }
     }
     catch { }
 }
        public void ArchivingDirectory(string source, string target, bool overwriteExisting = true, bool archiveSubdirectories = true)
        {
            try
            {
                if (Directory.Exists(source))
                {
                    var overwrite = overwriteExisting;
                    if (Directory.Exists(target))
                    {
                        if (!overwriteExisting)
                        {
                            overwrite = ConfirmBox.Show("Confirm arhive operation", message, Decide.No) == DialogResult.Yes;
                        }
                    }
                    else
                    {
                        Directory.CreateDirectory(target);
                    }

                    if (overwrite)
                    {
                        if (target[target.Length - 1] != '\\')
                        {
                            target = String.Concat(target, "\\");
                        }
                        try
                        {
                            foreach (var filename in Directory.GetFiles(source))
                            {
                                System.IO.File.Copy(filename, String.Concat(target, filename.Substring(filename.LastIndexOf('\\'))), true);
                            }
                        }
                        catch { }

                        try
                        {
                            if (archiveSubdirectories)
                            {
                                foreach (var directoryName in Directory.GetDirectories(source))
                                {
                                    var tergetDirectoryName = String.Concat(target, directoryName.Substring(directoryName.LastIndexOf('\\')));
                                    ArchivingDirectory(directoryName, tergetDirectoryName, overwriteExisting);
                                }
                            }
                        }
                        catch { }
                    }
                }
            }
            catch { }
        }
Exemplo n.º 9
0
 private void CreateNewUserInterface()
 {
     if (ConfirmBox.Show("Confirmation", "Are you sure you want to create a new user interface? All of your current changes will be lost!", Decide.No) == DialogResult.Yes)
     {
         tvUserInterfaceStructure.Nodes.Clear();
         var rootNode = new TreeNode("RootElement", 0, 0)
         {
             Name = "UI"
         };
         tvUserInterfaceStructure.Nodes.Add(rootNode);
         tvUserInterfaceStructure.ExpandAll();
         GetSourceCode();
     }
 }
Exemplo n.º 10
0
        private bool IsFileCreationAllowed(string filePath)
        {
            var result = false;

            if (File.Exists(filePath))
            {
                if (ConfirmBox.Show("Confirmation", "Are you sure you want to overwrite the existing file?", Decide.No) == DialogResult.Yes)
                {
                    result = true;
                }
            }
            else
            {
                result = true;
            }
            return(result);
        }
Exemplo n.º 11
0
        void tsmi_tsmi_ExportPhonebook_Click(object sender, EventArgs e)
        {
            if (sfd_SaveFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var save_file = true;

            if (File.Exists(sfd_SaveFileDialog.FileName))
            {
                save_file = ConfirmBox.Show("File already exists", "Are you sure, you want to overwrite the selected file?") == DialogResult.OK;
            }

            if (save_file)
            {
                presenter.ExportPhoneBook(sfd_SaveFileDialog.FileName);
            }
        }
Exemplo n.º 12
0
        public void SaveImage(string path, string imageName, string backgroundJpgFile)
        {
            var rgx = new Regex(@"[/\\:*?<>|]");

            imageName = rgx.Replace(imageName, "-");
            var filename = $"{Path.Combine(path, imageName)}.jpg";

            var dialogResult = DialogResult.Yes;

            if (File.Exists(filename))
            {
                dialogResult = ConfirmBox.Show("File already exists", String.Concat("Do you want to overwrite existing file?", Environment.NewLine, filename), Decide.No);
            }

            if (dialogResult != DialogResult.Yes)
            {
                return;
            }

            filename = Environment.ExpandEnvironmentVariables(filename);
            File.Copy(backgroundJpgFile, filename, true);
            InfoBox.Show("Desktop image saved", $"Successfully saved as: {filename}");
        }
Exemplo n.º 13
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            string title       = "Message box sender";
            string message     = "This is a default message, you can set up a custom message with the -m directive.";
            var    messageType = MessageType.Information;
            var    timeout     = Timeout.Infinite;
            var    decide      = Decide.Yes;

            int i = 0;

            while (i < args.Length)
            {
                var arg = args[i].ToLower();
                switch (arg)
                {
                case "-message":
                case "/message":
                case "-m":
                case "/m":
                    message = TestArgsLength(i, args.Length) ? "No message provided." : args[++i];
                    break;

                case "-info":
                case "/info":
                case "-information":
                case "/information":
                case "-i":
                case "/i":
                    messageType = MessageType.Information;
                    break;

                case "-question":
                case "/question":
                case "-q":
                case "/q":
                    messageType = MessageType.Question;
                    break;

                case "-error":
                case "/error":
                case "-e":
                case "/e":
                    messageType = MessageType.Error;
                    break;

                case "-timeout":
                case "/timeout":
                    timeout = TestArgsLength(i, args.Length) ? Timeout.Infinite : Convert.ToInt32(args[++i]);
                    break;

                case "-title":
                case "/title":
                case "-t":
                case "/t":
                    title = TestArgsLength(i, args.Length) ? "No title has been provided" : args[++i];
                    break;

                case "-yes":
                case "/yes":
                case "-y":
                case "/y":
                    decide = Decide.Yes;
                    break;

                case "-no":
                case "/no":
                case "-n":
                case "/n":
                    decide = Decide.No;
                    break;
                }
                i++;
            }

            switch (messageType)
            {
            case MessageType.Information:
                InfoBox.Show(title, message, timeout);
                break;

            case MessageType.Question:
                ConfirmBox.Show(title, message, timeout, decide);
                break;

            case MessageType.Error:
                ErrorBox.Show(title, message, timeout);
                break;
            }
        }
Exemplo n.º 14
0
 private void DisplayConfirmBox()
 {
     m_confirmBox.Show();
 }
Exemplo n.º 15
0
 public static void ShowConfirmBox(string message, string title, Action <bool> onFinished = null)
 {
     confirmBox.Show(message, title, onFinished);
 }