Exemple #1
0
 public void refreshScreen()
 {
     if (cursorAt + 1 < menu.GetLength(0))
     {
         imon.setText("> " + menu[cursorAt, 0], "  " + menu[cursorAt + 1, 0]);
     }
     else
     {
         imon.setText("> " + menu[cursorAt, 0], "");
     }
 }
        private void init(string textLine, bool swapAfterEveryCycle)
        {
            InitializeComponent();

            this.ShowInTaskbar = false;
            notifyIcon.Visible = true;
            this.WindowState   = FormWindowState.Minimized;

            imon = new iMon();
            imon.initialise();
            imon.setRefreshRate(refreshRate);
            imon.setScrollDelay(scrollDelay);
            imon.setText(textLine, swapAfterEveryCycle);

            tmrFormRefreshRate.Interval = refreshRate;
            tmrFormRefreshRate.Enabled  = true;
        }
        public KodiMediaInfo()
        {
            InitializeComponent();

            this.ShowInTaskbar = false;
            notifyIcon.Visible = true;
            btnConnect.Enabled = false;
            this.WindowState   = FormWindowState.Minimized;

            imon = new iMon();
            imon.initialise();
            imon.setRefreshRate(imonRefreshRate);
            imon.setScrollDelay(scrollDelay);
            imon.setText("Connecting with", "Kodi...");

            kodi = new Kodi();

            tmrFormRefreshRate.Interval = imonRefreshRate;
            tmrKodiRefreshRate.Interval = kodiRefreshRate;
            tmrFormRefreshRate.Enabled  = true;
            tmrKodiRefreshRate.Enabled  = true;
        }
        private void tmrKodiRefreshRate_Tick(object sender, EventArgs e)
        {
            KodiActivePlayers activePlayers = kodi.getActivePlayers();
            string            line1         = " ";
            string            line2         = " ";

            if (activePlayers.error != null && activePlayers.error.Length > 0)
            {
                line1 = activePlayers.error;
                tmrKodiRefreshRate.Enabled = false;
                btnConnect.Enabled         = true;
            }
            else
            {
                if (activePlayers.result.Length > 0)
                {
                    int playerid = getPlayerId(activePlayers);
                    KodiGetProperties propertiesResponse = kodi.getProperties(playerid);
                    for (int i = 0; i < activePlayers.result.Length; i++)
                    {
                        if (activePlayers.result[i].type == "video" && activePlayers.result[i].playerid == playerid)
                        {
                            KodiResponse itemResponse = kodi.getVideoItem(playerid);
                            line2 = propertiesResponse.result.time.ToString() + "  " + propertiesResponse.result.totaltime.ToString();
                            if (itemResponse.result.item.type == "movie")
                            {
                                line1 = itemResponse.result.item.movieToString();
                            }
                            else if (itemResponse.result.item.type == "episode")
                            {
                                line1 = itemResponse.result.item.episodeToString();
                            }
                            else if (itemResponse.result.item.type == "musicvideo")
                            {
                                line1 = itemResponse.result.item.musicvideoToString();
                            }
                            else if (itemResponse.result.item.type == "unknown")
                            {
                                line1 = itemResponse.result.item.unknownTypeToString();
                            }
                        }
                        else if (activePlayers.result[i].type == "audio" && activePlayers.result[i].playerid == playerid)
                        {
                            KodiResponse itemResponse = kodi.getAudioItem(playerid);
                            line2 = propertiesResponse.result.time.ToString() + "  " + propertiesResponse.result.totaltime.ToString();
                            if (itemResponse.result.item.type == "song")
                            {
                                line1 = itemResponse.result.item.songToString();
                            }
                        }
                        else if (activePlayers.result[i].type == "picture" && activePlayers.result[i].playerid == playerid)
                        {
                            KodiResponse itemResponse = kodi.getPictureItem(playerid);
                            if (itemResponse.result.item.type == "picture")
                            {
                                line1 = itemResponse.result.item.pictureToString();
                            }
                        }
                    }
                }
            }
            imon.setText(line1, line2);
        }
Exemple #5
0
 private void btnSend_Click(object sender, EventArgs e)
 {
     imon.setText(txtInputLine1.Text, txtInputLine2.Text);
 }