コード例 #1
0
        /// <summary>
        /// Prompts the user to save the current family if it has been changed
        /// </summary>
        private void PromptToSave()
        {
            if (!family.IsDirty)
            {
                return;
            }

            MessageBoxResult result = MessageBox.Show(Properties.Resources.NotSavedMessage,
                                                      Properties.Resources.NotSaved, MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (result == MessageBoxResult.Yes)
            {
                CommonDialog dialog = new CommonDialog();
                dialog.InitialDirectory = People.ApplicationFolderPath;
                dialog.Filter.Add(new FilterEntry(Properties.Resources.FamilyFiles, Properties.Resources.FamilyV3Extension));
                dialog.Filter.Add(new FilterEntry(Properties.Resources.AllFiles, Properties.Resources.AllExtension));
                dialog.Title            = Properties.Resources.SaveAs;
                dialog.DefaultExtension = Properties.Resources.DefaultFamilyExtension;
                dialog.ShowSave();

                if (!string.IsNullOrEmpty(dialog.FileName))
                {
                    familyCollection.Save(dialog.FileName);

                    if (!App.RecentFiles.Contains(familyCollection.FullyQualifiedFilename))
                    {
                        App.RecentFiles.Add(familyCollection.FullyQualifiedFilename);
                        BuildOpenMenu();
                    }
                }
            }
        }
コード例 #2
0
ファイル: Sources.xaml.cs プロジェクト: karmicka/Source
        private void Export()
        {
            CommonDialog dialog = new CommonDialog();

            dialog.InitialDirectory = People.ApplicationFolderPath;
            dialog.Filter.Add(new FilterEntry(Properties.Resources.htmlFiles, Properties.Resources.htmlExtension));
            dialog.Title            = Properties.Resources.Export;
            dialog.DefaultExtension = Properties.Resources.DefaulthtmlExtension;
            dialog.ShowSave();

            if (!string.IsNullOrEmpty(dialog.FileName))
            {
                SourcesExport sources = new SourcesExport();
                sources.ExportSources(dialog.FileName, Path.GetFileName(this.familyCollection.FullyQualifiedFilename), source);
            }

            if (File.Exists(dialog.FileName))
            {
                MessageBoxResult result = MessageBox.Show(Properties.Resources.SourcesExportMessage,
                                                          Properties.Resources.ExportResult, MessageBoxButton.YesNo, MessageBoxImage.Question);

                try
                {
                    if (result == MessageBoxResult.Yes)
                    {
                        System.Diagnostics.Process.Start(dialog.FileName);
                    }
                }
                catch { }
            }
        }
コード例 #3
0
        /// <summary>
        /// Command handler for ExportXPSCommand
        /// </summary>
        private void ExportXps(object sender, EventArgs e)
        {
            CommonDialog dialog = new CommonDialog();

            dialog.InitialDirectory = People.ApplicationFolderPath;
            dialog.Filter.Add(new FilterEntry(Properties.Resources.XpsFiles, Properties.Resources.XpsExtension));
            dialog.Filter.Add(new FilterEntry(Properties.Resources.AllFiles, Properties.Resources.AllExtension));
            dialog.Title            = Properties.Resources.Export;
            dialog.DefaultExtension = Properties.Resources.DefaultXpsExtension;
            dialog.ShowSave();

            if (!string.IsNullOrEmpty(dialog.FileName))
            {
                // Create the XPS document from the window's main container (in this case, a grid)
                Package           package   = Package.Open(dialog.FileName, FileMode.Create);
                XpsDocument       xpsDoc    = new XpsDocument(package);
                XpsDocumentWriter xpsWriter = XpsDocument.CreateXpsDocumentWriter(xpsDoc);

                // Hide the zoom control before the diagram is saved
                DiagramControl.ZoomSliderPanel.Visibility = Visibility.Hidden;

                // Since DiagramBorder derives from FrameworkElement, the XpsDocument writer knows
                // how to output it's contents. The border is used instead of the DiagramControl
                // so that the diagram background is output as well as the digram control itself.
                xpsWriter.Write(DiagramBorder);
                xpsDoc.Close();
                package.Close();

                // Show the zoom control again
                DiagramControl.ZoomSliderPanel.Visibility = Visibility.Visible;
            }
        }
コード例 #4
0
        /// <summary>
        /// Command handler for Save As Command
        /// </summary>
        private void SaveFamilyAs(object sender, RoutedEventArgs e)
        {
            if (family.IsOldVersion && !appSettings.DontShowOldVersionMessage)
            {
                //Show message that the file will be saved in the new format
                ShowOldVersionMessage();
            }
            else
            {
                CommonDialog dialog = new CommonDialog();
                dialog.InitialDirectory = People.ApplicationFolderPath;
                dialog.Filter.Add(new FilterEntry(Properties.Resources.FamilyFiles, Properties.Resources.FamilyV3Extension));
                dialog.Filter.Add(new FilterEntry(Properties.Resources.AllFiles, Properties.Resources.AllExtension));
                dialog.Title            = Properties.Resources.SaveAs;
                dialog.DefaultExtension = Properties.Resources.DefaultFamilyExtension;
                dialog.ShowSave();

                if (!string.IsNullOrEmpty(dialog.FileName))
                {
                    familyCollection.Save(dialog.FileName);

                    if (familyCollection.FullyQualifiedFilename.EndsWith(Properties.Resources.DefaultFamilyExtension))
                    {
                        // Remove the file from its current position and add it back to the top/most recent position.
                        App.RecentFiles.Remove(familyCollection.FullyQualifiedFilename);
                        App.RecentFiles.Insert(0, familyCollection.FullyQualifiedFilename);
                        BuildOpenMenu();
                    }
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Command handler for Save Command
        /// </summary>
        private void SaveFamily(object sender, RoutedEventArgs e)
        {
            // Prompt to save if the file has not been saved before, otherwise just save to the existing file.
            if (string.IsNullOrEmpty(familyCollection.FullyQualifiedFilename))
            {
                CommonDialog dialog = new CommonDialog();
                dialog.InitialDirectory = People.ApplicationFolderPath;
                dialog.Filter.Add(new FilterEntry(Properties.Resources.FamilyFiles, Properties.Resources.FamilyExtension));
                dialog.Filter.Add(new FilterEntry(Properties.Resources.AllFiles, Properties.Resources.AllExtension));
                dialog.Title            = Properties.Resources.SaveAs;
                dialog.DefaultExtension = Properties.Resources.DefaultFamilyExtension;
                dialog.ShowSave();

                if (!string.IsNullOrEmpty(dialog.FileName))
                {
                    familyCollection.Save(dialog.FileName);

                    // Remove the file from its current position and add it back to the top/most recent position.
                    App.RecentFiles.Remove(familyCollection.FullyQualifiedFilename);
                    App.RecentFiles.Insert(0, familyCollection.FullyQualifiedFilename);
                    BuildOpenMenu();
                }
            }
            else
            {
                familyCollection.Save();

                // Remove the file from its current position and add it back to the top/most recent position.
                App.RecentFiles.Remove(familyCollection.FullyQualifiedFilename);
                App.RecentFiles.Insert(0, familyCollection.FullyQualifiedFilename);
                BuildOpenMenu();
            }
        }
コード例 #6
0
        /// <summary>
        /// Command handler for ExportGedcomCommand
        /// </summary>
        private void ExportGedcom(object sender, EventArgs e)
        {
            CommonDialog dialog = new CommonDialog();

            dialog.InitialDirectory = People.ApplicationFolderPath;
            dialog.Filter.Add(new FilterEntry(Properties.Resources.GedcomFiles, Properties.Resources.GedcomExtension));
            dialog.Filter.Add(new FilterEntry(Properties.Resources.AllFiles, Properties.Resources.AllExtension));
            dialog.Title            = Properties.Resources.Export;
            dialog.DefaultExtension = Properties.Resources.DefaultGedcomExtension;
            dialog.ShowSave();

            if (!string.IsNullOrEmpty(dialog.FileName))
            {
                GedcomExport ged = new GedcomExport();
                ged.Export(family, dialog.FileName);
            }
        }
コード例 #7
0
        /// <summary>
        /// Command handler for Save As Command
        /// </summary>
        private void SaveFamilyAs(object sender, RoutedEventArgs e)
        {
            if (family.IsOldVersion && !appSettings.DontShowOldVersionMessage)
            {
                //Show message that the file will be saved in the new format
                ShowOldVersionMessage();
            }
            else
            {

                CommonDialog dialog = new CommonDialog();
                dialog.InitialDirectory = People.ApplicationFolderPath;
                dialog.Filter.Add(new FilterEntry(Properties.Resources.FamilyFiles, Properties.Resources.FamilyV3Extension));
                dialog.Filter.Add(new FilterEntry(Properties.Resources.AllFiles, Properties.Resources.AllExtension));
                dialog.Title = Properties.Resources.SaveAs;
                dialog.DefaultExtension = Properties.Resources.DefaultFamilyExtension;
                dialog.ShowSave();

                if (!string.IsNullOrEmpty(dialog.FileName))
                {
                    familyCollection.Save(dialog.FileName);

                    if (familyCollection.FullyQualifiedFilename.EndsWith(Properties.Resources.DefaultFamilyExtension))
                    {
                        // Remove the file from its current position and add it back to the top/most recent position.
                        App.RecentFiles.Remove(familyCollection.FullyQualifiedFilename);
                        App.RecentFiles.Insert(0, familyCollection.FullyQualifiedFilename);
                        BuildOpenMenu();
                    }
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// Prompts the user to save the current family if it has been changed
        /// </summary>
        private void PromptToSave()
        {
            if (!family.IsDirty)
                return;

            MessageBoxResult result = MessageBox.Show(Properties.Resources.NotSavedMessage,
                Properties.Resources.NotSaved, MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (result == MessageBoxResult.Yes)
            {
                CommonDialog dialog = new CommonDialog();
                dialog.InitialDirectory = People.ApplicationFolderPath;
                dialog.Filter.Add(new FilterEntry(Properties.Resources.FamilyFiles, Properties.Resources.FamilyV3Extension));
                dialog.Filter.Add(new FilterEntry(Properties.Resources.AllFiles, Properties.Resources.AllExtension));
                dialog.Title = Properties.Resources.SaveAs;
                dialog.DefaultExtension = Properties.Resources.DefaultFamilyExtension;
                dialog.ShowSave();

                if (!string.IsNullOrEmpty(dialog.FileName))
                {
                    familyCollection.Save(dialog.FileName);

                    if (!App.RecentFiles.Contains(familyCollection.FullyQualifiedFilename))
                    {
                        App.RecentFiles.Add(familyCollection.FullyQualifiedFilename);
                        BuildOpenMenu();
                    }
                }
            }
        }
コード例 #9
0
        private void OldVersionMessageControl_ContinueButtonClick(object sender, RoutedEventArgs e)
        {
            HideOldVersionMessage();

            // Prompt to save if the file has not been saved before, otherwise just save to the existing file.
            if (string.IsNullOrEmpty(familyCollection.FullyQualifiedFilename) || family.IsOldVersion)
            {
                CommonDialog dialog = new CommonDialog();
                dialog.InitialDirectory = People.ApplicationFolderPath;
                dialog.Filter.Add(new FilterEntry(Properties.Resources.FamilyV3Files, Properties.Resources.FamilyV3Extension));
                dialog.Filter.Add(new FilterEntry(Properties.Resources.AllFiles, Properties.Resources.AllExtension));
                dialog.Title = Properties.Resources.SaveAs;
                dialog.DefaultExtension = Properties.Resources.DefaultFamilyExtension;
                dialog.ShowSave();

                if (!string.IsNullOrEmpty(dialog.FileName))
                {
                    familyCollection.Save(dialog.FileName);
                    family.IsOldVersion = false;

                    // Remove the file from its current position and add it back to the top/most recent position.
                    App.RecentFiles.Remove(familyCollection.FullyQualifiedFilename);
                    App.RecentFiles.Insert(0, familyCollection.FullyQualifiedFilename);
                    BuildOpenMenu();
                }
            }
            else
            {
                familyCollection.Save();

                // Remove the file from its current position and add it back to the top/most recent position.
                App.RecentFiles.Remove(familyCollection.FullyQualifiedFilename);
                App.RecentFiles.Insert(0, familyCollection.FullyQualifiedFilename);
                BuildOpenMenu();
            }
        }
コード例 #10
0
        /// <summary>
        /// Command handler for ExportXPSCommand
        /// </summary>
        private void ExportXps(object sender, EventArgs e)
        {
            CommonDialog dialog = new CommonDialog();
            dialog.InitialDirectory = People.ApplicationFolderPath;
            dialog.Filter.Add(new FilterEntry(Properties.Resources.XpsFiles, Properties.Resources.XpsExtension));
            dialog.Filter.Add(new FilterEntry(Properties.Resources.AllFiles, Properties.Resources.AllExtension));
            dialog.Title = Properties.Resources.Export;
            dialog.DefaultExtension = Properties.Resources.DefaultXpsExtension;
            dialog.ShowSave();

            if (!string.IsNullOrEmpty(dialog.FileName))
            {
                // Create the XPS document from the window's main container (in this case, a grid)
                Package package = Package.Open(dialog.FileName, FileMode.Create);
                XpsDocument xpsDoc = new XpsDocument(package);
                XpsDocumentWriter xpsWriter = XpsDocument.CreateXpsDocumentWriter(xpsDoc);

                // Hide the zoom control before the diagram is saved
                DiagramControl.ZoomSliderPanel.Visibility = Visibility.Hidden;

                // Since DiagramBorder derives from FrameworkElement, the XpsDocument writer knows
                // how to output it's contents. The border is used instead of the DiagramControl
                // so that the diagram background is output as well as the digram control itself.
                xpsWriter.Write(DiagramBorder);
                xpsDoc.Close();
                package.Close();

                // Show the zoom control again
                DiagramControl.ZoomSliderPanel.Visibility = Visibility.Visible;
            }
        }
コード例 #11
0
        /// <summary>
        /// Command handler for ExportGedcomCommand
        /// </summary>
        private void ExportGedcom(object sender, EventArgs e)
        {
            CommonDialog dialog = new CommonDialog();
            dialog.InitialDirectory = People.ApplicationFolderPath;
            dialog.Filter.Add(new FilterEntry(Properties.Resources.GedcomFiles, Properties.Resources.GedcomExtension));
            dialog.Filter.Add(new FilterEntry(Properties.Resources.AllFiles, Properties.Resources.AllExtension));
            dialog.Title = Properties.Resources.Export;
            dialog.DefaultExtension = Properties.Resources.DefaultGedcomExtension;
            dialog.ShowSave();

            if (!string.IsNullOrEmpty(dialog.FileName))
            {
                GedcomExport ged = new GedcomExport();
                ged.Export(family, dialog.FileName);
            }
        }
コード例 #12
0
ファイル: Places.xaml.cs プロジェクト: karmicka/Source
        private void Export()
        {
            if (Options() != "0") //only run if cancel not clicked
            {
                CommonDialog dialog = new CommonDialog();
                dialog.InitialDirectory = People.ApplicationFolderPath;
                dialog.Filter.Add(new FilterEntry(Properties.Resources.htmlFiles, Properties.Resources.kmlExtension));
                dialog.Title            = Properties.Resources.Export;
                dialog.DefaultExtension = Properties.Resources.DefaultkmlExtension;
                dialog.ShowSave();

                if (string.IsNullOrEmpty(dialog.FileName))
                {
                    //return without doing anything if no file name is input
                }
                else
                {
                    if (!string.IsNullOrEmpty(dialog.FileName))
                    {
                        PlacesExport places = new PlacesExport();

                        string filename = dialog.FileName;

                        string[] summary = null;

                        if (Options() == "1")
                        {
                            summary = places.ExportPlaces(family, filename, Privacy(), false, false, true, Burials(), Deaths(), Cremations(), Births(), Marriages());
                        }
                        if (Options() == "2")
                        {
                            summary = places.ExportPlaces(family, filename, Privacy(), true, false, false, Burials(), Deaths(), Cremations(), Births(), Marriages());
                        }
                        if (Options() == "3")
                        {
                            summary = places.ExportPlaces(family, filename, Privacy(), false, true, false, Burials(), Deaths(), Cremations(), Births(), Marriages());
                        }


                        if (summary[1] == "No file")
                        {
                            MessageBoxResult result = MessageBox.Show(summary[0],
                                                                      Properties.Resources.ExportResult, MessageBoxButton.OK, MessageBoxImage.Information);
                        }
                        else
                        {
                            MessageBoxResult result = MessageBox.Show(summary[0] + "\n\n" + Properties.Resources.PlacesMessage,
                                                                      Properties.Resources.ExportResult, MessageBoxButton.YesNo, MessageBoxImage.Information);

                            if (result == MessageBoxResult.Yes)
                            {
                                try
                                {
                                    System.Diagnostics.Process.Start(summary[1]);
                                }
                                catch
                                {
                                    //no viewer or other error
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #13
0
ファイル: MainWindow.xaml.cs プロジェクト: ssickles/archive
        /// <summary>
        /// Command handler for Save As Command
        /// </summary>
        private void SaveFamilyAs(object sender, RoutedEventArgs e)
        {
            CommonDialog dialog = new CommonDialog();
            dialog.InitialDirectory = People.ApplicationFolderPath;
            dialog.Filter.Add(new FilterEntry(Properties.Resources.FamilyFiles, Properties.Resources.FamilyExtension));
            dialog.Filter.Add(new FilterEntry(Properties.Resources.AllFiles, Properties.Resources.AllExtension));
            dialog.Title = Properties.Resources.SaveAs;
            dialog.DefaultExtension = Properties.Resources.DefaultFamilyExtension;
            dialog.ShowSave();

            if (!string.IsNullOrEmpty(dialog.FileName))
            {
                familyCollection.Save(dialog.FileName);

                // Remove the file from its current position and add it back to the top/most recent position.
                App.RecentFiles.Remove(familyCollection.FullyQualifiedFilename);
                App.RecentFiles.Insert(0, familyCollection.FullyQualifiedFilename);
                BuildOpenMenu();
            }
        }
コード例 #14
0
ファイル: Html.xaml.cs プロジェクト: karmicka/Source
        private void Export()
        {
            if (Options() != "0") //only run if cancel not clicked
            {
                CommonDialog dialog = new CommonDialog();
                dialog.InitialDirectory = People.ApplicationFolderPath;
                dialog.Filter.Add(new FilterEntry(Properties.Resources.htmlFiles, Properties.Resources.htmlExtension));
                dialog.Title            = Properties.Resources.Export;
                dialog.DefaultExtension = Properties.Resources.DefaulthtmlExtension;
                dialog.ShowSave();

                if (string.IsNullOrEmpty(dialog.FileName))
                {
                    //return without doing anything if no file name is input
                }
                else
                {
                    if (!string.IsNullOrEmpty(dialog.FileName))
                    {
                        HtmlExport html = new HtmlExport();

                        int start = minYear;
                        int end   = DateTime.Now.Year;

                        string filename = dialog.FileName;
                        if (Options() == "1")
                        {
                            html.ExportAll(family, source, repository, dialog.FileName, Path.GetFileName(familyCollection.FullyQualifiedFilename), Privacy(), Sources());  //Export the all individuals
                        }
                        if (Options() == "2")
                        {
                            html.ExportCurrent(family, source, repository, dialog.FileName, Path.GetFileName(familyCollection.FullyQualifiedFilename), Privacy(), Sources());
                        }
                        if (Options() == "3")
                        {
                            html.ExportDirect(family, source, repository, dialog.FileName, Path.GetFileName(familyCollection.FullyQualifiedFilename), Privacy(), Sources());     //Export current person and immediate family relatives
                        }
                        if (Options() == "4")
                        {
                            html.ExportGenerations(family, source, repository, Ancestors(), Descendants(), dialog.FileName, Path.GetFileName(familyCollection.FullyQualifiedFilename), Privacy(), Sources());
                        }
                        if (Options() == "5")
                        {
                            html.ExportFilter(family, source, repository, searchtextvalue(), searchfieldvalue(), searchfieldindex(), dialog.FileName, Path.GetFileName(familyCollection.FullyQualifiedFilename), Privacy(), Sources());
                        }
                        if (Options() == "6")
                        {
                            html.ExportEventsByDecade(family, source, repository, dialog.FileName, Path.GetFileName(familyCollection.FullyQualifiedFilename), Privacy(), start, end);
                        }

                        MessageBoxResult result = MessageBox.Show(Properties.Resources.SourcesExportMessage, Properties.Resources.ExportResult, MessageBoxButton.YesNo, MessageBoxImage.Question);

                        try
                        {
                            if (result == MessageBoxResult.Yes)
                            {
                                System.Diagnostics.Process.Start(filename);
                            }
                        }
                        catch { }
                    }
                }
            }
        }