Пример #1
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            BindingService.ClearData(this);
            pictureBox1.Image = null;
            _TemplateID.Text  = _templateId;

            var selected = GetSelected();

            if (selected == null)
            {
                _selected = null;
                return;
            }

            groupBox1.Text     = selected.Value;
            _Slot.SelectedItem = _Slot.Items.Cast <ComboboxService.SelectItemModel>().First(x => x.Id == selected.SlotId);

            if (selected.Item == null)
            {
                _selected = null;
                return;
            }

            _selected = selected.Item;
            BindingService.BindData(selected.Item, this);
            _imageService.LoadItem(selected.Item.Model, pictureBox1.Width, pictureBox1.Height)
            .ContinueWith(x => _imageService.AttachImage(pictureBox1, x));
        }
Пример #2
0
        private async Task LoadTemplate(string templateId)
        {
            if (string.IsNullOrWhiteSpace(templateId))
            {
                return;
            }

            Clear();
            _model = await _lootTemplateService.Get(templateId);

            if (_model == null)
            {
                MessageBox.Show($@"Object with ObjectId: {templateId} not found", @"Object not found");
                return;
            }

            BindingService.BindData(_model.MobXLootTemplate, this);
            _MobXLootTemplate_ID.Text = _model.MobXLootTemplate.ObjectId;

            var mob = _mobs.FirstOrDefault(x => _model.MobXLootTemplate.MobName == x.Name);

            if (mob != null)
            {
                await _modelImageService.LoadMob(mob.Model, pictureBox2.Width, pictureBox2.Height)
                .ContinueWith(x => pictureBox2.Image = x.Result);
            }

            var bindingList = new BindingList <LootTemplate>(_model.LootTemplates);
            var source      = new BindingSource(bindingList, null);

            dataGridView1.DataSource = source;
            SetGridColumns();
        }
Пример #3
0
        private async Task LoadSpell(string spellId)
        {
            if (string.IsNullOrWhiteSpace(spellId))
            {
                return;
            }

            _spell = await _spellService.Get(spellId);

            if (_spell == null)
            {
                MessageBox.Show($@"Object with ObjectId: {spellId} not found", @"Object not found");
                return;
            }

            BindingService.BindData(_spell, this);
        }
Пример #4
0
        private void LoadItem(string id)
        {
            if (string.IsNullOrWhiteSpace(id))
            {
                return;
            }

            _template = _npcTemplateService.Get(id);

            if (_template == null)
            {
                MessageBox.Show($@"Object with ObjectId: {id} not found", @"Object not found");
                return;
            }

            BindingService.BindData(_template, this);
            BindFlags();
            BindWeaponSlots();
        }
Пример #5
0
        private void LoadMob(string mobId)
        {
            if (string.IsNullOrWhiteSpace(mobId))
            {
                return;
            }

            _mob = _mobService.GetMob(mobId);

            if (_mob == null)
            {
                MessageBox.Show($@"Object with ObjectId: {mobId} not found", @"Object not found");
                return;
            }

            _modelImageService.LoadMob(_mob.Model, pictureBox1.Width, pictureBox1.Height)
            .ContinueWith(x => pictureBox1.Image = x.Result);

            BindingService.BindData(_mob, this);
            BindFlags();
            BindWeaponSlots();
        }
Пример #6
0
        private void LoadItem(string itemId)
        {
            Clear();

            if (string.IsNullOrWhiteSpace(itemId))
            {
                return;
            }

            _item = _itemService.GetItem(itemId);


            if (_item == null)
            {
                MessageBox.Show($@"Object with ObjectId: {itemId} not found", @"Object not found");
                return;
            }

            _modelImageService.LoadItem(_item.Model, pictureBox1.Width, pictureBox1.Height)
            .ContinueWith(x => pictureBox1.Image = x.Result);

            BindingService.BindData(_item, this);
        }
Пример #7
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            _Chance.Text         = null;
            _Count.Text          = null;
            _ItemTemplateID.Text = null;

            var selected = GetSelected();

            if (selected == null)
            {
                return;
            }

            BindingService.BindData(selected, this);

            var item = _items.FirstOrDefault(x => x.Id_nb == selected.ItemTemplateID);

            if (item?.Model != null)
            {
                _modelImageService.LoadItem(item.Model, pictureBox1.Width, pictureBox1.Height)
                .ContinueWith(x => pictureBox1.Image = x.Result);
            }
        }
Пример #8
0
        private async Task LoadQuest(string questId)
        {
            stepNumber.Text = @"1";
            CleanDictionaries();
            Clear();

            if (string.IsNullOrWhiteSpace(questId))
            {
                return;
            }

            _quest = await _questService.Get(questId);

            if (_quest == null)
            {
                MessageBox.Show($@"Object with ObjectId: {questId} not found", @"Object not found");
                return;
            }

            BindingService.BindData(_quest, this);
            // need to grab the serialized data and turn it back to usable form
            DeserializeData(_quest);
        }