public EntrySelectView() { mBackButton = new Button { Size = new Vector2(75, 25), Text = "Back" }; mBackButton.OnClick += OnBackButtonClick; mWdlControl.LocationSelected += OnLocationSelected; }
public SplashView() { mAppTitle = new Label { Color = Brushes.White, Position = new Vector2(30, 30), Text = Strings.SplashView_AppTitle, Size = new Vector2(float.MaxValue, 40.0f), FontSize = 35.0f }; mDescription = new Label { Color = Brushes.White, Position = new Vector2(30, 110), Text = Strings.SplashView_AppDescription, FontSize = 20.0f, Multiline = true }; mInputPath = new EditBox { Width = 500.0f }; mBrowseButton = new Button { Text = "...", Size = new Vector2(50, 30) }; mRegistryButton = new Button { Text = "From Registry", Size = new Vector2(150, 30) }; mConfirmButton = new Button { Text = "Load!", Size = new Vector2(100, 30) }; mBrowseButton.OnClick += BrowseFolder; mRegistryButton.OnClick += LoadFromRegistry; mConfirmButton.OnClick += InitFilesystem; }
private static void OnBackButtonClick(Button button) { WorldFrame.Instance.State = AppState.MapSelect; }
private void InitFilesystem(Button button) { if (mInputPath.Text.Length == 0 || Directory.Exists(mInputPath.Text) == false) return; IO.FileManager.Instance.DataPath = mInputPath.Text; WorldFrame.Instance.State = AppState.FileSystemInit; }
private void LoadFromRegistry(Button button) { var result = LoadFromKey(Registry.CurrentUser) ?? LoadFromKey(Registry.LocalMachine); if (result == null) return; mInputPath.Text = result; }
private void BrowseFolder(Button button) { var fd = (IFileOpenDialog) Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("{DC1C5A9C-E88A-4DDE-A5A1-60F82A20AEF7}"))); Fos options; fd.GetOptions(out options); options |= Fos.FosPickfolders; fd.SetOptions(options); var wnd = InterfaceManager.Instance.RenderWindow; var result = 0; if (wnd.InvokeRequired) wnd.Invoke(new Action(() => result = fd.Show(wnd.Handle))); else result = fd.Show(IntPtr.Zero); if (result != 0) return; IShellItem item; fd.GetResult(out item); if (item == null) return; var ptrOut = IntPtr.Zero; try { item.GetDisplayName(Sigdn.Filesyspath, out ptrOut); mInputPath.Text = Marshal.PtrToStringUni(ptrOut); } catch(Exception) { item.GetDisplayName(Sigdn.Normaldisplay, out ptrOut); mInputPath.Text = Marshal.PtrToStringUni(ptrOut); } finally { if (ptrOut != IntPtr.Zero) Marshal.FreeCoTaskMem(ptrOut); } }