public bool Run (AddFileDialogData data)
        {
			Application.EnableVisualStyles ();
			
			var parentWindow = data.TransientFor ?? MessageService.RootWindow;
            CustomAddFilesDialog adlg = new CustomAddFilesDialog();
            adlg.StartLocation = AddonWindowLocation.Bottom;
            adlg.BuildActions = data.BuildActions;
            bool result = false;
			
			SelectFileDialogHandler.SetCommonFormProperties (data, adlg.FileDialog);
			
            try
            {
                if (adlg.ShowDialog () == DialogResult.Cancel)
                    result = false;
                else
                {
					FilePath[] paths = new FilePath [adlg.FileDialog.FileNames.Length];
					for (int n=0; n<adlg.FileDialog.FileNames.Length; n++)
						paths [n] = adlg.FileDialog.FileNames [n];
                    data.SelectedFiles = paths;
                    data.OverrideAction = adlg.OverrideAction;
                    result = true;
                }
            }
            finally
            {
                adlg.Dispose();
            }
			
			parentWindow.Present ();
            return result;
        }
Exemplo n.º 2
0
        bool RunDialog (AddFileDialogData data)
        {
			Application.EnableVisualStyles ();
			
            CustomAddFilesDialog adlg = new CustomAddFilesDialog();
            adlg.StartLocation = AddonWindowLocation.Bottom;
            adlg.BuildActions = data.BuildActions;
            bool result = false;
			
			SelectFileDialogHandler.SetCommonFormProperties (data, adlg.FileDialog);
			
            try
            {
                rootForm = new WinFormsRoot ();
                if (adlg.ShowDialog (rootForm) == DialogResult.Cancel)
                    result = false;
                else
                {
					FilePath[] paths = new FilePath [adlg.FileDialog.FileNames.Length];
					for (int n=0; n<adlg.FileDialog.FileNames.Length; n++)
						paths [n] = adlg.FileDialog.FileNames [n];
                    data.SelectedFiles = paths;
                    data.OverrideAction = adlg.OverrideAction;
                    result = true;
                }
            }
            finally
            {
                adlg.Dispose();
            }
			
            return result;
        }
Exemplo n.º 3
0
        public bool Run(AddFileDialogData data)
        {
            CustomAddFilesDialog adlg = new CustomAddFilesDialog();

            adlg.StartLocation = AddonWindowLocation.Bottom;
            adlg.OpenDialog.InitialDirectory = data.CurrentFolder;
            adlg.OpenDialog.AddExtension     = true;
            adlg.BuildActions = data.BuildActions;
//            adlg.OpenDialog.Filter = "Image Files(*.bmp;*.jpg;*.gif;*.png)|*.bmp;*.jpg;*.gif;*.png";
            WinFormsRunner runner = new WinFormsRunner();
            bool           result = false;

            Timer t = new Timer();

            t.Interval = 20;
            try
            {
                t.Tick += delegate
                {
//                    MonoDevelop.Core.Gui.DispatchService.RunPendingEvents();
                };
                //t.Enabled = true;
                WinFormsRoot root = new WinFormsRoot();
                if (adlg.ShowDialog(root) == DialogResult.Cancel)
                {
                    result = false;
                }
                else
                {
                    FilePath[] paths = new FilePath [adlg.OpenDialog.FileNames.Length];
                    for (int n = 0; n < adlg.OpenDialog.FileNames.Length; n++)
                    {
                        paths [n] = adlg.OpenDialog.FileNames [n];
                    }
                    data.SelectedFiles  = paths;
                    data.OverrideAction = adlg.OverrideAction;
                    result = true;
                }
            }
            finally
            {
                t.Enabled = false;
                adlg.Dispose();
            }

            return(result);
        }
        public bool Run (AddFileDialogData data)
        {
            CustomAddFilesDialog adlg = new CustomAddFilesDialog();
            adlg.StartLocation = AddonWindowLocation.Bottom;
            adlg.OpenDialog.InitialDirectory = data.CurrentFolder;
            adlg.OpenDialog.AddExtension = true;
            adlg.BuildActions = data.BuildActions;
//            adlg.OpenDialog.Filter = "Image Files(*.bmp;*.jpg;*.gif;*.png)|*.bmp;*.jpg;*.gif;*.png";
            WinFormsRunner runner = new WinFormsRunner();
            bool result = false;

            Timer t = new Timer();
            t.Interval = 20;
            try
            {
                t.Tick += delegate
                {
//                    MonoDevelop.Core.Gui.DispatchService.RunPendingEvents();
                };
                //t.Enabled = true;
                WinFormsRoot root = new WinFormsRoot();
                if (adlg.ShowDialog(root) == DialogResult.Cancel)
                    result = false;
                else
                {
					FilePath[] paths = new FilePath [adlg.OpenDialog.FileNames.Length];
					for (int n=0; n<adlg.OpenDialog.FileNames.Length; n++)
						paths [n] = adlg.OpenDialog.FileNames [n];
                    data.SelectedFiles = paths;
                    data.OverrideAction = adlg.OverrideAction;
                    result = true;
                }
            }
            finally
            {
                t.Enabled = false;
                adlg.Dispose();
            }

            return result;
        }
Exemplo n.º 5
0
        public bool Run (AddFileDialogData data)
        {
            CustomAddFilesDialog adlg = new CustomAddFilesDialog();
            adlg.StartLocation = AddonWindowLocation.Bottom;
            adlg.BuildActions = data.BuildActions;
            WinFormsRunner runner = new WinFormsRunner();
            bool result = false;
			
			SelectFileDialogHandler.SetCommonFormProperties (data, adlg.OpenDialog);
			
            Timer t = new Timer();
            t.Interval = 20;
            try
            {
                t.Tick += delegate
                {
//                    MonoDevelop.Core.Gui.DispatchService.RunPendingEvents();
                };
                //t.Enabled = true;
                WinFormsRoot root = new WinFormsRoot();
                if (adlg.ShowDialog(root) == DialogResult.Cancel)
                    result = false;
                else
                {
					FilePath[] paths = new FilePath [adlg.OpenDialog.FileNames.Length];
					for (int n=0; n<adlg.OpenDialog.FileNames.Length; n++)
						paths [n] = adlg.OpenDialog.FileNames [n];
                    data.SelectedFiles = paths;
                    data.OverrideAction = adlg.OverrideAction;
                    result = true;
                }
            }
            finally
            {
                t.Enabled = false;
                adlg.Dispose();
            }

            return result;
        }
Exemplo n.º 6
0
        bool RunDialog(AddFileDialogData data)
        {
            Application.EnableVisualStyles();

            CustomAddFilesDialog adlg = new CustomAddFilesDialog();

            adlg.StartLocation = AddonWindowLocation.Bottom;
            adlg.BuildActions  = data.BuildActions;
            bool result = false;

            SelectFileDialogHandler.SetCommonFormProperties(data, adlg.FileDialog);

            try
            {
                rootForm = new WinFormsRoot();
                if (adlg.ShowDialog(rootForm) == DialogResult.Cancel)
                {
                    result = false;
                }
                else
                {
                    FilePath[] paths = new FilePath [adlg.FileDialog.FileNames.Length];
                    for (int n = 0; n < adlg.FileDialog.FileNames.Length; n++)
                    {
                        paths [n] = adlg.FileDialog.FileNames [n];
                    }
                    data.SelectedFiles  = paths;
                    data.OverrideAction = adlg.OverrideAction;
                    result = true;
                }
            }
            finally
            {
                adlg.Dispose();
            }

            return(result);
        }