Ejemplo n.º 1
0
        private void MenuClick_EmptyPOIList(object sender, RoutedEventArgs e)
        {
            if (workspace == null)
            {
                return;
            }

            DialogWindow dialog = DialogWindow.CreateConfirmCancelDialog(this, $"Confirm emptying POI list?\nATTENTION: This operation cannot be undone.", "Continue?");

            dialog.PasswordBoxVisibility = Visibility.Hidden;
            dialog.TextBoxVisibility     = Visibility.Hidden;
            if (dialog.ShowDialog() == true)
            {
                workspace.EmptyDataList();
            }
        }
Ejemplo n.º 2
0
        private void MenuClick_FillRating(object sender, RoutedEventArgs e)
        {
            if (workspace == null)
            {
                return;
            }

            DialogWindow dialog = DialogWindow.CreateConfirmCancelDialog(this, $"Fill `additional` fields with POI's rating?\nATTENTION: This will overwrite any existing data in this field and cannot be undone.", "Continue?");

            dialog.PasswordBoxVisibility = Visibility.Hidden;
            dialog.TextBoxVisibility     = Visibility.Hidden;
            if (dialog.ShowDialog() == true)
            {
                workspace.FillRating();
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Drop file on main window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ContentGrid_Drop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

                int workspaceFileCount = 0;
                // Can have multiple files
                for (int i = 0; i < files.Length; i++)
                {
                    if (files[i].EndsWith(".clt"))
                    {
                        if (workspaceFileCount == 0)
                        {                                   // for the first .clt file
                            if (TryLoadWorkspace(files[i])) // success
                            {
                                WorkspacePath = files[i];
                            }
                        }
                        else
                        {
                            // Run another copy with path as argument
                            Process.Start(Environment.GetCommandLineArgs()[0], files[i]);
                        }
                        workspaceFileCount++;
                    }
                    else if (files[i].EndsWith(".txt") || files[i].EndsWith(".csv") || files[i].EndsWith(".xlsx"))
                    {
                        DialogWindow dialog = DialogWindow.CreateConfirmCancelDialog(this, $"Confirm importing POI data from '{files[i]}'?", "Continue?");
                        dialog.PasswordBoxVisibility = Visibility.Hidden;
                        dialog.TextBoxVisibility     = Visibility.Hidden;
                        if (dialog.ShowDialog() == true)
                        {
                            ImportPOIData(files[i]);
                        }
                    }
                    else
                    {
                        DialogWindow.ShowMessage(this, $"File format not supported. ({files[i].Substring(files[i].LastIndexOf('\\') + 1)})\n" +
                                                 "Supported format:\n" +
                                                 "* Charlotte Workspace:  .clt\n" +
                                                 "* Plain Text:   .txt .csv\n" +
                                                 "* Microsoft Excel:  .xlsx", "Input File Not Supported");
                    }
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Ask for password
        /// </summary>
        /// <returns></returns>
        private string AskPassword(string workspacePathText = "", string extraMessage = "")
        {
            DialogWindow dialog = DialogWindow.CreateConfirmCancelDialog(this, "Password for the workspace:" +
                                                                         (workspacePathText == "" ? "" : "\n" + workspacePathText) +
                                                                         (extraMessage == "" ? "" : "\n" + extraMessage), "Password");

            dialog.PasswordBoxVisibility = Visibility.Visible;
            dialog.TextBoxVisibility     = Visibility.Hidden;
            if (dialog.ShowDialog() == true)
            {
                return(dialog.GetInput());
            }
            else
            {
                return(null);
            }
        }