示例#1
0
        private void statTextbox_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (_model?.profile.value == null)
            {
                return;
            }
            var statTextBox = sender as TextBox;

            if (statTextBox == null)
            {
                return;
            }
            var fieldName = statTextBox.Tag as string;

            if (fieldName == null)
            {
                return;
            }

            if (long.TryParse(statTextBox.Text, out long newValue))
            {
                EventLogger.logEvent("statTextbox_TextChanged");
                statTextBox.BorderBrush = Brushes.Gray;
                if (_model !.profile.value.ProgressStatCounters.ContainsKey(fieldName))
                {
                    _model !.profile.value.ProgressStatCounters[fieldName] = newValue;
                }
                else
                {
                    _model !.profile.value.MobKills[fieldName] = newValue;
                }
            }
示例#2
0
        private async void handleFileOpenAsync(string?fileName)
        {
            if (string.IsNullOrWhiteSpace(fileName))
            {
                return;
            }
            if (!File.Exists(fileName))
            {
                showError(R.FILE_DOESNT_EXIST_ERROR_MESSAGE);
                return;
            }
            showBusyIndicator();
            string extension = Path.GetExtension(fileName !);

            EventLogger.logEvent("handleFileOpenAsync", new Dictionary <string, object>()
            {
                { "extension", extension }
            });
            var profile = await _mainModel.handleFileOpenAsync(fileName !);

            _mainModel.addRecentFile(fileName !);
            refreshRecentFilesList();
            if (this.model == null)
            {
                this.model = new ProfileViewModel();
            }
            this.model !.filePath         = fileName;
            this.model !.profile.setValue = profile;
            closeBusyIndicator();
        }
示例#3
0
        private void onRelaunch()
        {
            var mainWindow = this.MainWindow;

            _splashWindow = buildSplashWindow();
            MainWindow    = _splashWindow;
            mainWindow.Close();

            this.MainWindow.Show();

            EventLogger.logEvent("showGameFilesWindow");
            var gameFilesWindow = new GameFilesWindow(allowNoContent: false);

            gameFilesWindow.Owner = this.MainWindow;
            gameFilesWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            gameFilesWindow.ShowDialog();
            var gameFilesWindowResult = gameFilesWindow.result;

            switch (gameFilesWindowResult)
            {
            case GameFilesWindow.GameFilesWindowResult.exit:
                this.Shutdown();
                break;

            case GameFilesWindow.GameFilesWindowResult.useSelectedPath:
                loadGameContentAsync(gameFilesWindow.selectedPath !);
                break;

            case GameFilesWindow.GameFilesWindowResult.noContent:
                showMainWindow();
                break;
            }
        }
示例#4
0
        private void aboutMenuItem_Click(object sender, RoutedEventArgs e)
        {
            EventLogger.logEvent("aboutMenuItem_Click");
            var aboutWindow = new AboutWindow();

            aboutWindow.Owner = this;
            aboutWindow.ShowDialog();
        }
示例#5
0
 private void showError(string message)
 {
     EventLogger.logEvent("showError", new Dictionary <string, object>()
     {
         { "message", message }
     });
     MessageBox.Show(message, R.ERROR);
     closeBusyIndicator();
 }
        private void addNewEquippedItemButton_Click(EquipmentSlotEnum equipmentSlot)
        {
            EventLogger.logEvent("addNewEquippedItemButton_Click", new Dictionary <string, object>()
            {
                { "equipmentSlot", equipmentSlot.ToString() }
            });
            var item = createDefaultItemForEquipmentSlot(equipmentSlot);

            model?.addEquippedItem(item);
            model?.selectItem(item);
        }
示例#7
0
 private void goldTextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (_model?.profile.value == null || !goldTextBox.IsEnabled)
     {
         return;
     }
     EventLogger.logEvent("goldTextBox_TextChanged");
     if (uint.TryParse(goldTextBox.Text, out uint gold))
     {
         _model !.gold.setValue = gold;
     }
 }
