예제 #1
0
        public async void SaveHTMLFile()
        {
            SaveFileDialog dlg = new SaveFileDialog
            {
                DefaultExtension = ".html",
                InitialFileName  = Titel,
                Directory        = DialogExtensions.GetCurrentProjectPath()
            };

            dlg.Filters.Add(new FileDialogFilter()
            {
                Extensions = new List <string> {
                    "html"
                }, Name = _("Hypertext Markup Language")
            });
            string filename = await dlg.ShowAsyncWithParent <ProtocolV>();

            if (filename != null && filename != "")
            {
                try
                {
                    FileStream   fs = new FileStream(filename, FileMode.Create, FileAccess.Write);
                    StreamWriter sw = new StreamWriter(fs);
                    sw.Write(CurrentProtocol);
                    sw.Close();
                    var process = new Process();
                    process.StartInfo = new ProcessStartInfo(filename)
                    {
                        UseShellExecute = true
                    };
                    process.Start();
                }
                catch (Exception ex) { await Errorhandler.RaiseMessage(_("Error: ") + ex.Message, _("Error"), Errorhandler.MessageType.Error); }
            }
        }
예제 #2
0
        public async void SaveExcelFile()
        {
            SaveFileDialog dlg = new SaveFileDialog
            {
                DefaultExtension = ".xlsx",
                InitialFileName  = Titel,
                Directory        = DialogExtensions.GetCurrentProjectPath()
            };

            dlg.Filters.Add(new FileDialogFilter()
            {
                Extensions = new List <string> {
                    "xlsx"
                }, Name = _("Excel Document")
            });

            string result = await dlg.ShowAsyncWithParent <ProtocolV>();

            if (result != null && result != "")
            {
                try
                {
                    DominoProvider.SaveXLSFieldPlan(result, currentOPP);
                    var process = new Process();
                    process.StartInfo = new ProcessStartInfo(result)
                    {
                        UseShellExecute = true
                    };
                    process.Start();
                }
                catch (Exception ex) { await Errorhandler.RaiseMessage(_("Error: ") + ex.Message, _("Error"), Errorhandler.MessageType.Error); }
            }
        }