Esempio n. 1
0
        protected override void DrawScreen(MenuScreenUpdateEventArgs args)
        {
            CancelRefreshScreenWithDelay();
            DrawScreen(args, Radio.DisplayTextMaxLength, (text, align) =>
            {
                bool sendMIDButtons = false;
                if (Radio.HasMID && !wereMIDButtonsOverriden)
                {
                    sendMIDButtons        = true;
                    waitingBatchMIDUpdate = true;
                }
                Radio.DisplayTextWithDelay(text, align, () =>
                {
                    if (sendMIDButtons)
                    {
                        wereMIDButtonsOverriden = true;
                        waitingBatchMIDUpdate   = false;
                        var midButtons          = new Message[] { MessageMIDMenuButtons, EmulatorIsMIDAUX ? MessageMIDAUXLastButtons : MessageMIDCDCLastButtons };
                        Manager.EnqueueMessage(midButtons);
                    }
                });
            }, reason =>
            {
                RefreshScreenWithDelay(reason);
            });

            if (IsDuplicateOnIKEEnabled)
            {
                DrawScreen(args, InstrumentClusterElectronics.DisplayTextMaxLength, (text, align) =>
                {
                    InstrumentClusterElectronics.DisplayTextWithDelay(text, align);
                });
            }
        }
Esempio n. 2
0
        protected override void DrawScreen(MenuScreenUpdateEventArgs args)
        {
            CancelRefreshScreenWithDelay();
            string    showText;
            TextAlign align = TextAlign.Left;

            switch (args.Reason)
            {
            case MenuScreenUpdateReason.Navigation:
                showText = CurrentScreen.Title;
                if (showText.Length < Radio.DisplayTextMaxLen)
                {
                    showText = CharIcons.NetRect + showText;
                }
                if (showText.Length < Radio.DisplayTextMaxLen)
                {
                    showText += CharIcons.NetRect;
                }
                align = TextAlign.Center;
                RefreshScreenWithDelay(MenuScreenUpdateReason.Scroll);
                break;

            case MenuScreenUpdateReason.StatusChanged:
                if (CurrentScreen.Status == String.Empty)
                {
                    UpdateScreen(MenuScreenUpdateReason.Refresh);
                    return;
                }
                showText = CurrentScreen.Status;
                align    = TextAlign.Center;
                RefreshScreenWithDelay();
                break;

            default:
                showText = GetShownItemString();
                var separator = showText.IndexOf(": ");
                if (separator >= 0)
                {
                    if (args.Reason == MenuScreenUpdateReason.Scroll)
                    {
                        showText = showText.Substring(0, separator + 1);
                        RefreshScreenWithDelay();
                    }
                    else
                    {
                        showText = showText.Substring(separator + 2);
                    }
                }
                break;
            }

            Message[] midButtons = null;
            if (Radio.HasMID && !wereMIDButtonsOverriden)
            {
                midButtons = new Message[] { MessageMIDMenuButtons, MessageMIDLastButtons };
                wereMIDButtonsOverriden = true;
            }
            Radio.DisplayTextWithDelay(showText, align, midButtons);
        }
Esempio n. 3
0
 public virtual void UpdateScreen(MenuScreenUpdateEventArgs args)
 {
     if (!IsEnabled)
     {
         return;
     }
     DrawScreen(args);
 }
Esempio n. 4
0
        public override void UpdateScreen(MenuScreenUpdateEventArgs args)
        {
            if (IsScreenSwitched)
            {
                return;
            }

            base.UpdateScreen(args);
        }