示例#8
0
 private void emeraldsTextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (_model?.profile.value == null || !emeraldsTextBox.IsEnabled)
     {
         return;
     }
     EventLogger.logEvent("emeraldsTextBox_TextChanged");
     if (uint.TryParse(emeraldsTextBox.Text, out uint emeralds))
     {
         _model !.emeralds.setValue = emeralds;
     }
 }
示例#9
0
 private void upgradedButton_Click(object sender, RoutedEventArgs e)
 {
     if (_item == null)
     {
         return;
     }
     _item.Upgraded = !_item.Upgraded;
     EventLogger.logEvent("upgradedButton_Click", new Dictionary <string, object>()
     {
         { "upgraded", _item.Upgraded.ToString() }
     });
     this.saveChanges?.Execute(_item);
 }
示例#10
0
 private void giftedButton_Click(object sender, RoutedEventArgs e)
 {
     if (_item == null)
     {
         return;
     }
     _item.Gifted = (_item.Gifted == null || _item.Gifted == false) ? true : false;
     EventLogger.logEvent("giftedButton_Click", new Dictionary <string, object>()
     {
         { "gifted", _item.Gifted.ToString() }
     });
     this.saveChanges?.Execute(_item);
 }
示例#11
0
        private void saveAsCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            EventLogger.logEvent("saveAsCommandBinding_Executed");
            var saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter           = constructOpenFileDialogFilterString(ProfileViewModel.supportedFileTypesDict);
            saveFileDialog.FilterIndex      = 0;
            saveFileDialog.InitialDirectory = Path.GetDirectoryName(_model !.filePath); //Constants.FILE_DIALOG_INITIAL_DIRECTORY;
            if (saveFileDialog.ShowDialog() == true)
            {
                handleFileSaveAsync(saveFileDialog.FileName);
            }
        }
示例#12
0
 private void listBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (_isProcessing)
     {
         return;
     }
     EventLogger.logEvent("listBox_SelectionChanged", new Dictionary <string, object>()
     {
         { "item", selectedItem ?? "null" }
     });
     _listBox.SelectionChanged -= listBox_SelectionChanged;
     onSelection?.Invoke(selectedItem);
     this.Close();
 }
示例#13
0
 private void inventoryItemButton_Click(object sender, RoutedEventArgs e)
 {
     if (_item == null)
     {
         return;
     }
     if (!AppModel.gameContentLoaded)
     {
         return;
     }
     EventLogger.logEvent("inventoryItemButton_Click", new Dictionary <string, object>()
     {
         { "item", _item !.Type }
     });
        private void addNewItemButton_Click(ItemFilterEnum?currentFilter)
        {
            if (currentFilter == null || currentFilter == ItemFilterEnum.Enchanted || currentFilter == ItemFilterEnum.All)
            {
                return;
            }
            EventLogger.logEvent("addNewItemButton_Click", new Dictionary <string, object>()
            {
                { "currentFilter", currentFilter.ToString() }
            });
            var item = createDefaultItemForFilter(currentFilter !.Value);

            model?.addItemToInventory(item);
            model?.selectItem(item);
        }
 private void levelTextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (_model?.profile.value == null || !levelTextBox.IsEnabled)
     {
         return;
     }
     if (int.TryParse(levelTextBox.Text, out int level))
     {
         EventLogger.logEvent("levelTextBox_TextChanged", new Dictionary <string, object>()
         {
             { "level", level }
         });
         _model !.level.setValue = level;
     }
 }
示例#16
0
        private void rarityComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (_item == null || !rarityComboBox.IsEnabled)
            {
                return;
            }
            Rarity rarity = rarityForIndex(rarityComboBox.SelectedIndex);

            EventLogger.logEvent("rarityComboBox_SelectionChanged", new Dictionary <string, object>()
            {
                { "rarity", rarity.ToString() }
            });
            _item.Rarity = rarity;
            this.saveChanges?.Execute(_item);
        }
