示例#1
0
        private bool ExportFile(CodeExplorerComponentViewModel node)
        {
            var component = _projectsProvider.Component(node.Declaration.QualifiedName.QualifiedModuleName);

            _exportableFileExtensions.TryGetValue(component.Type, out string ext);

            _saveFileDialog.FileName = component.Name + ext;
            var result = _saveFileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                component.Export(_saveFileDialog.FileName);
            }

            return(result == DialogResult.OK);
        }
示例#2
0
        protected override void ExecuteImpl(object parameter)
        {
            var node      = (CodeExplorerComponentViewModel)parameter;
            var component = node.Declaration.QualifiedName.QualifiedModuleName.Component;

            string ext;

            _exportableFileExtensions.TryGetValue(component.Type, out ext);

            _saveFileDialog.FileName = component.Name + ext;
            var result = _saveFileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                component.Export(_saveFileDialog.FileName);
            }
        }
        protected virtual void OnSaveAsButton()
        {
            ISaveFileDialog fileDialog = CommonDialogsInternal.CommonDialogProvider.Instance.CreateDefaultSaveFileDialog() ?? CommonDialogsInternal.CommonDialogProvider.Instance.CreateStandardSaveFileDialog();

            fileDialog.Filter      = "iCalendar files (*.ics)|*.ics";
            fileDialog.FilterIndex = 1;
            if (fileDialog.ShowDialog() != CommonDialogsInternal.DialogResult.OK)
            {
                return;
            }
            try {
                using (Stream stream = new FileInfo(fileDialog.FileName).OpenWrite())
                    ExportAppointment(stream);
            }
            catch {
                ShowMessageBox("Error: could not export appointments", String.Empty, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }