예제 #1
0
 public void ShowQueue()
 {
     if (EventGhostPlus.DebugMode) Logger.Debug("Mark message dialog busy");
     EventGhostPlus.DialogBusy = true;
     var QI = new QueueRec();
     while (EventGhostPlus.Queue.Count > 0)
     {
         if (EventGhostPlus.DebugMode) Logger.Debug("Number of messages in queue: " + EventGhostPlus.Queue.Count);
         QI = EventGhostPlus.Queue[0];
         var pDlgNotify =(GUIDialogNotify) GUIWindowManager.GetWindow((int) GUIWindow.Window.WINDOW_DIALOG_NOTIFY);
         if (EventGhostPlus.DebugMode) Logger.Debug("Message Header: " + QI.header);
         pDlgNotify.SetHeading(QI.header);
         if (EventGhostPlus.DebugMode) Logger.Debug("Message Line 1: " + QI.line1);
         if (EventGhostPlus.DebugMode) Logger.Debug("Message Line 2: " + QI.line2);
         pDlgNotify.SetText(QI.line1 + "\n" + QI.line2);
         if (EventGhostPlus.DebugMode) Logger.Debug("Message given image: " + QI.image);
         if (QI.image.Equals(""))
         {
             QI.image = SkinInfo.GetMPThumbsPath() + "EventGhostPlus\\EventGhostPlusIcon.png";
         }
         else
         {
             if (!File.Exists(QI.image))
             {
                 QI.image = SkinInfo.GetMPThumbsPath() + "EventGhostPlus\\EventGhostPlusIcon.png";
             }
         }
         if (EventGhostPlus.DebugMode) Logger.Debug("Message processed image: " + QI.image);
         pDlgNotify.SetImage(QI.image);
         if (EventGhostPlus.DebugMode) Logger.Debug("Message timeout: " + QI.timeout.ToString());
         pDlgNotify.TimeOut = QI.timeout;
         if (EventGhostPlus.DebugMode) Logger.Debug("Showing Message Dialog");
         OnMessageDisplay(QI.header);
         pDlgNotify.DoModal(GUIWindowManager.ActiveWindow);
         OnMessageClose(QI.header);
         if (EventGhostPlus.DebugMode) Logger.Debug("Message dialog closed");
         Logger.Info("Message shown.");
         EventGhostPlus.Queue.Remove(QI);
         if (EventGhostPlus.DebugMode) Logger.Debug("Message removed");
     }
     EventGhostPlus.DialogBusy = false;
     if (EventGhostPlus.DebugMode) Logger.Debug("Mark message dialog free");
 }
예제 #2
0
 void eg_Event_FromNetworkEventSender(object sender, NetWorkEventReceiver_EventArgs e)
 {
     Logger.Info("Message received.");
     if (DebugMode) Logger.Debug("Network Event : " + e.name);
     if (e.name.Equals("MediaPortal.Message"))
     {
         if (e.payload[0] == "EG+BtnSnd")
         {
             if (DebugMode) Logger.Debug("Remote Button Received: " + e.payload[1]);
             inputHandler.MapAction(Convert.ToInt32(e.payload[3]) & 0xFFFF);
         }
         else
         {
             if (DebugMode) Logger.Debug("Payload count: " + e.payload.Count.ToString());
             foreach (string k in e.payload)
             {
                 if (DebugMode) Logger.Debug("  payload = " + k);
             }
             string header = e.payload[0];
             string line1 = e.payload[1];
             string line2 = e.payload[2];
             int timeout = 60;
             string image = "";
             if (e.payload.Count > 3)
             {
                 if (DebugMode) Logger.Debug("More than 3 payloads");
                 if ((e.payload[3] != null) && (e.payload[3] != ""))
                 {
                     timeout = Convert.ToInt16(e.payload[3]);
                 }
                 else
                 {
                     timeout = 60;
                 }
             }
             if (DebugMode) Logger.Debug("Received Message Timeout: " + timeout.ToString());
             if (e.payload.Count > 4)
             {
                 if (DebugMode) Logger.Debug("More than 4 payloads");
                 if ((e.payload[4] != null) && (e.payload[4] != ""))
                 {
                     image = e.payload[4];
                 }
             }
             if (DebugMode) Logger.Debug("ImageLocation: " + image);
             var QI = new QueueRec();
             QI.header = header;
             QI.line1 = line1;
             QI.line2 = line2;
             QI.timeout = timeout;
             QI.image = image;
             if (DebugMode) Logger.Debug("Add Message to Queue");
             Queue.Add(QI);
             if (!EventGhostPlus.DialogBusy)
             {
                 if (DebugMode) Logger.Debug("Dialog is not busy, fire ShowQueue Thread");
                 var Q = new QueueHandler();
                 var QThread = new Thread(Q.ShowQueue);
                 QThread.Start();
             }
         }
     }
 }