コード例 #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (_selected == null)
            {
                _selected = new NPCEquipment
                {
                    TemplateID = _templateId,
                    ObjectId   = null
                };
                _equipment.Add(_selected);
            }

            BindingService.SyncData(_selected, this);

            // template id has changed
            if (!string.IsNullOrWhiteSpace(_selected.TemplateID) && _selected.TemplateID != _templateId)
            {
                _equipment.ForEach(x =>
                {
                    x.TemplateID = _selected.TemplateID;
                    _npcEquipmentService.Save(x);
                });

                LoadItems(_selected.TemplateID);
                return;
            }

            var templateId = _npcEquipmentService.Save(_selected);

            LoadItems(templateId);
        }
コード例 #2
0
        public string[] GetCompatibleMethodsInCodeBehind(CodeMemberMethod method)
        {
            ProjectDom ctx;
            IType      fullClass = GetFullClass(out ctx);

            if (fullClass == null)
            {
                return(new string[0]);
            }

            IMethod MDMeth = BindingService.CodeDomToMDDomMethod(method);

            if (MDMeth == null)
            {
                return(null);
            }

            List <IMethod> compatMeth = new List <IMethod> (BindingService.GetCompatibleMethodsInClass(ctx, fullClass, MDMeth));

            string[] names = new string[compatMeth.Count];
            for (int i = 0; i < names.Length; i++)
            {
                names[i] = compatMeth[i].Name;
            }
            return(names);
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (_mob == null)
            {
                _mob = new Mob
                {
                    ObjectId = null
                };
            }

            try
            {
                BindingService.SyncData(_mob, this);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            SyncFlags();
            SyncWeaponSlots();
            _mobService.SaveMob(_mob);
            BindingService.ClearData(this);
        }
コード例 #4
0
        // Item Remove
        private async void button8_Click(object sender, EventArgs e)
        {
            var model = GetSelected();

            if (_model?.MobXLootTemplate == null || model == null)
            {
                return;
            }

            var confirmResult = MessageBox.Show(@"Are you sure to delete the selected object",
                                                @"Confirm Delete!!",
                                                MessageBoxButtons.YesNo);

            if (confirmResult != DialogResult.Yes)
            {
                return;
            }

            BindingService.ToggleEnabled(this);
            await _lootTemplateService.Remove(model);

            await LoadTemplate(_model.MobXLootTemplate.ObjectId);

            BindingService.ToggleEnabled(this);
        }
コード例 #5
0
        private void itemSave_Click_1(object sender, EventArgs e)
        {
            string id;

            if (_item == null)
            {
                _item = new ItemTemplate();
                id    = _item.Id_nb;
            }
            else
            {
                id = _item.Id_nb;
            }

            try
            {
                _item.AllowUpdate = true;
                BindingService.SyncData(_item, this);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            if (id != _item.Id_nb && !_itemService.UpdateId(id, _item.Id_nb, _item.ObjectId))
            {
                MessageBox.Show(@"Unfortunately Id_nb cannot be changed. Please update manually if needed.");
                return;
            }

            var itemId = _itemService.SaveItem(_item);

            LoadItem(itemId);
        }
コード例 #6
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));
        }
コード例 #7
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();
        }
コード例 #8
0
 private void Clear()
 {
     _model = null;
     BindingService.ClearData(this);
     dataGridView1.DataSource = null;
     pictureBox1.Image        = null;
     pictureBox2.Image        = null;
 }
コード例 #9
0
        public string[] GetCompatibleMethodsInCodeBehind(CodeMemberMethod method)
        {
            if (codeBehindClass == null)
            {
                return(new string[0]);
            }

            return(BindingService.GetCompatibleMethodsInClass(codeBehindClass, method));
        }
コード例 #10
0
        //TODO: make this work with inline code
        #region event binding

        public bool IdentifierExistsInCodeBehind(string trialIdentifier)
        {
            if (codeBehindClass == null)
            {
                return(false);
            }

            return(BindingService.IdentifierExistsInClass(codeBehindClass, trialIdentifier));
        }
