Beispiel #1
0
        private void ButtonX6_Click(object sender, EventArgs e)
        {
            var script = GetSelectedScript();
            var patch  = GetSelectedPatch();

            if (script is object && patch is object)
            {
                var editor = new TweakScriptEditor(script, rommgr, patch.EmbeddedFiles);
                Flyout1.Close();
                editor.ShowDialog(this);
                ComboItem ci = (ComboItem)ComboBoxEx_Scripts.SelectedItem;
                if (ci is object)
                {
                    if (!string.IsNullOrEmpty(script.Name))
                    {
                        ci.Text = script.Name;
                    }
                    else
                    {
                        ci.Text = "Untitled";
                    }
                }

                if (editor.WantToSave && editor.NeedToSave)
                {
                    SaveSinglePatch(GetSelectedPatch());
                    ItemListBox1_SelectedItemChanged();
                }
            }
        }
 private void ButtonX7_Click(object sender, EventArgs e)
 {
     ComboBoxEx2.SuspendLayout();
     File.Delete(SelectedProfile().FileName);
     presets.Remove(SelectedProfile());
     ComboBoxEx2.Items.Remove(ComboBoxEx2.SelectedItem);
     ComboBoxEx2.SelectedIndex = 0;
     ComboBoxEx2.ResumeLayout();
     Flyout1.Close();
 }
Beispiel #3
0
        private void ItemListBox1_ItemMouseClick(object sender, EventArgs e)
        {
            var       contentSize    = Flyout1.GetFlyoutFormSize();
            var       cursorPosition = Cursor.Position;
            var       pos            = ePointerSide.Top;
            var       screen         = Screen.FromPoint(cursorPosition);
            var       workingArea    = screen.Bounds;
            Rectangle rectContent    = default;
            var       success        = false;

            bool checkIfInBounds(Rectangle rectangle)
            {
                if (rectangle.Bottom < workingArea.Bottom &&
                    rectangle.Right < workingArea.Right &&
                    rectangle.Top >= workingArea.Top &&
                    rectangle.Left >= workingArea.Left)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            foreach (var testpost in new[] { ePointerSide.Top, ePointerSide.Bottom })
            {
                if (!success)
                {
                    switch (testpost)
                    {
                    case ePointerSide.Top:
                        rectContent = new Rectangle(new Point((int)(cursorPosition.X - contentSize.Width / 2.0), cursorPosition.Y), contentSize);
                        break;

                    case ePointerSide.Bottom:
                        rectContent = new Rectangle(new Point((int)(cursorPosition.X - contentSize.Width / 2.0), cursorPosition.Y - contentSize.Height), contentSize);
                        break;
                    }

                    if (checkIfInBounds(rectContent))
                    {
                        success = true;
                        pos     = testpost;
                    }
                }
            }

            if (success)
            {
                var rectShowBounds = new Rectangle(rectContent.Location, Size.Empty);
                var pointerOffset  = (int)(Flyout1.Content.Width / 2.0 - FlyoutForm.PointerSize.Width / 2.0);
                Flyout1.Show(rectShowBounds, pos, pointerOffset, ItemListBox1);
            }
        }
Beispiel #4
0
        private void ButtonX5_Click(object sender, EventArgs e)
        {
            ButtonItem   btnItem = (ButtonItem)ItemListBox1.SelectedItem;
            PatchProfile patch   = (PatchProfile)btnItem?.Tag;

            if (patch is object && MessageBoxEx.Show(this, "Are you sure to remove this tweak? You will not be able to recover it.", "Remove Tweak", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                Flyout1.Close();
                ItemListBox1.Items.Remove(btnItem);
                ItemListBox1.Refresh();
                myPatchs.Remove(patch);
                File.Delete(patch.FileName);
            }
        }
Beispiel #5
0
        private void ButtonX2_Click(object sender, EventArgs e)
        {
            PatchProfile patch = (PatchProfile)((ButtonItem)ItemListBox1.SelectedItem)?.Tag;

            // Close Flyout
            Flyout1.Close();

            // Edit the Patch
            EditPatch(patch);

            // Save Patch
            SaveSinglePatch(patch);

            // Update Tweak Infos
            ItemListBox1_SelectedItemChanged();
        }
Beispiel #6
0
 private void CommandBarFlyoutButton_Click(object sender, RoutedEventArgs e)
 {
     Flyout1.ShowAt(sender as DependencyObject, new FlyoutShowOptions {
         Placement = FlyoutPlacementMode.TopEdgeAlignedLeft, ShowMode = FlyoutShowMode.Transient
     });
 }
Beispiel #7
0
 private void ItemListBox1_Scroll(object sender, ScrollEventArgs e)
 {
     Flyout1.Close();
 }
Beispiel #8
0
 private void ButtonX3_Click(object sender, EventArgs e)
 {
     Flyout1.Close();
 }