示例#1
0
		public override bool OpenFileDialog(OpenFileDialogParams openParams, OpenFileDialogDelegate callback)
		{
			WidgetForWindowsFormsAbstract.MainWindowsFormsWindow.ShowingSystemDialog = true;
			openParams.FileName = "";
			openParams.FileNames = null;

			OpenFileDialog openFileDialog1 = new OpenFileDialog();

			openFileDialog1.InitialDirectory = openParams.InitialDirectory;
			openFileDialog1.Filter = openParams.Filter;
			openFileDialog1.Multiselect = openParams.MultiSelect;
			openFileDialog1.Title = openParams.Title;

			openFileDialog1.FilterIndex = openParams.FilterIndex;
			openFileDialog1.RestoreDirectory = true;

			if (openFileDialog1.ShowDialog() == DialogResult.OK)
			{
				openParams.FileNames = openFileDialog1.FileNames;
				openParams.FileName = openFileDialog1.FileName;
			}

			WidgetForWindowsFormsAbstract.MainWindowsFormsWindow.ShowingSystemDialog = false;

			UiThread.RunOnIdle((state) =>
			{
				OpenFileDialogParams openParamsIn = state as OpenFileDialogParams;
				if (openParamsIn != null)
				{
					callback(openParamsIn);
				}
			}, openParams);
			return true;
		}
示例#2
0
        public override bool OpenFileDialog(OpenFileDialogParams openParams, OpenFileDialogDelegate callback)
        {
            WidgetForWindowsFormsAbstract.MainWindowsFormsWindow.ShowingSystemDialog = true;
            openParams.FileName  = "";
            openParams.FileNames = null;

            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.InitialDirectory = openParams.InitialDirectory;
            openFileDialog1.Filter           = openParams.Filter;
            openFileDialog1.Multiselect      = openParams.MultiSelect;
            openFileDialog1.Title            = openParams.Title;

            openFileDialog1.FilterIndex      = openParams.FilterIndex;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                openParams.FileNames = openFileDialog1.FileNames;
                openParams.FileName  = openFileDialog1.FileName;
            }

            WidgetForWindowsFormsAbstract.MainWindowsFormsWindow.ShowingSystemDialog = false;

            UiThread.RunOnIdle((object state) =>
            {
                callback(openParams);
            });
            return(true);
        }
示例#3
0
    static void Init()
    {
        if (!inited)
        {
#if UNITY_STANDALONE_WIN || UNITY_METRO
            string path = UnityEngine.Application.dataPath + "/Plugins/";
#if UNITY_EDITOR
            path += "x86/";
#endif
            if (LoadLibrary(path + "msvcr100.dll") == IntPtr.Zero)
            {
                Text.Error("failed to load msvcr100");
            }
            IntPtr lib = LoadLibrary(path + "FileDialogs.dll");
            if (lib == IntPtr.Zero)
            {
                Text.Error("Failed to load FileDialogs");
                return;
            }

            IntPtr proc = GetProcAddress(lib, "OpenFileDialog");
            OpenFileDialog = (OpenFileDialogDelegate)Marshal.GetDelegateForFunctionPointer(proc, typeof(OpenFileDialogDelegate));

            proc           = GetProcAddress(lib, "SaveFileDialog");
            SaveFileDialog = (SaveFileDialogDelegate)Marshal.GetDelegateForFunctionPointer(proc, typeof(SaveFileDialogDelegate));
#elif UNITY_STANDALONE_OSX
            OsVersionChecker checker = new OsVersionChecker();
            if (checker.currentVersion == OsVersion.SnowLeopard)
            {
                OpenFileDialog = OSX_PreLion.OpenFileDialog;
                SaveFileDialog = OSX_PreLion.SaveFileDialog;
            }
            else
            {
                OpenFileDialog = OSX_PostLion.OpenFileDialog;
                SaveFileDialog = OSX_PostLion.SaveFileDialog;
            }
#endif
            inited = true;
        }
    }
示例#4
0
		public abstract bool OpenFileDialog(OpenFileDialogParams openParams, OpenFileDialogDelegate callback);
示例#5
0
 public abstract bool OpenFileDialog(OpenFileDialogParams openParams, OpenFileDialogDelegate callback);