示例#17
0
        private void pathBrowseButton_Click(object sender, RoutedEventArgs e)
        {
            EventLogger.logEvent("pathBrowseButton_Click");
            var dialog = new CommonOpenFileDialog();

            dialog.IsFolderPicker   = true;
            dialog.EnsurePathExists = true;
            dialog.ShowHiddenItems  = true;
            var appDataFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            dialog.InitialDirectory = appDataFolderPath;
            if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
            {
                selectedPath = dialog.FileName;
            }
        }
 private void downButton_Click(object sender, RoutedEventArgs e)
 {
     if (_model?.profile.value == null || !levelTextBox.IsEnabled)
     {
         return;
     }
     if (int.TryParse(levelTextBox.Text, out int level) && level > Constants.MINIMUM_CHARACTER_LEVEL)
     {
         int newLevel = level - 1;
         EventLogger.logEvent("levelTextBox_downButton_Click", new Dictionary <string, object>()
         {
             { "newLevel", newLevel }
         });
         _model !.level.setValue = newLevel;
     }
 }
 private void upButton_Click(object sender, RoutedEventArgs e)
 {
     if (enchantment == null)
     {
         return;
     }
     if (int.TryParse(netheriteEnchantmentTextBox.Text, out int level) && level < Constants.MAXIMUM_ENCHANTMENT_TIER)
     {
         int newLevel = level + 1;
         EventLogger.logEvent("netheriteEnchantmentStepper_UpButtonClick", new Dictionary <string, object>()
         {
             { "newLevel", newLevel }
         });
         netheriteEnchantmentTextBox.Text = newLevel.ToString();
     }
 }
示例#20
0
        private void plusArmorPropertyButton_Click(object sender)
        {
            if (_item == null || !_item.isArmor())
            {
                return;
            }
            EventLogger.logEvent("plusArmorPropertyButton_Click");
            var armorProperties = _item.Armorproperties?.ToList() ?? new List <Armorproperty>();

            armorProperties.Add(new Armorproperty()
            {
                Id = Constants.DEFAULT_ARMOR_PROPERTY_ID, Rarity = Rarity.Common
            });
            _item.Armorproperties = armorProperties.ToArray();
            updateArmorPropertiesUI();
        }
示例#21
0
        private void okButton_Click(object sender, RoutedEventArgs e)
        {
            bool isValidPath = isValidSelectedPath();

            EventLogger.logEvent("okButton_Click", new Dictionary <string, object> {
                { "isValidPath", isValidPath }
            });
            if (isValidPath)
            {
                result = GameFilesWindowResult.useSelectedPath;
                this.Close();
                return;
            }

            MessageBox.Show(R.NO_GAME_FILES_FOUND_ERROR_MESSAGE, R.ERROR);
        }
 private void downButton_Click(object sender, RoutedEventArgs e)
 {
     if (_enchantment == null)
     {
         return;
     }
     if (int.TryParse(tierTextBox.Text, out int level) && level > Constants.MINIMUM_ENCHANTMENT_TIER)
     {
         int newLevel = level - 1;
         EventLogger.logEvent("tierTextBox_downButton_Click", new Dictionary <string, object>()
         {
             { "newLevel", newLevel }
         });
         tierTextBox.Text = newLevel.ToString();
     }
 }
示例#23
0
        private void showMainWindow()
        {
            EventLogger.logEvent("showMainWindow", new Dictionary <string, object>()
            {
                { "gameContentLoaded", AppModel.gameContentLoaded.ToString() }
            });
            var mainWindow = WindowFactory.createMainWindow();

            mainWindow.onRelaunch = onRelaunch;
            this.MainWindow       = mainWindow;

            _splashWindow?.Close();
            closeBusyIndicator();

            this.MainWindow.Show();
        }
