private void connect_Click(object sender, EventArgs e)
        {
            System.Net.IPAddress address = null;

            if (System.Net.IPAddress.TryParse(ipAddress.Text, out address))
            {
                Status.Text = "Connecting to " + address.ToString();
                c           = new PJLinkConnection(ipAddress.Text, "JBMIAProjectorLink");

                LampStatusCommand l  = new LampStatusCommand();
                int           hours  = l.getHoursOfLamp(1);
                string        status = l.getStatusOfLamp(1).ToString();
                string        power  = c.powerQuery().ToString();
                ProjectorInfo pi     = new ProjectorInfo();
                Status.Text  = "Connected. \n Projector is now: " + power + "\n" + "\nstatus: " + status + "\nlamphours: " + hours;
                Status.Text += "\nFan:" + pi.FanStatus;
                Status.Text += " Lamp:" + pi.LampStatus;
                Status.Text += " Input:" + pi.Input;
                Status.Text += "\nCover:" + pi.CoverStatus;
                Status.Text += " Filter:" + pi.FilterStatus;
                Status.Text += " NumLamps:" + pi.NumOfLamps;
                Status.Text += "\nOthers:" + pi.PowerStatus;
            }
            else
            {
                Status.Text = "Invalid IP Address Entered";
            }
        }
        private async void btnInfo_Click(object sender, RoutedEventArgs e)
        {
            //try
            {
                string info           = "";
                rv.PJLinkConnection c = connectBeamer();
                info = await c.getProjectorInfo();

                LampStatusCommand lscmd = new LampStatusCommand();
                if (await c.sendCommand(lscmd) == Command.Response.SUCCESS)
                {
                    info += "\n";
                    info += lscmd.dumpToString();
                }

                var view = ApplicationView.GetForCurrentView();
                view.TryResizeView(new Size(328, 250));
                InfoDialog dialog = new InfoDialog(info);
                await dialog.ShowAsync();

                view.TryResizeView(new Size(328, 100));
            }
            //catch (Exception)
            {
            }
        }
예제 #3
0
        public string printProjectorStatus()
        {
            StringBuilder p_objProgress     = new StringBuilder();
            var           l_strFunctionName = "printProjectorStatus()";

            try
            {
                if (m_objProjectorConnection == null)
                {
                    connectToProjector();                                    //Connect now if not connected
                }
                p_objProgress.AppendLine("Attempting to Print the Projector Status");

                LampStatusCommand l_objLamp       = new LampStatusCommand();
                string            l_strLampStatus = l_objLamp.getStatusOfLamp(1).ToString();

                var l_objConnectionStatus = connectToProjector();

                string        l_strPower         = m_objProjectorConnection.powerQuery().ToString();
                ProjectorInfo l_objProjectorInfo = new ProjectorInfo();

                p_objProgress.AppendLine("Connection Status: Connected");
                p_objProgress.AppendLine("");
                p_objProgress.AppendLine("Power Status: " + l_strPower);
                p_objProgress.AppendLine("Fan Status: " + l_objProjectorInfo.FanStatus);
                p_objProgress.AppendLine("Lamp Status: " + l_objProjectorInfo.LampStatus);
                p_objProgress.AppendLine("Current Source Input: " + l_objProjectorInfo.Input);
                p_objProgress.AppendLine("Cover Status: " + l_objProjectorInfo.CoverStatus);
                p_objProgress.AppendLine("Filter Status: " + l_objProjectorInfo.FilterStatus);
                p_objProgress.AppendLine("Current Lamp Status: " + l_strLampStatus);
                p_objProgress.AppendLine("");
            }
            catch (Exception e)
            {
                //Writes the error to the DB then throws the error up.
                throw new Exception(m_objLogger.logToDB(string.Format("{1}: {2}: Error Printing the Projector Status: {2}.", l_strFunctionName, projectorName, e.ToString()), actionStatus.Error, true, p_strFunctionName: "printProjectorStatus()"));
            }
            finally { m_objLogger.writePendingToDB(p_strFunctionName: l_strFunctionName); }

            return(p_objProgress.ToString());
        }