Example #1
0
        void dlg_OnFolderSelected(VistaFolderBrowserDialog dlg, string path)
        {
            dlg.SetTitle("Open existing project");

            // Path may be empty. In this case we have not selected a folder.
            bool enableOk = false;

            if (String.IsNullOrEmpty(path))
            {
                dlg.SetDescription("Select project folder to open");
            }
            else
            {
                bool isUnity = true;
                isUnity = isUnity && Directory.Exists(path);
                isUnity = isUnity && Directory.Exists(Path.Combine(path, "Assets"));

                if (isUnity)
                {
                    dlg.SetDescription("");
                    enableOk = true;
                }
                else
                {
                    String msg = String.Format("Selected folder is not a Unity project");
                    dlg.SetDescription(msg);
                }
            }

            dlg.EnableOk(enableOk);
        }