Esempio n. 1
0
        private void asyncLoad()
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            string threadName = Thread.CurrentThread.Name;

            if (threadName == "Familiar")
            {
                List <Familiar> itemsSource = FamiliarDataSourceProvider.LoadCollectionData(chosenPath);
                this.Dispatcher.Invoke((Action)(() =>
                {//this refer to form in WPF application
                    FamiliarGrid.ItemsSource = itemsSource;
                    stopwatch.Stop();
                    TimeSpan timespan = stopwatch.Elapsed;
                    LoadingTimeBox.Text = $"Loading Time: {timespan.Minutes:D2}:{timespan.Seconds:D2}:{timespan.Milliseconds:D2}";
                    SearchTextBox.IsEnabled = true;
                    LoadButton.IsEnabled = true;
                }));
            }
            else
            {
                List <Equip> itemsSource = FamiliarDataSourceProvider.LoadEquipData(chosenPath, threadName);
                this.Dispatcher.Invoke((Action)(() =>
                {//this refer to form in WPF application
                    GetActiveGrid().ItemsSource = itemsSource;
                    stopwatch.Stop();
                    TimeSpan timespan = stopwatch.Elapsed;
                    LoadingTimeBox.Text = $"Loading Time: {timespan.Minutes:D2}:{timespan.Seconds:D2}:{timespan.Milliseconds:D2}";
                    SearchTextBox.IsEnabled = true;
                    LoadButton.IsEnabled = true;
                }));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Loads all DataGrid's info.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoadButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(PathTextBox.Text) || !FamiliarDataSourceProvider.PathIsValid(PathTextBox.Text))
                {
                    MessageBox.Show("The .wz files were not found.", "Invalid Path", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                SearchTextBox.IsEnabled = false;
                LoadButton.IsEnabled    = false;
                Thread loadDataThread = new Thread(asyncLoad);

                /*
                 * If the executable is terminated, there's no point in keeping the loading
                 * process alive, so the thread is a background thread. If it was something
                 * that made sense running even after executable termination, it would be
                 * well suited for a foreground thread.
                 */
                loadDataThread.IsBackground = true;
                TabItem activeTab = (TabItem)DataPicker.SelectedItem;
                loadDataThread.Name = activeTab.Name.Substring(0, activeTab.Name.Length - 3);
                string presentedTabName = ((TextBlock)((StackPanel)activeTab.Header).Children[1]).Text;
                LoadingTimeBox.Text = $"Loading {presentedTabName}...";
                loadDataThread.Start();
            }
            catch (IOException)
            {
                MessageBox.Show("The .wz files are being used by another application.", "Access Conflict", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 3
0
        private void EquipGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
        {
            var selectedCells = EquipGrid.SelectedCells;

            if (selectedCells.Count == 0)
            {
                ResetWeaponInfoPage();
                return;
            }
            Equip equip = selectedCells[0].Item as Equip;

            foreach (var selectedCell in selectedCells)
            {
                Equip selectedEquip = selectedCell.Item as Equip;
                if (selectedEquip.EquipID != equip.EquipID)
                {
                    ResetWeaponInfoPage();
                    return;
                }
            }
            EquipImage.Source = FamiliarDataSourceProvider.CreateBitmapSourceFromGdiBitmap(equip.EquipImage);
            EquipLevel.Text   = $"Lv. {equip.EquipLevel} ";
            EquipName.Text    = equip.EquipName;

            EquipClassification.Text = $"\nClassification: {equip.EquipClassification}";
            EquipType.Text           = $"\nType: {equip.EquipType}";

            RequiredStats.Text = $"\nRequired Stats: {equip.RequiredStats}";
            RequiredJob.Text   = $"Required Job: {equip.RequiredJob}";

            EquipStats.Text = $"\nStats:\n{equip.EquipStats}";

            TotalUpgradeCount.Text = $"\nAvailable Enhancements: {equip.TotalUpgradeCount}";
        }
Esempio n. 4
0
        private void FamiliarGrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
        {
            var selectedCells = FamiliarGrid.SelectedCells;

            if (selectedCells.Count == 0)
            {
                ResetInfoPage();
                return;
            }
            Familiar familiar = selectedCells[0].Item as Familiar;

            foreach (var selectedCell in selectedCells)
            {
                Familiar selectedFamiliar = selectedCell.Item as Familiar;
                if (selectedFamiliar.FamiliarID != familiar.FamiliarID)
                {
                    ResetInfoPage();
                    return;
                }
            }
            MobImage.Source = FamiliarDataSourceProvider.CreateBitmapSourceFromGdiBitmap(familiar.MobImage);
            MobLevel.Text   = $"Lv. {familiar.Level} ";
            MobName.Text    = familiar.MobName;

            MobRarity.Text = $"\nRarity: {familiar.Rarity}";

            MobATT.Text   = $"\nATT: {familiar.ATT}";
            MobRange.Text = $"Range: {familiar.Range}";

            MobSkillName.Text        = $"\nSkill Name: {familiar.SkillName}";
            MobSkillCategory.Text    = $"Skill Category: {familiar.SkillCategory}";
            MobSkillDescription.Text = $"Skill Description: {familiar.SkillDescription}";

            MobPassiveEffect.Text       = $"\nPassive Effect: {familiar.PassiveEffect}";
            MobPassiveEffectBonus.Text  = $"Passive Effect Bonus: {familiar.PassiveEffectBonus}";
            MobPassiveEffectTarget.Text = $"Passive Effect Target: {familiar.PassiveEffectTarget}";

            MobID.Text              = $"\nMob ID: {familiar.MobID}";
            MobCardID.Text          = $"Card ID: {familiar.CardID}";
            MobPassiveEffectID.Text = $"Passive Effect ID: {familiar.PassiveEffectID}";
        }
Esempio n. 5
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            Bitmap bitmap = (Bitmap)value;

            return(FamiliarDataSourceProvider.CreateBitmapSourceFromGdiBitmap(bitmap));
        }