Пример #1
0
        /// <summary>
        /// Occurs on mouse double click inside a text control.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Control_DoubleClick(object sender, EventArgs e)
        {
            Control control = null;

            DatafileControl dfControl = sender as DatafileControl;

            if (dfControl != null)
            {
                control = dfControl.rtbDatafileMessage;
            }

            RichTextBox richTextBox = sender as RichTextBox;

            if (richTextBox != null)
            {
                control = richTextBox;
            }

            TextBox textBox = sender as TextBox;

            if (textBox != null)
            {
                control = textBox;
            }

            if (control == null)
            {
                return;
            }

            m_activeTextBox = control;
            m_text          = control.Text;
            control.Text    = String.Empty;
        }
Пример #2
0
        /// <summary>
        /// Updates the info in the data files section.
        /// </summary>
        /// <param name="control"></param>
        /// <param name="datafile"></param>
        private static void UpdateDatafileInfo(DatafileControl control, Datafile datafile)
        {
            // Data file info
            FileInfo fileInfo = new FileInfo(Path.Combine(Helper.GetDataFilesDirectory, datafile.Filename));

            // Assign info
            control.gbDatafile.Text    = datafile.Filename;
            control.lblMD5Sum.Text     = datafile.MD5Sum;
            control.dtpDatafiles.Value = fileInfo.LastWriteTime;
        }
Пример #3
0
        /// <summary>
        /// Adds a control for each data file.
        /// </summary>
        private void CustomLayout()
        {
            int       startLocation = 70;
            const int Pad           = 5;

            gbDatafiles.Controls.Remove(datafileControl);
            Height -= datafileControl.Height;

            SuspendLayout();
            try
            {
                foreach (Datafile datafile in s_datafiles.OrderBy(x => x.Filename))
                {
                    // Add a new datafile control
                    DatafileControl newDatafileControl = new DatafileControl();
                    gbDatafiles.Controls.Add(newDatafileControl);

                    // Control info
                    UpdateDatafileInfo(newDatafileControl, datafile);

                    // Set Properties
                    newDatafileControl.Location = new Point(9, startLocation);
                    newDatafileControl.Font     = new Font(Font, FontStyle.Regular);
                    newDatafileControl.Anchor  |= AnchorStyles.Right;
                    newDatafileControl.Size     = new Size(gbDatafiles.Width - Pad * 3, newDatafileControl.Height);

                    // Calculate window height and next control point
                    Height        += datafileControl.Height + Pad;
                    startLocation += datafileControl.Height + Pad;

                    // Subscribe Events
                    newDatafileControl.rtbDatafileMessage.Enter       += Control_Enter;
                    newDatafileControl.rtbDatafileMessage.Leave       += Control_Leave;
                    newDatafileControl.rtbDatafileMessage.DoubleClick += Control_DoubleClick;
                }
            }
            finally
            {
                // Update the message of each data file control
                UpdateDatafilesMessage();

                ResumeLayout(false);
            }

            CenterToScreen();
        }
Пример #4
0
        /// <summary>
        /// Stores the initial texts in the text control for use in the create button enabling.
        /// </summary>
        private void StoreInitMessage()
        {
            // Store the texts from the release section excluding the update url
            foreach (RichTextBox control in gbRelease.Controls.OfType <RichTextBox>().Where(x => x != null && x != rtbReleaseUrl))
            {
                s_listOfInitMessages.Add(control, control.Text);
            }

            // Store the text from the datafiles section excluding the update url
            foreach (Control control in gbDatafiles.Controls.Cast <Control>().Where(
                         x => x != rtbDatafileUrl))
            {
                if (control is TextBox || control is RichTextBox)
                {
                    s_listOfInitMessages.Add(control, control.Text);
                }

                DatafileControl dfControl = control as DatafileControl;
                if (dfControl != null)
                {
                    s_listOfInitMessages.Add(control, dfControl.rtbDatafileMessage.Text);
                }
            }
        }
Пример #5
0
        /// <summary>
        /// Updates the info in the data files section.
        /// </summary>
        /// <param name="control"></param>
        /// <param name="datafile"></param>
        private static void UpdateDatafileInfo(DatafileControl control, Datafile datafile)
        {
            // Data file info
            FileInfo fileInfo = new FileInfo(Path.Combine(Helper.GetDataFilesDirectory, datafile.Filename));

            // Assign info
            control.gbDatafile.Text = datafile.Filename;
            control.lblMD5Sum.Text = datafile.MD5Sum;
            control.dtpDatafiles.Value = fileInfo.LastWriteTime;
        }
Пример #6
0
        /// <summary>
        /// Adds a control for each data file.
        /// </summary>
        private void CustomLayout()
        {
            int startLocation = 70;
            const int Pad = 5;

            gbDatafiles.Controls.Remove(datafileControl);
            Height -= datafileControl.Height;

            SuspendLayout();
            try
            {
                foreach (Datafile datafile in s_datafiles.OrderBy(x => x.Filename))
                {
                    // Add a new datafile control
                    DatafileControl newDatafileControl = new DatafileControl();
                    gbDatafiles.Controls.Add(newDatafileControl);

                    // Control info
                    UpdateDatafileInfo(newDatafileControl, datafile);

                    // Set Properties
                    newDatafileControl.Location = new Point(9, startLocation);
                    newDatafileControl.Font = new Font(Font, FontStyle.Regular);
                    newDatafileControl.Anchor |= AnchorStyles.Right;
                    newDatafileControl.Size = new Size(gbDatafiles.Width - Pad * 3, newDatafileControl.Height);

                    // Calculate window height and next control point
                    Height += datafileControl.Height + Pad;
                    startLocation += datafileControl.Height + Pad;

                    // Subscribe Events
                    newDatafileControl.rtbDatafileMessage.Enter += Control_Enter;
                    newDatafileControl.rtbDatafileMessage.Leave += Control_Leave;
                    newDatafileControl.rtbDatafileMessage.DoubleClick += Control_DoubleClick;
                }
            }
            finally
            {
                // Update the message of each data file control
                UpdateDatafilesMessage();

                ResumeLayout(false);
            }

            CenterToScreen();
        }