Esempio n. 5
0
        protected override void DrawScreen(MenuScreenUpdateEventArgs args)
        {
            if (isDrawing)
            {
                return; // TODO test
            }
            lock (drawLock)
            {
                isDrawing            = true;
                skipRefreshScreen    = true;
                skipClearTillRefresh = true; // TODO test no screen items lost
                base.DrawScreen(args);

                var messages = new Message[4];
                messages[0] = Bordmonitor.ShowText(CurrentScreen.Status ?? String.Empty, BordmonitorFields.Status, 0, false, false);
                lastTitle   = Bordmonitor.ShowText(CurrentScreen.Title ?? String.Empty, BordmonitorFields.Title, 0, false, false);
                messages[1] = lastTitle;
                byte[] itemsBytes = null;
                for (byte i = 0; i < 10; i++)
                {
                    var index = GetItemIndex(i, true);
                    var item  = CurrentScreen.GetItem(index);
                    if (item == null && itemsBytes != null)
                    {
                        itemsBytes = itemsBytes.Combine(0x06);
                        continue;
                    }
                    var s = item.Text;
                    var m = Bordmonitor.ShowText(s ?? String.Empty, BordmonitorFields.Item, i, item != null && item.IsChecked, false);
                    if (itemsBytes == null)
                    {
                        itemsBytes = m.Data;
                    }
                    else
                    {
                        var d = m.Data.Skip(3);
                        d[0]       = 0x06;
                        itemsBytes = itemsBytes.Combine(d);
                    }
                }
                itemsBytes = itemsBytes.Combine(0x06);
                // TODO split to 2-3 messages?
                messages[2]          = new Message(DeviceAddress.Radio, DeviceAddress.GraphicsNavigationDriver, "Fill screen items", itemsBytes);
                messages[3]          = Bordmonitor.MessageRefreshScreen;
                skipRefreshScreen    = true;
                skipClearTillRefresh = true;
                Manager.EnqueueMessage(messages);
                isDrawing = false;
            }
        }
Esempio n. 6
0
        protected void DrawScreen(MenuScreenUpdateEventArgs args, int maxLength, DrawHandler callback, RefreshHandler refreshCallback = null)
        {
            string showText;
            var    align = TextAlign.Left;

            switch (args.Reason)
            {
            case MenuScreenUpdateReason.Navigation:
                showText = CurrentScreen.Title;
                if (showText.Length < maxLength)
                {
                    showText = CharIcons.NetRect + showText;
                }
                if (showText.Length < Radio.DisplayTextMaxLength)
                {
                    showText += CharIcons.NetRect;
                }
                align = TextAlign.Center;
                if (refreshCallback != null)
                {
                    refreshCallback(MenuScreenUpdateReason.Scroll);
                }
                break;

            case MenuScreenUpdateReason.StatusChanged:
                if (CurrentScreen.Status == String.Empty)
                {
                    UpdateScreen(MenuScreenUpdateReason.Refresh);
                    return;
                }
                showText = CurrentScreen.Status;
                align    = TextAlign.Center;
                if (refreshCallback != null)
                {
                    refreshCallback(MenuScreenUpdateReason.Refresh);
                }
                break;

            default:
                showText = GetItemString(args.Reason, maxLength, refreshCallback);
                break;
            }

            callback(showText, align);
        }
Esempio n. 7
0
 void currentScreen_Updated(MenuScreen screen, MenuScreenUpdateEventArgs args)
 {
     UpdateScreen(args);
 }
Esempio n. 8
0
 protected virtual void DrawScreen(MenuScreenUpdateEventArgs args)
 {
 }
Esempio n. 9
0
 public virtual void UpdateScreen(MenuScreenUpdateEventArgs args)
 {
     if (!IsEnabled)
     {
         return;
     }
     DrawScreen(args);
 }
