Пример #1
0
 /// <summary>
 /// 追踪
 /// </summary>
 /// <param name="obj"></param>
 private void Track(object obj)
 {
     if (GlobalVariable.PlayerWindowIsOpened == false)
     {
         PlayerWindow newWin = new PlayerWindow(PlayerWindowType.Track);
         newWin.Topmost = true;
         newWin.WindowStartupLocation = WindowStartupLocation.Manual;
         newWin.Left = 23;
         newWin.Top  = 165;
         newWin.Show();
         GlobalVariable.PlayerWindowIsOpened = true;
     }
     else
     {
         PlayerWindow w = (PlayerWindow)obj;
         w.Close();
         PlayerWindow newWin = new PlayerWindow(PlayerWindowType.Track);
         newWin.Topmost = true;
         newWin.WindowStartupLocation = WindowStartupLocation.Manual;
         newWin.Left = 23;
         newWin.Top  = 165;
         newWin.Show();
         GlobalVariable.PlayerWindowIsOpened = true;
     }
 }
Пример #2
0
        public void OnElementChanged(IElement newElem,
                                     IControlHtml ctrlHtml)
        {
            // PlayerWindow?.CancelSave();

            if (newElem == null)
            {
                return;
            }

            if (LastElement?.ElementId == newElem.Id)
            {
                return;
            }

            var html = ctrlHtml?.Text ?? string.Empty;

            var ytEl = newElem.Type == ElementType.Topic
              ? YouTubeMediaElement.TryReadElement(html, newElem.Id)
              : null;

            bool noNewElem  = ytEl == null;
            bool noLastElem = LastElement == null || (Svc.SM.Registry.Element[LastElement.ElementId]?.Deleted ?? true);

            if (noNewElem && noLastElem)
            {
                return;
            }

            bool close = LastElement != null && ytEl == null;

            CloseElement();

            OpenElement(ytEl, newElem.Id);

            if (close)
            {
                PlayerWindow?.Close();
            }
        }
        private void CloseWin(object obj)
        {
            PlayerWindow w = (PlayerWindow)obj;

            w.Close();
        }