コード例 #11
0
 public void SetUp()
 {
     productService     = new DefaultProductService();
     distributorService = new DefaultDistributorService();
     qrcodeService      = new DefaultQrCodeService();
     bindingService     = new DefaultBindingService();
     applicationContext = new ApplicationContext();
     applicationContext.ConfigureHibernateMapping();
 }
コード例 #12
0
ファイル: MonoDevelopProxy.cs プロジェクト: dodev/AspNetEdit
        public string GenerateIdentifierUniqueInCodeBehind(string trialIdentifier)
        {
            if (fullClass == null)
            {
                return(trialIdentifier);
            }

            return(BindingService.GenerateIdentifierUniqueInClass(fullClass, trialIdentifier));
        }
コード例 #13
0
 private void Clear()
 {
     BindingService.ClearData(this);
     _equipment        = new List <NPCEquipment>();
     pictureBox1.Image = null;
     _templateId       = null;
     dataGridView1.Rows.Clear();
     dataGridView1.Columns.Clear();
 }
コード例 #14
0
ファイル: ReaderForm.cs プロジェクト: Deyn32/Library
        private void StartForm()
        {
            SessionSQLService.Create();
            this.WindowState = FormWindowState.Maximized;
            List <Book> books = SessionSQLService.FindAllBooks();

            SessionSQLService.Close();
            dtBooks = BindingService.BindingReaderTable(books);
            dgvListBooks.DataSource = dtBooks;
        }
コード例 #15
0
 public ActionResult Edit(BindingViewModel viewModel, int?page)
 {
     if (ModelState.IsValid)
     {
         var binding = AutoMapper.Mapper.Map <BindingViewModel, IBinding>(viewModel);
         PopulateSelectListsToModel(viewModel, binding);
         BindingService.CreateOrUpdate(binding);
         return(RedirectToAction("Index", new { page }));
     }
     return(View(viewModel));
 }
コード例 #16
0
        public ActionResult Delete(int id, int?page)
        {
            var binding = BindingService.GetById(id);

            if (binding != null)
            {
                BindingService.Delete(binding);
            }

            return(RedirectToAction("Index", new { page }));
        }
コード例 #17
0
        public string GenerateIdentifierUniqueInCodeBehind(string trialIdentifier)
        {
            ProjectDom ctx;
            IType      fullClass = GetFullClass(out ctx);

            if (fullClass == null)
            {
                return(trialIdentifier);
            }

            return(BindingService.GenerateIdentifierUniqueInClass(ctx, fullClass, trialIdentifier));
        }
コード例 #18
0
        public bool IdentifierExistsInCodeBehind(string trialIdentifier)
        {
            ProjectDom ctx;
            IType      fullClass = GetFullClass(out ctx);

            if (fullClass == null)
            {
                return(false);
            }

            return(BindingService.IdentifierExistsInClass(ctx, fullClass, trialIdentifier));
        }
コード例 #19
0
        public ActionResult Index(int?page)
        {
            var  viewModel  = new BindingListViewModel();
            var  pageNumber = (page ?? 1) - 1;
            long totalCount;

            IEnumerable <IBinding> bindings = BindingService.GetAll(pageNumber, PageSize, out totalCount);

            viewModel.Bindings = new StaticPagedList <IBinding>(bindings, pageNumber + 1, PageSize, (int)totalCount);

            return(View(viewModel));
        }
コード例 #20
0
 public ActionResult Edit(long?id, int?page)
 {
     if (id.HasValue)
     {
         var viewModel = AutoMapper.Mapper.Map <IBinding, BindingViewModel>(BindingService.GetById(id.Value));
         viewModel.Websites               = WebsiteService.GetAll().ToList();
         viewModel.SelectableServers      = ServerService.GetAll().ToList();
         viewModel.SelectableEnvironments = EnvironmentService.GetAll().ToList();
         return(View(viewModel));
     }
     return(RedirectToAction("Create"));
 }
