Esempio n. 1
0
 /// <summary>
 /// Shows the dialog.
 /// </summary>
 public bool Run(WindowFrame parentWindow)
 {
     try {
         running = true;
         Backend.Initialize(filters, multiselect, initialFileName);
         if (!string.IsNullOrEmpty(currentFolder))
         {
             Backend.CurrentFolder = currentFolder;
         }
         if (activeFilter != null)
         {
             Backend.ActiveFilter = activeFilter;
         }
         if (!string.IsNullOrEmpty(title))
         {
             Backend.Title = title;
         }
         return(Backend.Run((IWindowFrameBackend)BackendHost.ToolkitEngine.GetSafeBackend(parentWindow)));
     } finally {
         currentFolder = Backend.CurrentFolder;
         activeFilter  = Backend.ActiveFilter;
         fileName      = Backend.FileName;
         fileNames     = Backend.FileNames;
         currentFolder = Backend.CurrentFolder;
         running       = false;
         Backend.Cleanup();
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Shows the dialog.
 /// </summary>
 public bool Run(WindowFrame parentWindow)
 {
     try {
         running = true;
         Backend.Initialize(filters, multiselect, initialFileName);
         if (!string.IsNullOrEmpty(currentFolder))
         {
             Backend.CurrentFolder = currentFolder;
         }
         if (activeFilter != null)
         {
             Backend.ActiveFilter = activeFilter;
         }
         if (!string.IsNullOrEmpty(title))
         {
             Backend.Title = title;
         }
         bool result = false;
         BackendHost.ToolkitEngine.InvokePlatformCode(delegate {
             result = Backend.Run((IWindowFrameBackend)Toolkit.GetBackend(parentWindow));
         });
         return(result);
     } finally {
         activeFilter = Backend.ActiveFilter;
         fileName     = Backend.FileName;
         fileNames    = Backend.FileNames;
         if (fileName != string.Empty)
         {
             currentFolder = Backend.CurrentFolder;
         }
         running = false;
         Backend.Cleanup();
     }
 }
Esempio n. 3
0
        void BtnClicked(object sender, EventArgs e)
        {
            if (FileSelectionMode == FileSelectionMode.Open)
            {
                dialog = new OpenFileDialog();
            }
            else
            {
                dialog = new SaveFileDialog();
            }

            try {
                foreach (var f in filters)
                {
                    dialog.Filters.Add(f);
                }
                if (!string.IsNullOrEmpty(currentFolder))
                {
                    dialog.CurrentFolder = currentFolder;
                }
                if (activeFilter != null)
                {
                    dialog.ActiveFilter = activeFilter;
                }
                if (!string.IsNullOrEmpty(title))
                {
                    dialog.Title = title;
                }
                if (dialog.Run(ParentWindow))
                {
                    FileName = dialog.FileName;
                }
            } finally {
                currentFolder = dialog.CurrentFolder;
                activeFilter  = dialog.ActiveFilter;
                dialog.Dispose();
                dialog = null;
            }
        }
Esempio n. 4
0
 void AddRemoveItem(FileDialogFilter filter, bool added)
 {
     CheckNotRunning();
 }