예제 #1
0
        private async void pictureBoxGreen_Click(object sender, EventArgs e)
        {
            if (dgvMol.SelectedRows.Count == 1 && dgvMol.SelectedRows[0] != null)
            {
                CommonMol selectedItem = (CommonMol)dgvMol.SelectedRows[0].DataBoundItem;
                if (DataHolder.PrimeryMol == null)
                {
                    CommonMol tempMol = new CommonMol();
                    tempMol.MolId = Guid.NewGuid();

                    CommonMol newPrimeryMol = await SAOwner.SetPrimery(tempMol, selectedItem);

                    CommonMol molToRemove = NonPrimeryMols.FirstOrDefault(p => p.MolId == newPrimeryMol.MolId);
                    NonPrimeryMols.Remove(molToRemove);
                    List <CommonMol> temp = new List <CommonMol>();
                    temp.Add(newPrimeryMol);
                    dgvPrimaryMol.DataSource = null;
                    dgvPrimaryMol.DataSource = temp;

                    if (PrimeryMol.OwnerId != Guid.Empty)
                    {
                        PrimeryMol.IsPrimery = false;
                        NonPrimeryMols.Add(PrimeryMol);
                    }

                    dgvMol.DataSource     = null;
                    dgvMol.DataSource     = NonPrimeryMols;
                    PrimeryMol            = newPrimeryMol;
                    DataHolder.PrimeryMol = newPrimeryMol;
                }
            }
        }
예제 #2
0
        private async void pictureBoxRed_Click(object sender, EventArgs e)
        {
            if (dgvPrimaryMol.SelectedRows.Count == 1 && dgvPrimaryMol.SelectedRows[0] != null)
            {
                CommonMol selectedItem = (CommonMol)dgvPrimaryMol.SelectedRows[0].DataBoundItem;

                CommonMol tempMol = new CommonMol();
                tempMol.MolId = Guid.NewGuid();

                CommonMol newNonPrimeryMol = await SAOwner.SetPrimery(selectedItem, tempMol);

                PrimeryMol             = new CommonMol();
                DataHolder.PrimeryMol  = null;
                selectedItem.IsPrimery = false;
                NonPrimeryMols.Add(selectedItem);
                dgvPrimaryMol.DataSource = null;
                dgvMol.DataSource        = null;
                dgvMol.DataSource        = NonPrimeryMols;
            }
        }