コード例 #21
0
        public bool ShowMethod(CodeMemberMethod method)
        {
            if (codeBehindClass == null)
            {
                return(false);
            }

            Gtk.Application.Invoke(delegate {
                BindingService.CreateAndShowMember(codeBehindClass, method);
            });

            return(true);
        }
コード例 #22
0
        //Template Save
        private async void button10_Click(object sender, EventArgs e)
        {
            var model = _model?.MobXLootTemplate ?? new MobXLootTemplate();

            BindingService.SyncData(model, this);

            BindingService.ToggleEnabled(this);
            var objectId = await _lootTemplateService.Save(model);

            await LoadTemplate(objectId);

            BindingService.ToggleEnabled(this);
        }
コード例 #23
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            if (_template == null)
            {
                return;
            }

            BindingService.SyncData(_template, this);
            SyncFlags();
            SyncWeaponSlots();
            _npcTemplateService.Save(_template);
            BindingService.ClearData(this);
        }
コード例 #24
0
        public TypeAnnotationPass(DeclarationFinder declarationFinder, VBAExpressionParser expressionParser)
        {
            _declarationFinder = declarationFinder;
            var typeBindingContext             = new TypeBindingContext(_declarationFinder);
            var procedurePointerBindingContext = new ProcedurePointerBindingContext(_declarationFinder);

            _bindingService = new BindingService(
                _declarationFinder,
                new DefaultBindingContext(_declarationFinder, typeBindingContext, procedurePointerBindingContext),
                typeBindingContext,
                procedurePointerBindingContext);
            _expressionParser = expressionParser;
        }
コード例 #25
0
ファイル: MonoDevelopProxy.cs プロジェクト: dodev/AspNetEdit
        public bool ShowMethod(CodeMemberMethod method)
        {
            if (nonDesignerClass == null)
            {
                return(false);
            }

            Gtk.Application.Invoke(delegate {
                BindingService.CreateAndShowMember(project, fullClass.GetDefinition(), nonDesignerClass, method);
            });

            return(true);
        }
コード例 #26
0
ファイル: MainView.cs プロジェクト: zxmak/ZXMAK2
        public MainView(IResolver resolver)
        {
            _resolver = resolver;
            _binding  = new BindingService();
            _binding.RegisterAdapterFactory <Control>(
                arg => new ControlBindingAdapter(arg));
            _binding.RegisterAdapterFactory <ToolStripItem>(
                arg => new ToolStripItemBindingAdapter(arg));

            SetStyle(ControlStyles.Opaque | ControlStyles.AllPaintingInWmPaint, true);
            InitializeComponent();
            Icon = ResourceImages.IconApp;

            Bind();
        }
コード例 #27
0
        private void Insertspell_Click(object sender, EventArgs e)
        {
            _spell = new DBSpell
            {
                AllowAdd = true
            };

            SyncSpell();

            _spell.ObjectId = null;
            _spell.SpellID  = _spellService.GetNextSpellId();

            _spellService.Save(_spell);
            BindingService.ClearData(this);
        }
コード例 #28
0
        private void button2_Click(object sender, System.EventArgs e)
        {
            var dialogResult = MessageBox.Show(@"You are about to create a new NPC Template record.\nAre you sure this is what you want to do?", @"Insert new NPC Template", MessageBoxButtons.YesNo);

            if (dialogResult != DialogResult.Yes)
            {
                return;
            }
            _template = new DBNpcTemplate();
            BindingService.SyncData(_template, this);
            SyncFlags();
            SyncWeaponSlots();

            _template.ObjectId = null;
            _npcTemplateService.Save(_template);
            BindingService.ClearData(this);
        }
コード例 #29
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);
        }
コード例 #30
0
        // Item Save
        private async void button9_Click(object sender, EventArgs e)
        {
            var model = GetSelected();

            if (_model?.MobXLootTemplate == null || model == null)
            {
                return;
            }

            BindingService.SyncData(model, this);

            BindingService.ToggleEnabled(this);
            await _lootTemplateService.Save(model);

            await LoadTemplate(_model.MobXLootTemplate.ObjectId);

            BindingService.ToggleEnabled(this);
        }