コード例 #1
0
        private void ConditionControlDeleted(object sender, EventArgs e)
        {
            JobCardTaskControl control = (JobCardTaskControl)sender;
            JobCardTask        cond    = control.JobCardTask;

            if (cond.ItemId > 0 && MessageBox.Show("Do you really want to delete Job Card Task?", "Deleting confirmation", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                //если информация о состоянии сохранена в БД
                //и получен положительный ответ на ее удаление
                try
                {
                    GlobalObjects.CasEnvironment.NewKeeper.Delete(cond);
                }
                catch (Exception ex)
                {
                    Program.Provider.Logger.Log("Error while removing data", ex);
                }

                flowLayoutPanelMain.Controls.Remove(control);
                control.Deleted -= ConditionControlDeleted;
                control.Dispose();
            }
            else if (cond.ItemId <= 0)
            {
                flowLayoutPanelMain.Controls.Remove(control);
                control.Deleted -= ConditionControlDeleted;
                control.Dispose();
            }
        }
コード例 #2
0
        private void LinkLabelAddNewLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            JobCardTaskControl performance =
                new JobCardTaskControl(new JobCardTask {
                ParentTask = JobCardTask, JobCard = JobCardTask.JobCard
            });

            performance.Deleted += ConditionControlDeleted;
            //if (flowLayoutPanelMain.Controls.Count > 1) performance.ShowHeaders = false;
            flowLayoutPanelMain.Controls.Add(performance);
            performance.Focus();
        }
コード例 #3
0
        /*
         * Реализация
         */

        #region private void BuildControls()
        /// <summary>
        /// Строит нужные контролы
        /// </summary>
        private void BuildControls()
        {
            // Освобождаем старые контролы
            flowLayoutPanelMain.Controls.Clear();

            if (JobCard != null && JobCard.JobCardTasks != null)
            {
                for (int i = 0; i < JobCard.JobCardTasks.Count; i++)
                {
                    // Добавляем контрол для ввода данных по маслу
                    JobCardTaskControl c = new JobCardTaskControl(JobCard.JobCardTasks[i])
                    {
                        Dock = DockStyle.Top
                    };
                    c.Deleted += ConditionControlDeleted;
                    if (JobCard.JobCardTasks.Count <= 1)
                    {
                        c.EnableToDelete = false;
                    }
                    flowLayoutPanelMain.Controls.Add(c);
                }
            }
        }
コード例 #4
0
        /*
         * Реализация
         */

        #region private void BuildControls()
        /// <summary>
        /// Строит нужные контролы
        /// </summary>
        private void BuildControls()
        {
            textBoxJobTaskNumber.Text = JobCardTask.Number;

            try
            {
                richTextBoxDescription.Rtf = JobCardTask.Description;

                //Size size = TextRenderer.MeasureText(richTextBoxDescription.Text, richTextBoxDescription.Font);

                ////Graphics graphics = CreateGraphics();
                ////SizeF ef = graphics.MeasureString(richTextBoxDescription.Text, richTextBoxDescription.Font);
                ////graphics.Dispose();

                //richTextBoxDescription.Height = (int)size.Height;
            }
            catch (Exception)
            {
                richTextBoxDescription.Text = JobCardTask.Description;
            }

            // Освобождаем старые контролы
            flowLayoutPanelMain.Controls.Clear();

            if (JobCardTask != null && JobCardTask.Tasks != null)
            {
                for (int i = 0; i < JobCardTask.Tasks.Count; i++)
                {
                    // Добавляем контрол для ввода данных по маслу
                    JobCardTaskControl c = new JobCardTaskControl(JobCardTask.Tasks[i]);
                    c.Deleted += ConditionControlDeleted;
                    //if (i > 0)
                    //    c.ShowHeaders = false;
                    flowLayoutPanelMain.Controls.Add(c);
                }
            }
        }
コード例 #5
0
        private void LinkLabelAddNewLinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            JobCardTaskControl performance =
                new JobCardTaskControl(new JobCardTask {
                JobCard = JobCard
            });

            performance.Deleted += ConditionControlDeleted;

            List <JobCardTaskControl> fcs = flowLayoutPanelMain.Controls.OfType <JobCardTaskControl>().ToList();

            if (fcs.Count > 1)
            {
                foreach (JobCardTaskControl fc in fcs)
                {
                    fc.EnableToDelete = true;
                }
            }

            performance.Dock = DockStyle.Top;

            flowLayoutPanelMain.Controls.Add(performance);
            performance.Focus();
        }