Ejemplo n.º 1
0
 void SetTextBoxValue(ControlFlag box, string value)
 {
     if (currentWindow.ReadControl(ControlFlag.Value | box) != value)
     {
         currentWindow.WriteControl(ControlFlag.Value | box, value);
     }
 }
Ejemplo n.º 2
0
 void SetBookmark(ControlFlag label, IBookmark bmk)
 {
     if (bmk != null && source.Visible)
     {
         WriteControl(label | ControlFlag.Value, bmk.Time.ToUserFrendlyString());
         WriteControl(label | ControlFlag.Enabled, true);
     }
     else
     {
         WriteControl(label | ControlFlag.Value, "-");
         WriteControl(label | ControlFlag.Enabled, false);
     }
 }
Ejemplo n.º 3
0
        void IViewEvents.OnBookmarkLinkClicked(ControlFlag controlId)
        {
            IBookmark bmk = null;

            if (controlId == ControlFlag.FirstMessageLinkLabel)
            {
                bmk = firstMessageBmk;
            }
            else if (controlId == ControlFlag.LastMessageLinkLabel)
            {
                bmk = lastMessageBmk;
            }
            if (bmk != null)
            {
                presentersFacade.ShowMessage(bmk, BookmarkNavigationOptions.EnablePopups | BookmarkNavigationOptions.GenericStringsSet | BookmarkNavigationOptions.NoLinksInPopups);
            }
        }
Ejemplo n.º 4
0
        void IWindow.WriteControl(ControlFlag flags, string value)
        {
            Control ctrl;

            if (!controls.TryGetValue(flags & ControlFlag.ControlIdMask, out ctrl))
            {
                return;
            }
            if ((flags & ControlFlag.Value) != 0)
            {
                ctrl.Text = value;
                if (ctrl is TextBox)
                {
                    (ctrl as TextBox).Select(0, 0);
                }
            }
            else if ((flags & ControlFlag.Checked) != 0)
            {
                var cb = ctrl as CheckBox;
                if (cb != null)
                {
                    cb.Checked = value != null;
                }
            }
            else if ((flags & ControlFlag.Visibility) != 0)
            {
                ctrl.Visible = value != null;
            }
            else if ((flags & ControlFlag.BackColor) != 0)
            {
                ctrl.BackColor = new ModelColor(uint.Parse(value)).ToColor();
            }
            else if ((flags & ControlFlag.ForeColor) != 0)
            {
                ctrl.ForeColor = new ModelColor(uint.Parse(value)).ToColor();
            }
            else if ((flags & ControlFlag.Enabled) != 0)
            {
                ctrl.Enabled = value != null;
            }
        }
Ejemplo n.º 5
0
        string IWindow.ReadControl(ControlFlag flags)
        {
            Control ctrl;

            if (!controls.TryGetValue(flags & ControlFlag.ControlIdMask, out ctrl))
            {
                return(null);
            }
            if ((flags & ControlFlag.Value) != 0)
            {
                return(ctrl.Text);
            }
            else if ((flags & ControlFlag.Checked) != 0)
            {
                return(ctrl is CheckBox && (ctrl as CheckBox).Checked ? "" : null);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 6
0
        string IWindow.ReadControl(ControlFlag flags)
        {
            NSView view;

            if (!controls.TryGetValue(flags & ControlFlag.ControlIdMask, out view))
            {
                return(null);
            }
            if ((flags & ControlFlag.Value) != 0)
            {
                return(view is NSControl ? (view as NSControl).StringValue : null);
            }
            else if ((flags & ControlFlag.Checked) != 0)
            {
                return(view is NSButton && (view as NSButton).State == NSCellStateValue.On ? "" : null);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 7
0
        void IWindow.WriteControl(ControlFlag flags, string value)
        {
            NSView view;

            if (!controls.TryGetValue(flags & ControlFlag.ControlIdMask, out view))
            {
                return;
            }
            NSControl   ctrl;
            NSButton    btn;
            NSLinkLabel ll;
            NSTextField txt;

            if ((flags & ControlFlag.Value) != 0)
            {
                if ((ctrl = view as NSControl) != null)
                {
                    ctrl.StringValue = value;
                    if ((txt = view as NSTextField) != null && txt.CurrentEditor != null)
                    {
                        txt.CurrentEditor.SelectedRange = new NSRange();
                    }
                }
                else if ((ll = view as NSLinkLabel) != null)
                {
                    ll.StringValue = value;
                }
            }
            else if ((flags & ControlFlag.Checked) != 0)
            {
                if ((btn = view as NSButton) != null)
                {
                    btn.State = value != null ? NSCellStateValue.On : NSCellStateValue.Off;
                }
            }
            else if ((flags & ControlFlag.Visibility) != 0)
            {
                view.Hidden = value == null;
            }
            else if ((flags & ControlFlag.BackColor) != 0)
            {
                if ((txt = view as NSTextField) != null)
                {
                    txt.BackgroundColor = new ModelColor(uint.Parse(value)).ToColor().ToNSColor();
                }
            }
            else if ((flags & ControlFlag.ForeColor) != 0)
            {
                if ((ll = view as NSLinkLabel) != null)
                {
                    ll.TextColor = new ModelColor(uint.Parse(value)).ToColor().ToNSColor();
                }
            }
            else if ((flags & ControlFlag.Enabled) != 0)
            {
                if ((ctrl = view as NSControl) != null)
                {
                    ctrl.Enabled = value != null;
                }
                else if ((ll = view as NSLinkLabel) != null)
                {
                    ll.IsEnabled = value != null;
                }
            }
        }
Ejemplo n.º 8
0
 void WriteControl(ControlFlag flags, bool value)
 {
     currentWindow.WriteControl(flags, value ? "" : null);
 }
Ejemplo n.º 9
0
 void WriteControl(ControlFlag flags, string value)
 {
     currentWindow.WriteControl(flags, value);
 }