static void Postfix(Dialog_ManageOutfits __instance, Rect inRect) { if (Widgets.ButtonText(new Rect(480f, 0f, 150f, 35f), "SaveStorageSettings.LoadAsNew".Translate(), true, false, true)) { Outfit outfit = Current.Game.outfitDatabase.MakeNewOutfit(); SetSelectedOutfit(__instance, outfit); LoadDialog dialog = new LoadDialog("Apparel_Management", outfit.filter); Find.WindowStack.Add(dialog); } Outfit selectedOutfit = GetSelectedOutfit(__instance); if (selectedOutfit != null) { Text.Font = GameFont.Small; GUI.BeginGroup(new Rect(220f, 49f, 300, 32f)); if (Widgets.ButtonText(new Rect(0f, 0f, 150f, 32f), "SaveStorageSettings.SaveOutfit".Translate(), true, false, true)) { Find.WindowStack.Add(new SaveDialog("Apparel_Management", selectedOutfit.filter)); } if (Widgets.ButtonText(new Rect(160f, 0f, 150f, 32f), "LoadStorageSettings.SaveOutfit".Translate(), true, false, true)) { Find.WindowStack.Add(new LoadDialog("Apparel_Management", selectedOutfit.filter)); } GUI.EndGroup(); } }
private T ShowLoadJsonObjectDialog <T>() { LoadDialog.InitialDirectory = JsonFiles.JsonFilePaths[typeof(T).Name]; LoadDialog.ShowDialog(); if (LoadDialog.FileName != "") { return(JsonFiles.LoadFrom <T>(LoadDialog.FileName)); } else { return(default(T)); } }
public void InitializeUI() { int topBarHeight = 24; int sideBarWidth = 240; Parameters parameters = Parameters.Filled; TopBar = new TopBar(parent, parent.ScreenWidth / 3, topBarHeight, new Vector2(parent.ScreenWidth / 3, 0), parameters, FillColor); FileMenu fileMenu = new FileMenu(TopBar); TopBar.AddButton(fileMenu); TopBar.AddButton(new EditMenu(TopBar)); parent.objectHandler.InputStateChanged += TopBar.OnInputStateChanged; SideBar leftSideBar = new SideBar(parent, sideBarWidth, parent.ScreenHeight, Vector2.Zero, parameters, FillColor); leftSideBar.AddTool(new TextureCatalog(leftSideBar)); leftSideBar.AddTool(new GridTools(leftSideBar)); SideBar rightSideBar = new SideBar(parent, sideBarWidth, parent.ScreenHeight, new Vector2(parent.ScreenWidth - sideBarWidth, 0), parameters, FillColor); rightSideBar.AddTool(new SpriteScale(rightSideBar)); rightSideBar.AddTool(new SpriteZValue(rightSideBar)); rightSideBar.AddTool(new SpriteColorTint(rightSideBar)); rightSideBar.AddTool(new SpriteRotation(rightSideBar)); rightSideBar.AddTool(new SpriteFlip(rightSideBar)); DialogWindow saveDialog = new SaveDialog(parent); fileMenu.saveButton.ButtonPressed += saveDialog.Show; DialogWindow loadDialog = new LoadDialog(parent); fileMenu.loadButton.ButtonPressed += loadDialog.Show; DialogWindow newProjectDialog = new NewDialog(parent); fileMenu.newProjectButton.ButtonPressed += newProjectDialog.Show; uiObjects.Add(TopBar); uiObjects.Add(leftSideBar); uiObjects.Add(rightSideBar); uiObjects.Add(saveDialog); uiObjects.Add(loadDialog); uiObjects.Add(newProjectDialog); }
public static Gizmo AppendGizmo(LoadDialog dialog, string labelKey = "SaveStorageSettings.AppendSettings", string descKey = "SaveStorageSettings.AppendSettingsDesc", int groupkey = 987767554) { if (dialog == null) { throw new ArgumentNullException("dialog"); } return(new Command_Action { icon = HarmonyPatches.AppendTexture, defaultLabel = labelKey.Translate(), defaultDesc = descKey.Translate(), activateSound = SoundDef.Named("Click"), action = delegate { Find.WindowStack.Add(dialog); }, groupKey = groupkey }); }
void ReadAndSetArray() { lastUnitDialog = LoadedDialogs.Length - 1; try { string[] local = LoadDialog.GetDialogs(DialogNameToLoad); int size = LoadedDialogs.Length + local.Length; string[] localsecond = new string[size]; for (int i = 0; i < size; i++) { if (LoadedDialogs.Length < i) { localsecond[i] = LoadedDialogs[i]; } else { localsecond[i] = local[i - LoadedDialogs.Length]; } } } catch { } }
private void LoadButton_Click(object sender, EventArgs e) { LoadDialog LoadDialogAdd = new LoadDialog(); DialogResult dialogResultAddNode = DialogResult.Cancel; dialogResultAddNode = LoadDialogAdd.ShowDialog(); if (dialogResultAddNode == DialogResult.OK) { if (LoadDialogAdd.DialogResult.Equals(DialogResult.OK)) { ProtocolNode treeNode = new ProtocolNode(LoadDialogAdd.getProtocolName()); DataGridView DGV = LoadDialogAdd.getDGV(); tlvProtocol.Nodes.Add(treeNode); DataSets.dsModuleStructure3.dtSavedProtocolRow row; DataSets.dsModuleStructure3.dtStepCompositeRow Compositerow; foreach (DataGridViewRow DGVrow in DGV.Rows) { DataRowView rowView = DGVrow.DataBoundItem as DataRowView; row = rowView.Row as DataSets.dsModuleStructure3.dtSavedProtocolRow; foreach (DataSets.dsModuleStructure3.dtStepCompositeRow CompositeRow in dsModuleStructure.dtStepComposite) { if (row.fk_step_composite == CompositeRow.pk_id) { addNodes(CompositeRow, treeNode); } } } } } //if (result == DialogResult.OK) //{ // LoadTree(tlvProtocol, dialogue.FileName); //} }
private void FileLoadButton_Click(object sender, EventArgs e) => LoadDialog.ShowDialog();