示例#1
0
        void NewItem_OnNewItemArrive(ItemType type, int newItemsCount)
        {
            //防止程序第一次启动就产生通知
            if (!firstLoad)
            {
                //提示音
                using (SoundPlayer player = new SoundPlayer())
                {
                    string soundfile = System.IO.Path.Combine(Environment.CurrentDirectory, "Resources\\Notify.wav");
                    if (File.Exists(soundfile))
                    {
                        player.SoundLocation = soundfile;
                        player.Play();
                    }
                }

                animation = CreateSingleAnimation();

                //闪烁
                if (type == ItemType.Bug)
                {
                    lbBugCount.BeginAnimation(Label.OpacityProperty, animation);
                }
                else if (type == ItemType.Task)
                {
                    lbTaskCount.BeginAnimation(Label.OpacityProperty, animation);
                }
                else if (type == ItemType.Story)
                {
                    lbStoryCount.BeginAnimation(Label.OpacityProperty, animation);
                }

                //任务栏通知
                if (appconfig.IsTaskNotify)
                {
                    NewArriveNotify notifyfrm = new NewArriveNotify(type, newItemsCount, TaskbarPtr);
                    notifyfrm.Closed         += new EventHandler(notifyfrm_Closed);
                    notifyfrm.HyperLinkClick += new RoutedEventHandler(notifyfrm_HyperLinkClick);

                    notifyfrm.ShownNotifyFormCount = ShownNotifyFormCount;
                    Interlocked.Increment(ref ShownNotifyFormCount);
                    notifyfrm.Show();
                }
            }
        }
示例#2
0
        private void CheckZuggerUpdate()
        {
            if (!checkedUpdate)
            {
                string latestVersion;
                bool   isUpdate = Util.GetLatestVersionNumber(out latestVersion);

                if (isUpdate)
                {
                    string          showText  = string.Format("检测到新版本{0}", latestVersion);
                    NewArriveNotify notifyfrm = new NewArriveNotify(showText);
                    notifyfrm.Closed         += new EventHandler(notifyfrm_Closed);
                    notifyfrm.HyperLinkClick += new RoutedEventHandler(notifyfrm_ZuggerUpdateHyperLinkClick);
                    Interlocked.Increment(ref ShownNotifyFormCount);
                    notifyfrm.Show();
                }

                checkedUpdate = true;
            }
        }