Esempio n. 1
0
        protected override bool RunDialog(IntPtr hwndOwner)
        {
            using (var context = new ModalDialogContext())
            {
                var panel = new NSOpenPanel();
                panel.CanChooseFiles          = false;
                panel.CanChooseDirectories    = true;
                panel.CanCreateDirectories    = ShowNewFolderButton;
                panel.AllowsMultipleSelection = false;
                panel.ResolvesAliases         = true;
                panel.Title = Description ?? String.Empty;

                if (Prompt != null)
                {
                    panel.Prompt = Prompt;
                }

                if (!String.IsNullOrWhiteSpace(SelectedPath) && System.IO.Directory.Exists(SelectedPath) && IsSubfolderOf(SelectedPath, RootFolder))
                {
                    panel.DirectoryUrl = NSUrl.FromFilename(SelectedPath);
                }

                if (NSPanelButtonType.Ok != (NSPanelButtonType)(int)panel.RunModal())
                {
                    return(false);
                }

                SelectedPath = panel.Url.Path;
                return(true);
            }
        }
Esempio n. 2
0
        protected override bool RunDialog(IntPtr hwndOwner)
        {
            var currentDirectory = Environment.CurrentDirectory;

            try
            {
                using (var context = new ModalDialogContext())
                {
                    var panel = new NSSavePanel();

                    panel.CanSelectHiddenExtension = true;
                    panel.ExtensionHidden          = false;

                    if (!String.IsNullOrWhiteSpace(InitialDirectory) && Directory.Exists(InitialDirectory))
                    {
                        panel.DirectoryUrl = NSUrl.FromFilename(InitialDirectory);
                        currentDirectory   = InitialDirectory;
                    }

                    if (!String.IsNullOrEmpty(Filter))
                    {
                        ApplyFilter(panel, Filter);
                    }

                    if (!String.IsNullOrWhiteSpace(FileName))
                    {
                        panel.NameFieldStringValue = AdjustExtensionToMatchFilter(FileName, panel.AllowedFileTypes);
                    }


                    if (NSPanelButtonType.Ok != (NSPanelButtonType)(int)panel.RunModal())
                    {
                        return(false);
                    }

                    FileName = SelectedPath = panel.Url.Path;

                    return(true);
                }
            }
            finally
            {
                if (RestoreDirectory && currentDirectory != null && Directory.Exists(currentDirectory))
                {
                    Environment.CurrentDirectory = currentDirectory;
                }
            }
        }
Esempio n. 3
0
        void AppSettingsStartup(bool smth)
        {
            var ctx = new ModalDialogContext();

            AppSettingsView
            .Show(ctx)
            .Subscribe(
                result => {
                ctx.Dispose();
            },
                error => {
                ctx.Dispose();
                dbg.Error(error);
            }
                );
        }
Esempio n. 4
0
        void AboutClick(DeviceLinkEventArgs evarg)
        {
            var ctx = new ModalDialogContext();

            AboutView
            .Show(ctx)
            .Subscribe(
                result => {
                ctx.Dispose();
            },
                error => {
                ctx.Dispose();
                dbg.Error(error);
            }
                );
        }
Esempio n. 5
0
        void UpgradeBatchStartup(BatchTaskEventArgs evargs)
        {
            var ctx = new ModalDialogContext();

            ctx.RegisterInstance <BatchTaskEventArgs>(evargs);
            UpgradeBatchTaskView
            .Show(ctx)
            .Subscribe(
                result => {
                ctx.Dispose();
            },
                error => {
                ctx.Dispose();
                dbg.Error(error);
            }
                );
        }
Esempio n. 6
0
        void BackgroundTasksStartup(bool smth)
        {
            var             ctx       = new ModalDialogContext();
            IUnityContainer container = (IUnityContainer)ctx;

            container.RegisterInstance <IEventAggregator>(eventAggregator);
            BackgroundTasksView
            .Show(ctx)
            .Subscribe(
                result => {
                ctx.Dispose();
            },
                error => {
                ctx.Dispose();
                dbg.Error(error);
            }
                );
        }
Esempio n. 7
0
        internal DialogResult RunDialog()
        {
//			if (owner != null)
//				TopMost = owner.TopMost;
//			XplatUI.AudibleAlert (alert_type);

            if (owner != null && owner.Handle != IntPtr.Zero)
            {
                // TODO
                //alert.RunSheetModal(window);
            }

            using (var c = new ModalDialogContext()) {
                int index = (int)alert.RunModal() - (int)NSAlertButtonReturn.First;
                if (index >= buttons.Count)
                {
                    return(DialogResult.Cancel);
                }
                return(buttons[index].Result);
            }
        }
        protected override bool RunDialog(IntPtr hwndOwner)
        {
            var currentDirectory = Environment.CurrentDirectory;

            try
            {
                using (var context = new ModalDialogContext())
                {
                    var panel = new NSOpenPanel();
                    panel.AllowsMultipleSelection = Multiselect;
                    panel.ResolvesAliases         = true;

                    if (!String.IsNullOrWhiteSpace(InitialDirectory) && System.IO.Directory.Exists(InitialDirectory))
                    {
                        panel.DirectoryUrl = NSUrl.FromFilename(InitialDirectory);
                    }

                    if (!String.IsNullOrWhiteSpace(FileName))
                    {
                        panel.NameFieldStringValue = FileName;
                    }

                    if (NSPanelButtonType.Ok != (NSPanelButtonType)(int)panel.RunModal())
                    {
                        return(false);
                    }

                    FileNames = GetFileNames(panel);
                    FileName  = SelectedPath = FileNames.Length > 0 ? FileNames[0] : String.Empty;
                    return(true);
                }
            }
            finally
            {
                if (RestoreDirectory && currentDirectory != null && Directory.Exists(currentDirectory))
                {
                    Environment.CurrentDirectory = currentDirectory;
                }
            }
        }
Esempio n. 9
0
        protected override bool RunDialog(IntPtr hwndOwner)
        {
            var currentDirectory = Environment.CurrentDirectory;

            try
            {
                using (var context = new ModalDialogContext())
                {
                    var panel = new NSSavePanel();

                    if (!String.IsNullOrWhiteSpace(InitialDirectory) && Directory.Exists(InitialDirectory))
                    {
                        panel.DirectoryUrl = NSUrl.FromFilename(InitialDirectory);
                        currentDirectory   = InitialDirectory;
                    }

                    if (!String.IsNullOrWhiteSpace(FileName))
                    {
                        panel.NameFieldStringValue = FileName;
                    }

                    if (NSPanelButtonType.Ok != (NSPanelButtonType)(int)panel.RunModal())
                    {
                        return(false);
                    }

                    FileName = SelectedPath = panel.Url.Path;

                    return(true);
                }
            }
            finally
            {
                if (RestoreDirectory && currentDirectory != null && Directory.Exists(currentDirectory))
                {
                    Environment.CurrentDirectory = currentDirectory;
                }
            }
        }
Esempio n. 10
0
        protected override bool RunDialog(IntPtr hwndOwner)
        {
            var currentDirectory = Environment.CurrentDirectory;

            try
            {
                using (var context = new ModalDialogContext())
                {
                    using (var panel = new NSPrintPanel())
                    {
                        var info = NSPrintInfo.SharedPrintInfo ?? new NSPrintInfo();
                        if (NSPanelButtonType.Ok != (NSPanelButtonType)(int)panel.RunModalWithPrintInfo(info))
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
            }
            finally
            {
            }
        }