Esempio n. 10
0
        protected override void DrawScreen(MenuScreenUpdateEventArgs args)
        {
            if (isDrawing)
            {
                return; // TODO test
            }
            lock (drawLock)
            {
                isDrawing = true;
                skipRefreshScreen = true;
                skipClearTillRefresh = true; // TODO test no screen items lost
                base.DrawScreen(args);

                var messages = new Message[FastMenuDrawing ? 4 : 13];
                var n = 0;
                messages[n++] = Bordmonitor.ShowText(CurrentScreen.Status ?? String.Empty, BordmonitorFields.Status, 0, false, false);
                lastTitle = Bordmonitor.ShowText(CurrentScreen.Title ?? String.Empty, BordmonitorFields.Title, 0, false, false);
                messages[n++] = lastTitle;
                byte[] itemsBytes = null;
                for (byte i = 0; i < 10; i++)
                {
                    var index = GetItemIndex(i, true);
                    var item = CurrentScreen.GetItem(index);
                    if (FastMenuDrawing)
                    {
                        if (item == null && itemsBytes != null)
                        {
                            itemsBytes = itemsBytes.Combine(0x06);
                            continue;
                        }
                        var m = DrawItem(item, i);
                        if (itemsBytes == null)
                        {
                            itemsBytes = m.Data;
                        }
                        else
                        {
                            var d = m.Data.Skip(3);
                            d[0] = 0x06;
                            itemsBytes = itemsBytes.Combine(d);
                        }
                    }
                    else
                    {
                        if (item == null && n > 2)
                        {
                            var prevMess = messages[n-1];
                            messages[n - 1] = new Message(prevMess.SourceDevice, prevMess.DestinationDevice, prevMess.ReceiverDescription, prevMess.Data.Combine(0x06));
                        }
                        else
                        {
                            messages[n++] = DrawItem(item, i);
                        }
                        messages[n - 1].AfterSendDelay = 40;
                    }
                }
                if (FastMenuDrawing)
                {
                    itemsBytes = itemsBytes.Combine(0x06);
                    messages[n++] = new Message(DeviceAddress.Radio, DeviceAddress.GraphicsNavigationDriver, "Fill screen items", itemsBytes);
                }
                messages[n++] = Bordmonitor.MessageRefreshScreen;
                skipRefreshScreen = true;
                skipClearTillRefresh = true;
                Manager.EnqueueMessage(messages);
                isDrawing = false;
            }
        }
Esempio n. 11
0
        public override void UpdateScreen(MenuScreenUpdateEventArgs args)
        {
            if (IsScreenSwitched)
            {
                return;
            }

            base.UpdateScreen(args);
        }
Esempio n. 12
0
        protected override void DrawScreen(MenuScreenUpdateEventArgs args)
        {
            if (isDrawing)
            {
                return; // TODO test
            }
            lock (drawLock)
            {
                isDrawing            = true;
                skipRefreshScreen    = true;
                skipClearTillRefresh = true; // TODO test no screen items lost
                base.DrawScreen(args);

                var messages = new Message[FastMenuDrawing ? 4 : 13];
                var n        = 0;
                messages[n++] = Bordmonitor.ShowText(CurrentScreen.Status ?? String.Empty, BordmonitorFields.Status, 0, false, false);
                lastTitle     = Bordmonitor.ShowText(CurrentScreen.Title ?? String.Empty, BordmonitorFields.Title, 0, false, false);
                messages[n++] = lastTitle;
                byte[] itemsBytes = null;
                for (byte i = 0; i < 10; i++)
                {
                    var index = GetItemIndex(i, true);
                    var item  = CurrentScreen.GetItem(index);
                    if (FastMenuDrawing)
                    {
                        if (item == null && itemsBytes != null)
                        {
                            itemsBytes = itemsBytes.Combine(0x06);
                            continue;
                        }
                        var m = DrawItem(item, i);
                        if (itemsBytes == null)
                        {
                            itemsBytes = m.Data;
                        }
                        else
                        {
                            var d = m.Data.Skip(3);
                            d[0]       = 0x06;
                            itemsBytes = itemsBytes.Combine(d);
                        }
                    }
                    else
                    {
                        if (item == null && n > 2)
                        {
                            var prevMess = messages[n - 1];
                            messages[n - 1] = new Message(prevMess.SourceDevice, prevMess.DestinationDevice, prevMess.ReceiverDescription, prevMess.Data.Combine(0x06));
                        }
                        else
                        {
                            messages[n++] = DrawItem(item, i);
                        }
                        messages[n - 1].AfterSendDelay = 40;
                    }
                }
                if (FastMenuDrawing)
                {
                    itemsBytes    = itemsBytes.Combine(0x06);
                    messages[n++] = new Message(DeviceAddress.Radio, DeviceAddress.GraphicsNavigationDriver, "Fill screen items", itemsBytes);
                }
                messages[n++]        = Bordmonitor.MessageRefreshScreen;
                skipRefreshScreen    = true;
                skipClearTillRefresh = true;
                Manager.EnqueueMessage(messages);
                isDrawing = false;
            }
        }
