public static void ShowPluginWindow()
        {
            var plugin = new PluginWindow();

            plugin.Owner = Application.Current.MainWindow;
            plugin.ShowDialog();
        }
Beispiel #2
0
        private async void ButtonDeleteAccount_Click(object sender, RoutedEventArgs e)
        {
            string currentAccountName    = Settings.ActiveAccount;
            var    messageWindowSettings = new MetroDialogSettings()
            {
                AffirmativeButtonText = "Yes",
                NegativeButtonText    = "No"
            };
            var result = await this.ShowMessageAsync("Caution",
                                                     string.Format("Do you want to delete account {0}?", currentAccountName),
                                                     MessageDialogStyle.AffirmativeAndNegative,
                                                     messageWindowSettings);

            if (result != MessageDialogResult.Affirmative)
            {
                return;
            }

            // close plugin window
            if (PluginWindow != null && PluginWindow.IsVisible)
            {
                PluginWindow.Close();
            }

            Settings.DeleteAccount(currentAccountName);
            UpdateAccountsComboBox();
        }
Beispiel #3
0
 static ApplicationWindows()
 {
     try
     {
         DashboardWindow        = new DashboardWindow();
         MetadataWindow         = new AddonMetadataWindow();
         AddonWindow            = new AddonWindow();
         PluginWindow           = new PluginWindow();
         TypeWindow             = new TypeWindow();
         InstanceWindow         = new InstanceWindow();
         ActionWindow           = new ActionWindow();
         ConditionWindow        = new ConditionWindow();
         ExpressionWindow       = new ExpressionWindow();
         LanguageWindow         = new LanguageWindow();
         TestWidnow             = new TestWindow();
         OptionsWindow          = new OptionsWindow();
         FindAndReplaceWindow   = new SearchAndReplaceWindow();
         EffectPropertiesWindow = new EffectPropertiesWindow();
         EffectParameterWindow  = new EffectParameterWindow();
         EffectCodeWindow       = new EffectCodeWindow();
         C2Runtime = new C2RuntimeWindow();
         CssWindow = new CssWindow();
     }
     catch (Exception ex)
     {
         LogManager.AddErrorLog(ex);
         throw;
     }
 }
Beispiel #4
0
        private void PluginButton_Click(object sender, RoutedEventArgs e)
        {
            ApplicationStateManager.CurrentForm = ApplicationStateManager.CurrentFormState.Plugins;
            var plugin = new PluginWindow();

            ApplicationStateManager.CurrentForm = ApplicationStateManager.CurrentFormState.Main;
            plugin.ShowDialog();
        }
Beispiel #5
0
        public void FiguresEditor()
        {
            _ps = null;

            _ps             = new PaletteSet("Figures Editor");
            _ps.Size        = new Size(400, 600);
            _ps.DockEnabled = (DockSides)((int)DockSides.Left + (int)DockSides.Right);

            PluginWindow window = new PluginWindow();

            _ps.AddVisual("TestPlugin", window);

            _ps.KeepFocus = true;
            _ps.Visible   = true;
        }
Beispiel #6
0
        private void ComboboxCurrentAccount_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count == 0 || e.RemovedItems.Count == 0)
            {
                return;
            }
            // close plugin window
            if (PluginWindow != null && PluginWindow.IsVisible)
            {
                PluginWindow.Close();
            }
            else
            {
                Settings.SaveCurrentAccount(Settings.ActiveAccountSetsInfo.ToList());
            }

            string selectedAccountName = (e.AddedItems[0] as AccountSummary).AccountName;

            Settings.SetActiveAccount(selectedAccountName);
        }
Beispiel #7
0
        private async void ButtonImportFromGame_Click(object sender, RoutedEventArgs e)
        {
            const string message = "1) open My Collection in Hearthstone\n2) clear card filters\n3) do not move your mouse or type after clicking \"Import\"";

            var settings = new MetroDialogSettings {
                AffirmativeButtonText = "Import"
            };
            var result =
                await
                this.ShowMessageAsync("Import collection from Hearthstone", message, MessageDialogStyle.AffirmativeAndNegative, settings);

            if (result != MessageDialogResult.Affirmative)
            {
                return;
            }

            var importObject = new HearthstoneImporter();

            importObject.ImportStepDelay    = int.Parse((ComboboxImportSpeed.SelectedItem as ComboBoxItem).Tag.ToString());
            importObject.PasteFromClipboard = CheckboxImportPasteClipboard.IsChecked.HasValue ?
                                              CheckboxImportPasteClipboard.IsChecked.Value : false;
            importObject.NonGoldenFirst = CheckboxPrioritizeFullCollection.IsChecked.HasValue ?
                                          CheckboxPrioritizeFullCollection.IsChecked.Value : false;

            try
            {
                var selectedSetToImport = ((KeyValuePair <string, string>)ComboboxImportingSet.SelectedItem).Value;
                var collection          = await importObject.Import(selectedSetToImport);

                // close plugin window
                if (PluginWindow != null && PluginWindow.IsVisible)
                {
                    PluginWindow.Close();
                }
                foreach (var set in collection)
                {
                    var existingSet = Settings.ActiveAccountSetsInfo.FirstOrDefault(s => s.SetName == set.SetName);
                    if (existingSet == null)
                    {
                        Settings.ActiveAccountSetsInfo.Add(set);
                    }
                    else
                    {
                        // keep desired amount
                        foreach (var card in set.Cards)
                        {
                            var existingCardInfo = existingSet.Cards.FirstOrDefault(c => c.CardId == card.CardId);
                            if (existingCardInfo != null)
                            {
                                card.DesiredAmount = existingCardInfo.DesiredAmount;
                            }
                        }
                        existingSet.Cards = set.Cards;
                    }
                }
                this.ShowMessageAsync("Import succeed", "Your collection is successfully imported from Hearthstone!");
            }
            catch (ImportingException ex)
            {
                this.ShowMessageAsync("Importing aborted", ex.Message);
            }

            // bring settings window to front
            if (WindowState == WindowState.Minimized)
            {
                WindowState = WindowState.Normal;
            }

            Activate();
            Topmost = true;
            Topmost = false;
            Focus();

            // save imported collection
            HearthstoneCollectionTrackerPlugin.Settings.SaveCurrentAccount();
        }
 public MainMenuShowPlugins()
     : base()
 {
     _pluginWindow = new PluginWindow();
 }