Esempio n. 1
0
        private void OnOnOffItemStatusChanged(object sender, ItemStatus status)
        {
            SensePanelOnOffItem _Itm = (sender as SensePanelOnOffItem);

            //itm.SecondaryText = string.Format("{0} and {1}", itm.Enabled ? "Enabled" : "Disabled", itm.Status.Equals(ItemStatus.On) ? "On" : "Off");
            //SensePanelOnOffItem _Itm = (senseListCtrl["OnOffItem1"] as SensePanelOnOffItem);
            if (_Itm != null)
            {
                UpdateSetting(_Itm.Name, SenseFactory.StatusToBool(status).ToString());

                switch (_Itm.Name)
                {
                case "DebugOn":
                    if (null != DebugChanged)
                    {
                        DebugChanged(sender, new System.EventArgs());
                    }
                    break;

                case "UseGps":
                    if (null != UseGps)
                    {
                        UseGps(sender, new System.EventArgs());
                    }
                    break;

                default:
                    break;
                }

                //_Itm.Enabled = Status.Equals(ItemStatus.On);
                //_Itm.SecondaryText = string.Format("{0} and {1}", _Itm.Enabled ? "Enabled" : "Disabled", _Itm.Status.Equals(ItemStatus.On) ? "On" : "Off");
            }
        }
Esempio n. 2
0
        public static SensePanelOnOffItem CreateOnOffItem(SensePropertyBag parameter,
                                                          SensePanelOnOffItem.StatusEventHandler handler)
        {
            SensePanelOnOffItem result = new SensePanelOnOffItem(parameter.PropertyName)
            {
                ButtonAnimation     = true,
                ProcessEntireButton = false,
                PrimaryText         = parameter.PropertyLabel,
                Enabled             = true,
                Status        = BoolToStatus(Convert.ToBoolean(Settings.GetProperty(parameter.PropertyName))),
                SecondaryText = parameter.PropertyExplanation
            };

            result.OnStatusChanged += handler;

            return(result);
        }