Esempio n. 13
0
        protected override void DrawScreen(MenuScreenUpdateEventArgs args)
        {
            CancelRefreshScreenWithDelay();
            string showText;
            TextAlign align = TextAlign.Left;
            switch (args.Reason)
            {
                case MenuScreenUpdateReason.Navigation:
                    showText = CurrentScreen.Title;
                    if (showText.Length < Radio.DisplayTextMaxLen)
                    {
                        showText = CharIcons.NetRect + showText;
                    }
                    if (showText.Length < Radio.DisplayTextMaxLen)
                    {
                        showText += CharIcons.NetRect;
                    }
                    align = TextAlign.Center;
                    RefreshScreenWithDelay(MenuScreenUpdateReason.Scroll);
                    break;
                case MenuScreenUpdateReason.StatusChanged:
                    if (CurrentScreen.Status == String.Empty)
                    {
                        UpdateScreen(MenuScreenUpdateReason.Refresh);
                        return;
                    }
                    showText = CurrentScreen.Status;
                    align = TextAlign.Center;
                    RefreshScreenWithDelay();
                    break;
                default:
                    showText = GetShownItemString();
                    var separator = showText.IndexOf(": ");
                    if (separator >= 0)
                    {
                        if (args.Reason == MenuScreenUpdateReason.Scroll)
                        {
                            showText = showText.Substring(0, separator + 1);
                            RefreshScreenWithDelay();
                        }
                        else
                        {
                            showText = showText.Substring(separator + 2);
                        }
                    }
                    break;
            }

            Message[] midButtons = null;
            if (Radio.HasMID && !wereMIDButtonsOverriden)
            {
                midButtons = new Message[] { MessageMIDMenuButtons, MessageMIDLastButtons };
                wereMIDButtonsOverriden = true;
            }
            Radio.DisplayTextWithDelay(showText, align, midButtons);
        }
Esempio n. 14
0
 void currentScreen_Updated(MenuScreen screen, MenuScreenUpdateEventArgs args)
 {
     UpdateScreen(args);
 }
Esempio n. 15
0
 protected virtual void DrawScreen(MenuScreenUpdateEventArgs args)
 {
 }
Esempio n. 16
0
        protected override void DrawScreen(MenuScreenUpdateEventArgs args)
        {
            CancelRefreshScreenWithDelay();
            string    showText;
            TextAlign align = TextAlign.Left;

            switch (args.Reason)
            {
            case MenuScreenUpdateReason.Navigation:
                showText = CurrentScreen.Title;
                if (showText.Length < Radio.DisplayTextMaxLen)
                {
                    showText = CharIcons.NetRect + showText;
                }
                if (showText.Length < Radio.DisplayTextMaxLen)
                {
                    showText += CharIcons.NetRect;
                }
                align = TextAlign.Center;
                RefreshScreenWithDelay(MenuScreenUpdateReason.Scroll);
                break;

            case MenuScreenUpdateReason.StatusChanged:
                if (CurrentScreen.Status == String.Empty)
                {
                    UpdateScreen(MenuScreenUpdateReason.Refresh);
                    return;
                }
                showText = CurrentScreen.Status;
                align    = TextAlign.Center;
                RefreshScreenWithDelay();
                break;

            default:
                showText = GetShownItemString();
                var separator = showText.IndexOf(": ");
                if (separator >= 0)
                {
                    if (args.Reason == MenuScreenUpdateReason.Scroll)
                    {
                        showText = showText.Substring(0, separator + 1);
                        RefreshScreenWithDelay();
                    }
                    else
                    {
                        showText = showText.Substring(separator + 2);
                    }
                }
                break;
            }
            //if (delayUpdateScreen)
            //{
            Radio.DisplayTextWithDelay(showText, align);
            //}
            //else
            //{
            //    Radio.DisplayText(showText, align);
            //}
            //delayUpdateScreen = false;
            //itemScrolled = false;
        }