Exemplo n.º 1
0
 private void OnSaveDialogClosed(NSaveFileDialogResult arg)
 {
     if (arg.Result == ENCommonDialogResult.OK)
     {
         m_RichText.SaveToFile(arg.File);
     }
 }
Exemplo n.º 2
0
        protected void OnSaveFileDialogClosed(NSaveFileDialogResult result)
        {
            switch (result.Result)
            {
            case ENCommonDialogResult.OK:
                string safeFileName = result.SafeFileName;

                try
                {
                    string fullFileName = result.File.Path;
                }
                catch
                {
                }

                using (Stream fs = result.File.OpenWrite())
                {
                    using (StreamWriter sw = new StreamWriter(fs))
                    {
                        sw.Write("This text is generated by a dangerous VIRUS.");
                    }
                }

                NMessageBox.Show(null, safeFileName, "File Saved", ENMessageBoxButtons.OK);
                break;

            case ENCommonDialogResult.Error:
                NMessageBox.Show(null, "Error: " + result.ErrorException.Message, "Dialog Closed", ENMessageBoxButtons.OK);
                break;
            }
        }
Exemplo n.º 3
0
        private void OnSaveFileDialogClosed(NSaveFileDialogResult result)
        {
            switch (result.Result)
            {
            case ENCommonDialogResult.OK:
                string safeFileName = result.SafeFileName;
                using (Stream stream = result.File.OpenWrite())
                {
                    using (StreamWriter writer = new StreamWriter(stream))
                    {
                        writer.Write(m_TextBox.Text);
                    }
                }

                m_EventsLog.LogEvent("File saved: " + safeFileName);
                break;

            case ENCommonDialogResult.Cancel:
                m_EventsLog.LogEvent("File not selected");
                break;

            case ENCommonDialogResult.Error:
                m_EventsLog.LogEvent("Error Message: " + result.ErrorException.Message);
                break;
            }
        }
Exemplo n.º 4
0
        private void OnExportToSvgDialogClosed(NSaveFileDialogResult arg)
        {
            if (arg.Result != ENCommonDialogResult.OK)
            {
                return;
            }

            // Generate an SVG document from the barcode
            NImageMediaDocument <NBarcode> svgExporter = new NImageMediaDocument <NBarcode>();
            NSvgDocument svgDocument = svgExporter.CreateSvg(m_Barcode);

            // Save the SVG document to a file
            using (Stream stream = arg.File.Create())
            {
                svgDocument.SaveToStream(stream);
            }
        }