Exemplo n.º 1
0
        /// <summary>
        /// Редактировать выбранный блок данных
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void editDataBlockToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddDataBlock addDataBlock = new AddDataBlock();
            int          uid          = 0;

            if (dataBlocks.CurrentRow != null)
            {
                uid = int.Parse(dataBlocks.CurrentRow.Cells[0].Value.ToString() ?? "0");
            }

            DataBlockUnit dataBlock = _configuration.FindDataBlock(uid);

            addDataBlock.DataBlock = dataBlock;


            addDataBlock.EditDataBlock();
            if (addDataBlock.Result == DialogResult.OK)
            {
                DataBlockUnit unit = addDataBlock.DataBlock;
                _configuration.ReplaceDataBlockUnit(unit);

                UpdateThreadsList();
                _statusBarMessage = $"Добавлена новая нить [{unit.Name}]";
                statusBar1.Text   = _statusBarMessage;
                _modified         = true;
            }

            UpdateDataBlockList();
            addDataBlock.Dispose();
        }
Exemplo n.º 2
0
        public void OnBtnAddDataBlockClick()
        {
            if (SelectedSheetTab != null && SelectedTargetAssociation != null)
            {
                AssociationMember targetMember = SelectedTargetAssociation.Members.FirstOrDefault(m => !m.ClassName.Equals(SelectedBaseClass.Name));
                ModelClass        targetClass  = ModelClasses.FirstOrDefault(m => m.Name.Equals(targetMember.ClassName));
                AddDataBlock      addDataBlock = new AddDataBlock(new AddDataBlockViewModel(SelectedTargetAssociation, targetClass));
                addDataBlock.ShowDialog();

                if (addDataBlock.DialogResult.Value)
                {
                    SelectedSheetTab.SheetBlocks.Add(addDataBlock.ViewModel.SheetBlock);
                    _thisAddIn.AddDataBlock(SelectedSheetTab, addDataBlock.ViewModel.SheetBlock);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Добавить новый блок данных
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addDataBlockToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddDataBlock addDataBlock = new AddDataBlock();

            addDataBlock.ShowDialog();
            if (addDataBlock.Result == DialogResult.OK)
            {
                DataBlockUnit dataBlock = addDataBlock.DataBlock;
                _configuration.ListDataBlockUnits.Add(dataBlock);

                UpdateThreadsList();
                _statusBarMessage = $"Добавлен новый блок данных [{dataBlock.Name}]";
                statusBar1.Text   = _statusBarMessage;
                _modified         = true;
            }

            UpdateDataBlockList();
            addDataBlock.Dispose();
        }