Ejemplo n.º 1
0
 /// <summary>
 /// Update window title.
 /// </summary>
 public void UpdateWindowTitle()
 {
     if (this.plugin.Configuration.ShowKeybindInTitleBar && this.plugin.Configuration.KeybindEnabled)
     {
         if (this.plugin.Configuration.PrimaryKey.Equals(PrimaryKey.Enum.VkNone))
         {
             this.WindowName = string.Format(
                 Loc.Localize("TitleBarWithKeybind1", "PriceCheck ({0})"),
                 ModifierKey.Names[ModifierKey.EnumToIndex(this.plugin.Configuration.ModifierKey)]);
         }
         else
         {
             this.WindowName = string.Format(
                 Loc.Localize("TitleBarWithKeybind2", "PriceCheck ({0}+{1})"),
                 ModifierKey.Names[ModifierKey.EnumToIndex(this.plugin.Configuration.ModifierKey)],
                 PrimaryKey.Names[PrimaryKey.EnumToIndex(this.plugin.Configuration.PrimaryKey)]);
         }
     }
     else
     {
         this.WindowName = "PriceCheck";
     }
 }
Ejemplo n.º 2
0
        private void DrawKeybind()
        {
            var keybindEnabled = this.plugin.Configuration.KeybindEnabled;

            if (ImGui.Checkbox(
                    Loc.Localize("KeybindEnabled", "Enable keybind") + "###PriceCheck_KeybindEnabled_Checkbox",
                    ref keybindEnabled))
            {
                this.plugin.Configuration.KeybindEnabled = keybindEnabled;
                this.plugin.SaveConfig();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "KeybindEnabled_HelpMarker",
                                           "toggle if keybind is used or just hover"));

            var showKeybindInTitleBar = this.plugin.Configuration.ShowKeybindInTitleBar;

            if (ImGui.Checkbox(
                    Loc.Localize("ShowKeybindInTitleBar", "Show keybind in titlebar") + "###PriceCheck_ShowKeybindInTitleBar_Checkbox",
                    ref showKeybindInTitleBar))
            {
                this.plugin.Configuration.ShowKeybindInTitleBar = showKeybindInTitleBar;
                this.plugin.SaveConfig();
                this.plugin.WindowManager.MainWindow?.UpdateWindowTitle();
            }

            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ShowKeybindInTitleBar_HelpMarker",
                                           "toggle if keybind is displayed in titlebar"));

            ImGui.Spacing();
            ImGui.Text(Loc.Localize("ModifierKeybind", "Modifier"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "ModifierKeybind_HelpMarker",
                                           "set your modifier key (e.g. shift)"));
            var modifierKey =
                ModifierKey.EnumToIndex(this.plugin.Configuration.ModifierKey);

            if (ImGui.Combo(
                    "###PriceCheck_ModifierKey_Combo",
                    ref modifierKey,
                    ModifierKey.Names.ToArray(),
                    ModifierKey.Names.Length))
            {
                this.plugin.Configuration.ModifierKey =
                    ModifierKey.IndexToEnum(modifierKey);
                this.plugin.SaveConfig();
                this.plugin.WindowManager.MainWindow?.UpdateWindowTitle();
            }

            ImGui.Spacing();
            ImGui.Text(Loc.Localize("PrimaryKeybind", "Primary"));
            ImGuiComponents.HelpMarker(Loc.Localize(
                                           "PrimaryKeybind_HelpMarker",
                                           "set your primary key (e.g. None, Z)"));
            var primaryKey = PrimaryKey.EnumToIndex(this.plugin.Configuration.PrimaryKey);

            if (ImGui.Combo(
                    "###PriceCheck_PrimaryKey_Combo",
                    ref primaryKey,
                    PrimaryKey.Names.ToArray(),
                    PrimaryKey.Names.Length))
            {
                this.plugin.Configuration.PrimaryKey = PrimaryKey.IndexToEnum(primaryKey);
                this.plugin.SaveConfig();
                this.plugin.WindowManager.MainWindow?.UpdateWindowTitle();
            }
        }