コード例 #1
0
        private static OpenFileDialog CreateOpenFileDialog(string title, string context, string filter,
                                                           int filterIndex, string defaultExt, bool multiSelect)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (!string.IsNullOrEmpty(title))
            {
                ofd.Title = title;
            }

            if (!string.IsNullOrEmpty(context))
            {
                ofd.Directory = new Uri(context);
            }

            if (!string.IsNullOrEmpty(filter))
            {
                UIHelper.ConvertFileDialogFilters(ofd, filter);

                //if (filterIndex > 0) ofd.FilterIndex = filterIndex;
            }

            ofd.MultiSelect = multiSelect;

            return(ofd);
        }
コード例 #2
0
        private static SaveFileDialog CreateSaveFileDialog(string title, string context, string filter,
                                                           int filterIndex, string defaultExt, string suggestedFileName)
        {
            SaveFileDialog sfd = new SaveFileDialog();

            if (!string.IsNullOrEmpty(title))
            {
                sfd.Title = title;
            }

            if (!string.IsNullOrEmpty(context))
            {
                sfd.Directory = new Uri(context);
            }

            if (!string.IsNullOrEmpty(filter))
            {
                UIHelper.ConvertFileDialogFilters(sfd, filter);

                //if (filterIndex > 0) sfd.FilterIndex = filterIndex;
            }

            if (!string.IsNullOrEmpty(suggestedFileName))
            {
                sfd.FileName = suggestedFileName;
            }

            return(sfd);
        }