示例#24
0
 private void downButton_Click(object sender, RoutedEventArgs e)
 {
     if (_item == null || !powerTextBox.IsEnabled)
     {
         return;
     }
     if (int.TryParse(powerTextBox.Text, out int level) && level > Constants.MINIMUM_ITEM_LEVEL)
     {
         int newLevel = level - 1;
         EventLogger.logEvent("powerTextBox_downButton_Click", new Dictionary <string, object>()
         {
             { "newLevel", newLevel }
         });
         powerTextBox.Text = newLevel.ToString();
     }
 }
        private void enchantmentImageButton_Click(object sender, RoutedEventArgs e)
        {
            if (!AppModel.gameContentLoaded)
            {
                return;
            }
            EventLogger.logEvent("enchantmentImageButton_Click", new Dictionary <string, object>()
            {
                { "enchantment", _enchantment?.Id ?? "null" }
            });
            var selectionWindow = WindowFactory.createSelectionWindow();

            selectionWindow.loadEnchantments(_enchantment?.Id);
            selectionWindow.onSelection = selectedEnchantmentId;
            selectionWindow.Show();
        }
 private void tierTextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (_enchantment == null)
     {
         return;
     }
     if (int.TryParse(tierTextBox.Text, out int level) && _enchantment.Level != level)
     {
         EventLogger.logEvent("tierTextBox_TextChanged", new Dictionary <string, object>()
         {
             { "level", level }
         });
         _enchantment.Level = level;
         this.saveChanges?.Execute(_enchantment);
         updateTierUI();
     }
 }
示例#27
0
        private void window_File_Drop(object sender, DragEventArgs e)
        {
            EventLogger.logEvent("window_File_Drop");
            if (e.Data.GetDataPresent(DataFormats.FileDrop))
            {
                // Note that you can have more than one file.
                string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

                // Assuming you have one file that you care about, pass it off to whatever
                // handling code you have defined.
                handleFileOpenAsync(files[0]);
            }
            else
            {
                showError(R.FILE_DROP_ERROR_MESSAGE);
            }
        }
        private void enchantmentImageButton_Click(object sender, RoutedEventArgs e)
        {
            if (!ImageUriHelper.gameContentLoaded)
            {
                return;
            }
            EventLogger.logEvent("enchantmentImageButton_Click", new Dictionary <string, object>()
            {
                { "enchantment", _enchantment?.Id ?? "null" }
            });
            var selectionWindow = new SelectionWindow();

            selectionWindow.Owner = Application.Current.MainWindow;
            selectionWindow.loadEnchantments(_enchantment?.Id);
            selectionWindow.onSelection = selectedEnchantmentId;
            selectionWindow.Show();
        }
示例#29
0
        private void showMainWindow()
        {
            EventLogger.logEvent("showMainWindow", new Dictionary <string, object>()
            {
                { "canUseGameContent", (!string.IsNullOrWhiteSpace(Constants.PAKS_FOLDER_PATH)).ToString() }
            });
            var mainWindow = new MainWindow();

            mainWindow.Width      = 1200;
            mainWindow.Height     = 675;
            mainWindow.onRelaunch = onRelaunch;
            this.MainWindow       = mainWindow;

            _splashWindow?.Close();
            closeBusyIndicator();

            this.MainWindow.Show();
        }
示例#30
0
        private void load()
        {
            //check default install locations
            string?paksFolderPath = ImageUriHelper.usableGameContentIfExists();

            if (_askForGameContentLocation || string.IsNullOrWhiteSpace(paksFolderPath))
            {
                //show dialog asking for install location
                EventLogger.logEvent("showGameFilesWindow");
                var gameFilesWindow = new GameFilesWindow(allowNoContent: true);
                gameFilesWindow.Owner = this.MainWindow;
                gameFilesWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                gameFilesWindow.ShowDialog();
                var gameFilesWindowResult = gameFilesWindow.result;
                switch (gameFilesWindowResult)
                {
                case GameFilesWindow.GameFilesWindowResult.exit:
                    this.Shutdown();
                    break;

                case GameFilesWindow.GameFilesWindowResult.useSelectedPath:
                    loadGameContentAsync(gameFilesWindow.selectedPath !);
                    break;

                case GameFilesWindow.GameFilesWindowResult.noContent:
                    showMainWindow();
                    break;
                }
            }
            else
            {
                try
                {
                    loadGameContentAsync(paksFolderPath !);
                }
                catch (Exception e)
                {
                    MessageBox.Show($"{e.Message}\n{e.StackTrace}", R.ERROR);
                    this.Shutdown();
                    return;
                }
            }
        }