Base data class which stores the basic information for import
コード例 #1
0
ファイル: MainData.cs プロジェクト: xin1627/RevitSdkSamples
        /// <summary>
        /// Show Open File dialog
        /// </summary>
        /// <param name="importData">Data to import</param>
        /// <param name="returnFileName">File name will be returned</param>
        /// <returns>Dialog result</returns>
        public static DialogResult ShowOpenDialog(ImportData importData, ref String returnFileName)
        {
            using (OpenFileDialog importDialog = new OpenFileDialog())
            {
                importDialog.Title            = importData.Title;
                importDialog.InitialDirectory = importData.ImportFolder;
                importDialog.Filter           = importData.Filter;
                importDialog.RestoreDirectory = true;

                DialogResult result = importDialog.ShowDialog();
                if (result != DialogResult.Cancel)
                {
                    returnFileName = importDialog.FileName;
                }

                return(result);
            }
        }
コード例 #2
0
        /// <summary>
        /// Import
        /// </summary>
        /// <param name="data"></param>
        private static DialogResult Import(ImportData data)
        {
            String returnFilename = String.Empty;
            DialogResult result = ShowOpenDialog(data, ref returnFilename);
            if (result != DialogResult.Cancel)
            {
                data.ImportFileFullName = returnFilename;
                if (!data.Import())
                {
                    TaskDialog.Show("Import", "Cannot import " + Path.GetFileName(data.ImportFileFullName) +
                        " in current settings.", TaskDialogCommonButtons.Ok);
                }
            }

            return result;
        }
コード例 #3
0
        /// <summary>
        /// Show Open File dialog
        /// </summary>
        /// <param name="importData">Data to import</param>
        /// <param name="returnFileName">File name will be returned</param>
        /// <returns>Dialog result</returns>
        public static DialogResult ShowOpenDialog(ImportData importData, ref String returnFileName)
        {
            using (OpenFileDialog importDialog = new OpenFileDialog())
            {
                importDialog.Title = importData.Title;
                importDialog.InitialDirectory = importData.ImportFolder;
                importDialog.Filter = importData.Filter;
                importDialog.RestoreDirectory = true;

                DialogResult result = importDialog.ShowDialog();
                if (result != DialogResult.Cancel)
                {
                    returnFileName = importDialog.FileName;
                }

                return result;
            }
        }
コード例 #4
0
ファイル: MainData.cs プロジェクト: AMEE/revit
        /// <summary>
        /// Import
        /// </summary>
        /// <param name="data"></param>
        private static DialogResult Import(ImportData data)
        {
            String returnFilename = String.Empty;
            DialogResult result = ShowOpenDialog(data, ref returnFilename);
            if (result != DialogResult.Cancel)
            {
                data.ImportFileFullName = returnFilename;
                if (!data.Import())
                {
                    MessageBox.Show("Cannot import " + Path.GetFileName(data.ImportFileFullName) +
                        " in current settings.", "Import", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }

            return result;
        }