Esempio n. 3
0
        private void InitializeSenseComponents()
        {
            SenseHeaderControl header = new SenseHeaderControl();

            header.Dock = DockStyle.Top;
            header.Text = "LEN Configurator";

            list      = new SenseListControl();
            list.Dock = DockStyle.Fill;

            SensePanelDividerItem divStatus = new SensePanelDividerItem();

            divStatus.Text = "Status";

            itemStatus = new SensePanelColoredLabelItem();
            HandleTimerAppRunningTick(this, EventArgs.Empty);

            SensePanelDividerItem divNotify = new SensePanelDividerItem();

            divNotify.Text = "Notify on...";

            SensePanelOnOffItem itemCalls = new SensePanelOnOffItem();

            itemCalls.PrimaryText      = "Missed calls";
            itemCalls.Status           = ToItemStatus(Settings.Instance.NotifyOnMissedCalls);
            itemCalls.OnStatusChanged += new SensePanelOnOffItem.StatusEventHandler(HandleItemCallsStatusChanged);

            SensePanelOnOffItem itemSms = new SensePanelOnOffItem();

            itemSms.PrimaryText      = "Unread SMS";
            itemSms.Status           = ToItemStatus(Settings.Instance.NotifyOnSms);
            itemSms.OnStatusChanged += new SensePanelOnOffItem.StatusEventHandler(HandleItemSmsStatusChanged);

            SensePanelOnOffItem itemMms = new SensePanelOnOffItem();

            itemMms.PrimaryText      = "Unread MMS";
            itemMms.Status           = ToItemStatus(Settings.Instance.NotifyOnMms);
            itemMms.OnStatusChanged += new SensePanelOnOffItem.StatusEventHandler(HandleItemMmsStatusChanged);

            SensePanelOnOffItem itemEmail = new SensePanelOnOffItem();

            itemEmail.PrimaryText      = "Unread e-mail";
            itemEmail.Status           = ToItemStatus(Settings.Instance.NotifyOnEmail);
            itemEmail.OnStatusChanged += new SensePanelOnOffItem.StatusEventHandler(HandleItemEmailStatusChanged);

            SensePanelOnOffItem itemVmail = new SensePanelOnOffItem();

            itemVmail.PrimaryText      = "Voicemail messages";
            itemVmail.Status           = ToItemStatus(Settings.Instance.NotifyOnVoicemail);
            itemVmail.OnStatusChanged += new SensePanelOnOffItem.StatusEventHandler(HandleItemVmailStatusChanged);

            SensePanelOnOffItem itemReminder = new SensePanelOnOffItem();

            itemReminder.PrimaryText      = "Reminders";
            itemReminder.Status           = ToItemStatus(Settings.Instance.NotifyOnReminders);
            itemReminder.OnStatusChanged += new SensePanelOnOffItem.StatusEventHandler(HandleItemReminderStatusChanged);

            SensePanelDividerItem divBehaviour = new SensePanelDividerItem();

            divBehaviour.Text = "Behaviour options";

            SensePanelOnOffItem itemStopDuringCall = new SensePanelOnOffItem();

            itemStopDuringCall.PrimaryText      = "Stop blinking during call";
            itemStopDuringCall.SecondaryText    = "Continues after call finished";
            itemStopDuringCall.Status           = ToItemStatus(Settings.Instance.DoNotNotifyDuringCall);
            itemStopDuringCall.OnStatusChanged += new SensePanelOnOffItem.StatusEventHandler(HandleItemStopDuringCallStatusChanged);

            SensePanelOnOffItem itemStopAfterUnlock = new SensePanelOnOffItem();

            itemStopAfterUnlock.PrimaryText      = "Stop blinking after unlock";
            itemStopAfterUnlock.SecondaryText    = "Until new notifications are available";
            itemStopAfterUnlock.Status           = ToItemStatus(Settings.Instance.StopBlinkingAfterUnlock);
            itemStopAfterUnlock.OnStatusChanged += new SensePanelOnOffItem.StatusEventHandler(HandleItemStopAfterUnlockStatusChanged);

            // Duration
            int curDuration = Settings.Instance.NotificationTimeoutInSeconds;

            itemDuration               = new SensePanelMoreItem();
            itemDuration.PrimaryText   = "Stop blinking after X seconds";
            itemDuration.SecondaryText = "Currently " + (curDuration > 0 ? "set to " + curDuration + " seconds" : "disabled");

            txtDuration            = new SensePanelTextboxItem();
            txtDuration.LabelText  = "Set a new time? (0 = forever)";
            txtDuration.Text       = curDuration + "";
            txtDuration.GotFocus  += new EventHandler(HandleTextboxGotFocus);
            txtDuration.LostFocus += new EventHandler(HandleTextboxLostFocus);
            itemDuration.Children.Add(txtDuration);

            SensePanelButtonItem btnDuration = new SensePanelButtonItem();

            btnDuration.Text     = "Save";
            btnDuration.OnClick += new SensePanelButtonItem.ClickEventHandler(HandleDurationClick);
            itemDuration.Children.Add(btnDuration);

            // Blinking sequence
            string curSequence = Settings.Instance.BlinkingSequence;

            itemSequence               = new SensePanelMoreItem();
            itemSequence.PrimaryText   = "Set the blinking sequence";
            itemSequence.SecondaryText = "Currently: " + curSequence;

            txtSequence            = new SensePanelTextboxItem();
            txtSequence.LabelText  = "Set new sequence (off-on-off-on-etc...)";
            txtSequence.Text       = curSequence;
            txtSequence.GotFocus  += new EventHandler(HandleTextboxGotFocus);
            txtSequence.LostFocus += new EventHandler(HandleTextboxLostFocus);
            itemSequence.Children.Add(txtSequence);

            SensePanelButtonItem btnSequence = new SensePanelButtonItem();

            btnSequence.Text     = "Save";
            btnSequence.OnClick += new SensePanelButtonItem.ClickEventHandler(HandleSequenceClick);
            itemSequence.Children.Add(btnSequence);

            // Blinking sleep
            int curBlinkSleep = Settings.Instance.SleepTimeBetweenSequencesInMilliseconds;

            itemBlinkSleep               = new SensePanelMoreItem();
            itemBlinkSleep.PrimaryText   = "Time between blinking sequences";
            itemBlinkSleep.SecondaryText = "Currently set to " + curBlinkSleep + " ms";

            txtBlinkSleep            = new SensePanelTextboxItem();
            txtBlinkSleep.LabelText  = "Set new time between blinking sequences (in ms)";
            txtBlinkSleep.Text       = curBlinkSleep + "";
            txtBlinkSleep.GotFocus  += new EventHandler(HandleTextboxGotFocus);
            txtBlinkSleep.LostFocus += new EventHandler(HandleTextboxLostFocus);
            itemBlinkSleep.Children.Add(txtBlinkSleep);

            SensePanelButtonItem btnBlinkSleep = new SensePanelButtonItem();

            btnBlinkSleep.Text     = "Save";
            btnBlinkSleep.OnClick += new SensePanelButtonItem.ClickEventHandler(HandleBlinkSleepClick);
            itemBlinkSleep.Children.Add(btnBlinkSleep);

            list.AddItem(divStatus, true);
            list.AddItem(itemStatus, true);
            list.AddItem(divNotify, true);
            list.AddItem(itemCalls, true);
            list.AddItem(itemSms, true);
            list.AddItem(itemMms, true);
            list.AddItem(itemEmail, true);
            list.AddItem(itemVmail, true);
            list.AddItem(itemReminder, true);
            list.AddItem(divBehaviour, true);
            list.AddItem(itemStopDuringCall, true);
            list.AddItem(itemStopAfterUnlock, true);
            list.AddItem(itemDuration, true);
            list.AddItem(itemSequence, true);
            list.AddItem(itemBlinkSleep, true);

            Controls.Add(list);
            Controls.Add(header);
        }