Beispiel #1
0
        public bool Show(IntPtr hWndOwner)
        {
            var result = Environment.OSVersion.Version.Major >= 6
                                ? WindowsDialog.Show(hWndOwner, InitialDirectory, Title)
                                : ShowXpDialog(hWndOwner, InitialDirectory, Title);

            FileName = result.FileName;
            return(result.Result);
        }
Beispiel #2
0
        public IEnumerable <string> DoStuff()
        {
            Dialog dialog = new WebDialog();

            dialog.Render();
            dialog.OkButton.OnClick();

            Dialog dialog2 = new WindowsDialog();

            dialog2.Render();
            dialog2.OkButton.OnClick();

            return(_events);
        }
Beispiel #3
0
        public static String fileOpenDialog()
        {
            switch (Platform.getOS())
            {
            case Platform.OS.Win:
                String ret        = "";
                bool   fullscreen = false;

                //in case we are patching
                try {
                    fullscreen = Screen.fullScreen;
                } catch {
                    fullscreen = false;
                }

                if (fullscreen)
                {
                    App.Popups.ShowOk(null, "warningFullscreen", "Error", "File Dialogs do not work in fullscreen mode, please switch to proceed", "Cancel");
                }
                else
                {
                    ret = WindowsDialog.ShowWindowsDialog();
                }
                if (ret.Equals(""))
                {
                    return(null);
                }
                else
                {
                    return(ret);
                }

            case Platform.OS.Mac:
                byte[] monoMacLoad = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("ScrollsModLoader.NativeAPIs.MonoMac.dll").ReadToEnd();
                System.Reflection.Assembly monoMac = System.Reflection.Assembly.Load(monoMacLoad);
                object panel = monoMac.CreateInstance("MonoMac.AppKit.NSOpenPanel");
                //Note: AllowedFileTypes is currently broken on MonoMac. it freezes the app
                panel.GetType().GetProperty("AllowsMultipleSelection").SetValue(panel, false, null);
                if ((int)panel.GetType().GetMethod("RunModal", new Type[] {}).Invoke(panel, null) == 0)
                {
                    return(null);
                }
                return(((String[])(panel.GetType().GetProperty("Filenames").GetValue(panel, null)))[0]);

            default:
                Console.WriteLine("Unsupported OS");
                break;
            }
            return(null);
        }