Esempio n. 1
0
 /// <summary>
 /// Make sure this is not the initial clause, since operation (OR) pre-pended to the current operation.
 /// </summary>
 /// <param name="fieldName"></param>
 /// <param name="value"></param>
 public void AddORClause(string fieldName, object value)
 {
     SystemMonitor.CheckThrow(ClauseCount != 0);
     _clauses.Add(new MatchClause(MatchClause.OperationEnum.OR, fieldName, value));
 }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="handlerClassType"></param>
        public AutomatedControlEventHandlerAttribute(Type handlerClassType)
        {
            SystemMonitor.CheckThrow(handlerClassType.IsSubclassOf(typeof(AutomatedControlEventHandler)), "Only shortcut handler classes can be used as attribute parameter.");

            _handlerClassTypes = new Type[] { handlerClassType };
        }
Esempio n. 3
0
 /// <summary>
 /// Initialize this channel with the source it belongs to.
 /// </summary>
 public bool Initialize(EventSource source)
 {
     SystemMonitor.CheckError(_source == null, "Source already assigned.");
     _source = source;
     return(true);
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="errorMessage"></param>
 public void OperationError(string errorMessage, TracerItem.PriorityEnum priority)
 {
     SystemMonitor.OperationError(errorMessage, priority);
 }
 /// <summary>
 /// Report an serious error. Those errors are usually a sign something in the work
 /// of the application has gone seriously wrong, and operation can not continue
 /// properly (for ex. unexpected exception, access to critical resources etc.)
 /// </summary>
 /// <param name="errorMessage"></param>
 public void Error(string errorMessage)
 {
     SystemMonitor.Error(errorMessage);
 }
 /// <summary>
 /// Report operation error; it is a lighter version of a error, and may be expected to
 /// occur during normal operation of the application (for. ex. a given non critical
 /// resource was not retrieved, operation has timed out etc.)
 /// </summary>
 /// <param name="errorMessage"></param>
 public void OperationError(string errorMessage)
 {
     SystemMonitor.OperationError(errorMessage);
 }
 /// <summary>
 /// A Warning notifies that in some part of the systems operation a recovarable error has occured.
 /// </summary>
 /// <param name="warningMessage"></param>
 public void Warning(string warningMessage)
 {
     SystemMonitor.Warning(warningMessage);
 }
Esempio n. 8
0
 /// <summary>
 /// Remove self as the trade's default tracer, inserted in the thread's data slot.
 /// </summary>
 /// <param name="thread"></param>
 public void DetachFromThread(Thread thread)
 {
     SystemMonitor.NotImplementedCritical("Operation not supported.");
 }
        /// <summary>
        /// Add a control to the tabbed controls list.
        /// </summary>
        public void AddTabbedControl(CommonBaseControl control)
        {
            if (_tabbedButtonsControls.ContainsValue(control))
            {
                SystemMonitor.Error("Control already added.");
                return;
            }

            #region Establish Index
            // Since the components enter one by one, it will happen that the index of the incoming control
            // is beyond the current maximum, so we look for the existing controls, one by one, and see where
            // the current one fits - this way they are restored places one by one and everyone is properly placed.

            int?index = null;
            if (control.PersistenceData.ContainsValue("combinedContainer.TabIndex"))
            {
                index = control.PersistenceData.GetValue <int>("combinedContainer.TabIndex");
            }

            int?actualIndex = null;
            if (index.HasValue)
            {
                foreach (ToolStripItem item in toolStripMain.Items)
                {
                    int itemIndex = 0;
                    if (item is ToolStripButton)
                    {
                        if (_tabbedButtonsControls.ContainsKey(item as ToolStripButton))
                        {
                            CommonBaseControl itemControl = _tabbedButtonsControls[item as ToolStripButton];
                            if (itemControl != null && itemControl.PersistenceData.ContainsValue("combinedContainer.TabIndex"))
                            {
                                itemIndex = itemControl.PersistenceData.GetValue <int>("combinedContainer.TabIndex");
                            }
                        }
                    }

                    if (index.Value <= itemIndex)
                    {
                        actualIndex = toolStripMain.Items.IndexOf(item);
                        break;
                    }
                }
            }
            #endregion

            string nameRepaired = control.Name.Replace("&", "&&");

            ToolStripButton controlButton = new ToolStripButton(nameRepaired);
            Image           image         = GetControlImage(control);
            if (image == null)
            {
                image = Resources.dot;
            }

            controlButton.ToolTipText  = control.Text;
            controlButton.Image        = image;
            controlButton.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
            controlButton.CheckOnClick = false;
            controlButton.Checked      = false;
            controlButton.MouseDown   += new MouseEventHandler(controlButton_MouseDown);
            controlButton.MouseUp     += new MouseEventHandler(controlButton_MouseUp);
            controlButton.MouseMove   += new MouseEventHandler(controlButton_MouseMove);

            if (actualIndex.HasValue)
            {
                toolStripMain.Items.Insert(actualIndex.Value, controlButton);
            }
            else
            {
                toolStripMain.Items.Add(controlButton);
            }

            _tabbedButtonsControls.Add(controlButton, control);

            bool isChecked = false;
            if (control.PersistenceData != null && control.PersistenceData.ContainsValue("combinedContainer.Checked"))
            {
                isChecked = control.PersistenceData.GetBoolean("combinedContainer.Checked");
            }

            if (_checkedControl == null || isChecked)
            {
                ChangeCheckedControl(control);
            }

            UpdateUI();
        }
        /// <summary>
        ///
        /// </summary>
        public void AddControl(CommonBaseControl control)
        {
            Point?location = null;
            Size? size     = null;

            if (control.PersistenceData != null && control.PersistenceData.ContainsValue("combinedContainer.Size"))
            {
                size = control.PersistenceData.GetValue <Size>("combinedContainer.Size");
            }

            if (control.PersistenceData != null && control.PersistenceData.ContainsValue("combinedContainer.Location"))
            {
                location = control.PersistenceData.GetValue <Point>("combinedContainer.Location");
            }

            if (control.PersistenceData != null && control.PersistenceData.ContainsValue("combinedContainer.Floating"))
            {
                CombinedHostingForm form = SetControlFloating(control);
                if (location.HasValue)
                {
                    form.Location = location.Value;
                }

                // Sometimes persistence may be wrong, so make sure to bring control to view when added.
                form.Left = Math.Max(form.Left, 0);
                form.Top  = Math.Max(form.Top, 0);

                form.Left = Math.Min(Screen.PrimaryScreen.WorkingArea.Width, form.Left);
                form.Top  = Math.Min(Screen.PrimaryScreen.WorkingArea.Height, form.Top);

                form.Width  = Math.Max(form.Width, 200);
                form.Height = Math.Max(form.Height, 150);

                if (size.HasValue)
                {
                    form.Size = size.Value;
                }
            }
            else if (control.PersistenceData != null && control.PersistenceData.ContainsValue("combinedContainer.Tabbed"))
            {
                AddTabbedControl(control);
            }
            else if (control.PersistenceData != null && control.PersistenceData.ContainsValue("combinedContainer.Docked") &&
                     control.PersistenceData.ContainsValue("combinedContainer.Guid"))
            {
                Guid        guid        = control.PersistenceData.GetValue <Guid>("combinedContainer.Guid");
                DragControl dragControl = dragContainerControl.GetDragControlByGuid(guid);
                if (dragControl == null)
                {
                    SystemMonitor.OperationError("Guid drag control not found. Using a default new one.");
                    AddTabbedControl(control);
                }
                else
                {// Reuse the existing drag control and place the new control inside it.
                    SetControlToDragControl(control, dragControl, Point.Empty);
                    dragControl.Visible = true;
                }
            }
            else
            {// By default add tabbed.
                AddTabbedControl(control);
            }
        }