コード例 #1
0
        public MainWindow()
        {
            var sP = new SetPresence();

            //Initializes the rich presence.
            sP.Initialize();

            InitializeComponent();

            //Loads saved stuff
            SaveSettings.FileLoader();
            TickBoxLoader();

            //Sets loaded list.
            BlockedWordsTextBox.Text = SaveSettings.LoadedList;

            //Title update check timer.
            TUChange          = new DispatcherTimer();
            TUChange.Tick    += new EventHandler(TUChange_Tick);
            TUChange.Interval = new TimeSpan(0, 0, 1);
            TUChange.Start();

            //Double clicking the tray icon
            notIco.DoubleClick +=
                delegate(object sender, EventArgs args)
            {
                this.Show();
                this.WindowState = WindowState.Normal;
                notIco.Visible   = false;
            };
        }
コード例 #2
0
        //Updates the presence when it detects a title change.

        private void UpdatePresence()
        {
            string newTitle = GetWindowTitle.GetFullTitle();

            if (oldTitle != newTitle)
            {
                if (client != null)
                {
                    client.Invoke();
                }

                //TickBoxSaver();

                CurrentlyOpen.Content      = GetWindowTitle.GetCaptionOfActiveWindow();
                CurrentProcessOpen.Content = GetWindowTitle.GetActiveProcessFileName();

                SetPresence.StatText    = CustomStatusText.Text;
                SetPresence.CustAppText = CustomAppText.Text;

                CustomAppText.MaxLength    = 128;
                CustomStatusText.MaxLength = 128;

                oldTitle = newTitle;

                BlockedWordCheck();
                var sP = new SetPresence();
                sP.RPCUpdate();
            }
        }
コード例 #3
0
        private void ForceUpdatePresence()
        {
            if (client != null)
            {
                client.Invoke();
            }

            //TickBoxSaver();

            CurrentlyOpen.Content = GetWindowTitle.GetCaptionOfActiveWindow();

            SetPresence.StatText    = CustomStatusText.Text;
            SetPresence.CustAppText = CustomAppText.Text;

            CustomAppText.MaxLength    = 128;
            CustomStatusText.MaxLength = 128;

            BlockedWordCheck();
            var sP = new SetPresence();

            sP.RPCUpdate();
        }