예제 #1
0
        private void SaveToFile()
        {
            var file = ViewManager.ShowSaveFileDialog(Text.Get("PhenomenaWindow.ExportTitle"), "Phenomena", ".csv", "Text files (*.txt)|*.txt|Comma-separated files (*.csv)|*.csv", out int selectedFilterIndex);

            if (file != null)
            {
                IAstroEventsWriter writer = null;
                string             ext    = Path.GetExtension(file);
                switch (ext)
                {
                case ".csv":
                    writer = new AstroEventsCsvWriter(file, sky.Context.GeoLocation.UtcOffset);
                    break;

                case ".txt":
                    writer = new AstroEventsTextWriter(file, sky.Context.GeoLocation.UtcOffset);
                    break;

                default:
                    break;
                }

                writer?.Write(events);

                var answer = ViewManager.ShowMessageBox("$PhenomenaWindow.ExportDoneTitle", "$PhenomenaWindow.ExportDoneText", MessageBoxButton.YesNo);
                if (answer == MessageBoxResult.Yes)
                {
                    System.Diagnostics.Process.Start(file);
                }
            }
        }
예제 #2
0
        private void SaveToFile()
        {
            var file = ViewManager.ShowSaveFileDialog(Text.Get("PhenomenaWindow.ExportTitle"), "Phenomena", ".csv", "Text files (*.txt)|*.txt|Comma-separated files (*.csv)|*.csv");

            if (file != null)
            {
                IAstroEventsWriter writer = null;
                string             ext    = Path.GetExtension(file);
                switch (ext)
                {
                case ".csv":
                    writer = new AstroEventsCsvWriter(file, sky.Context.GeoLocation.UtcOffset);
                    break;

                case ".txt":
                    writer = new AstroEventsTextWriter(file, sky.Context.GeoLocation.UtcOffset);
                    break;

                default:
                    break;
                }

                writer?.Write(events);

                ViewManager.ShowMessageBox("$PhenomenaWindow.ExportDoneTitle", "$PhenomenaWindow.ExportDoneText", MessageBoxButton.OK);
            }
        }