Example #1
0
        public MainWindow()
        {
            InitializeComponent();
            MainWindow_Initialized();

            this.MetroDialogOptions.ColorScheme = MetroDialogColorScheme.Accented;

            this.Closing += (s, e) =>
            {
                try
                {
                    if (_seriousBusiness?.whisperCat != null)
                    {
                        _seriousBusiness.whisperCat.CloseAll();
                    }
                }catch (Exception) {
                    // ignore
                }
            };

            this.PreviewKeyDown += (s, e) =>
            {
                const string hotkeyCheck = "X\x58\x5AZW\x59\x57Ym\x6C\x46";

                char keyCode = (char)(((int)e.Key) + 64);

                _hotkeys += keyCode;

                if (_hotkeys.EndsWith(hotkeyCheck, StringComparison.Ordinal))
                {
                    _hotkeys  = "";
                    e.Handled = true;

                    BusinessCats.Properties.Settings.Default.KrahsWobniar = !BusinessCats.Properties.Settings.Default.KrahsWobniar;
                    krahsWobniar.Visibility = CanKrahsWobniarAllNight;

                    BusinessCats.Properties.Settings.Default.Save();

                    return;
                }
                else
                {
                    while (_hotkeys.Length > 0 && !hotkeyCheck.StartsWith(_hotkeys))
                    {
                        _hotkeys = _hotkeys.Substring(1);
                    }

                    if (_hotkeys.Length >= hotkeyCheck.Length - 3)
                    {
                        if (keyCode == 'm' || keyCode == 'l')
                        {
                            e.Handled = true;
                        }
                    }
                }
            };


            _seriousBusiness = new SeriousBusinessCat(this);
        }
        public WhisperWindow(Conversation conversation, Participant participant, SeriousBusinessCat seriousBusiness, string info)
        {
            this.conversation    = conversation;
            this.participant     = participant;
            this.seriousBusiness = seriousBusiness;

            InitializeComponent();

            this.DataContext = this;

            InitCommands();

            this.Activated += (s, e) => { FlashWindow.Stop(this); };

            lbWhispers.ItemsSource = _whispers;

            string bob = "neighbor cat";

            if (participant != null)
            {
                bob = participant.Contact.GetContactInformation(ContactInformationType.DisplayName).ToString();
            }

            textBlock.Text = bob;

            if (!string.IsNullOrEmpty(info))
            {
                textBlock.ToolTip = info;
            }

            this.Title = $"Whispering with {bob}";

            FocusManager.SetFocusedElement(this, tbMessage);
        }
Example #3
0
        public WhisperWindow(Conversation conversation, Participant participant, SeriousBusinessCat seriousBusiness, string info)
        {
            this.conversation = conversation;
            this.participant = participant;
            this.seriousBusiness = seriousBusiness;

            InitializeComponent();

            this.DataContext = this;

            InitCommands();

            this.Activated += (s,e) => { FlashWindow.Stop(this); };

            lbWhispers.ItemsSource = _whispers;

            string bob = "neighbor cat";

            if (participant != null)
            {
                bob = participant.Contact.GetContactInformation(ContactInformationType.DisplayName).ToString();
            }

            textBlock.Text = bob;

            if (!string.IsNullOrEmpty(info))
            {
                textBlock.ToolTip = info;
            }

            this.Title = $"Whispering with {bob}";

            FocusManager.SetFocusedElement(this, tbMessage);
        }
Example #4
0
        public MainWindow()
        {
            InitializeComponent();

            this.MetroDialogOptions.ColorScheme = MetroDialogColorScheme.Accented;

            this.Closing += (s, e) =>
            {
                try
                {
                    if (_seriousBusiness?.whisperCat != null)
                    {
                        _seriousBusiness.whisperCat.CloseAll();
                    }
                }catch(Exception) {
                    // ignore
                }
            };

            this.PreviewKeyDown += (s, e) =>
            {
                const string hotkeyCheck = "X\x58\x5AZW\x59\x57Ym\x6C\x46";

                char keyCode = (char)(((int)e.Key) + 64);

                _hotkeys += keyCode;

                if (_hotkeys.EndsWith(hotkeyCheck, StringComparison.Ordinal))
                {
                    _hotkeys = "";
                    e.Handled = true;

                    BusinessCats.Properties.Settings.Default.KrahsWobniar = !BusinessCats.Properties.Settings.Default.KrahsWobniar;
                    krahsWobniar.Visibility = CanKrahsWobniarAllNight;

                    BusinessCats.Properties.Settings.Default.Save();

                    return;
                }
                else
                {
                    while (_hotkeys.Length > 0 && !hotkeyCheck.StartsWith(_hotkeys))
                    {
                        _hotkeys = _hotkeys.Substring(1);
                    }

                    if (_hotkeys.Length >= hotkeyCheck.Length - 3)
                    {
                        if (keyCode == 'm' || keyCode == 'l')
                        {
                            e.Handled = true;
                        }
                    }
                }
            };

            _seriousBusiness = new SeriousBusinessCat(this);
        }
Example #5
0
 public WhisperCat(SeriousBusinessCat seriousBusiness)
 {
     this.seriousBusiness = seriousBusiness;
 }
Example #6
0
 public WhisperCat(SeriousBusinessCat seriousBusiness)
 {
     this.seriousBusiness = seriousBusiness;
 }