コード例 #1
0
        public void OnLoad()
        {
            DefaultDataUpdater.PerformUpdates();

            Settings = PluginSettings.LoadSettings(PluginDataDir);

            MainMenuItem = new PluginMenuItem {
                Header = Name
            };
            MainMenuItem.Click += (sender, args) =>
            {
                if (MainWindow == null)
                {
                    InitializeMainWindow();
                    Debug.Assert(MainWindow != null, "_mainWindow != null");
                    MainWindow.Show();
                }
                else
                {
                    MainWindow.Activate();
                }
            };

            Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckCreated.Add(HandleHearthstoneDeckUpdated);
            Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckUpdated.Add(HandleHearthstoneDeckUpdated);
            Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckDeleted.Add(HandleHearthstoneDeckDeleted);

            DispatcherTimer importTimer = new DispatcherTimer {
                Interval = new TimeSpan(0, 0, 0, 5)
            };

            importTimer.Tick     += ImportTimerOnTick;
            importTimer.IsEnabled = true;
            importTimer.Start();
        }
        public void OnLoad()
        {
            DefaultDataUpdater.PerformUpdates();

            Settings = PluginSettings.LoadSettings(PluginDataDir);

            // initialize image for icon
            var img = new Image();
            var bmp = new BitmapImage();

            bmp.BeginInit();
            bmp.UriSource = new Uri(@"pack://application:,,,/HearthstoneCollectionTracker;component/Internal/HSCollection.ico", UriKind.RelativeOrAbsolute);
            bmp.EndInit();

            img.Source = bmp;
            img.Width  = bmp.PixelWidth;

            MainMenuItem = new MenuItem
            {
                Header = Name,
                Icon   = img
            };

            MainMenuItem.Click += (sender, args) =>
            {
                if (_mainWindow == null)
                {
                    InitializeMainWindow();
                    _mainWindow.Show();
                }
                else
                {
                    _mainWindow.Activate();
                }
            };

            Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckCreated.Add(HandleHearthstoneDeckUpdated);
            Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckUpdated.Add(HandleHearthstoneDeckUpdated);
        }
        public void OnLoad()
        {
            DefaultDataUpdater.PerformUpdates();

            Settings = PluginSettings.LoadSettings(PluginDataDir);

            MainMenuItem        = new PluginMenuItem();
            MainMenuItem.Header = Name;
            MainMenuItem.Click += (sender, args) =>
            {
                if (_mainWindow == null)
                {
                    InitializeMainWindow();
                    _mainWindow.Show();
                }
                else
                {
                    _mainWindow.Activate();
                }
            };

            Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckCreated.Add(HandleHearthstoneDeckUpdated);
            Hearthstone_Deck_Tracker.API.DeckManagerEvents.OnDeckUpdated.Add(HandleHearthstoneDeckUpdated);
        }