Exemplo n.º 1
0
        private void btnCreateProjection_Click(object sender, EventArgs e)
        {
            if (grid.RowCount == 0)
            {
                MessageBox.Show(this, "Please add a screen first using 'Add Screen'!", "Projection", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            ProjectionCreator pc = new ProjectionCreator();

            pc.ShowDialog(this);
            ProjectionObj projection = (ProjectionObj)pc.Tag;

            if (projection == null)
            {
                return;
            }
            //Ret: Name,Resolution,IP
            string data = ShowSelector();

            if (data == null)
            {
                return;
            }
            string[] splData = data.Split(',');
            string   ip      = splData[2];

            DisplayClient client = new DisplayClient();

            client.Connect(ip);
            client.SendProjection(projection);
            client.Disconnect();
            client = null;
        }
Exemplo n.º 2
0
        private void AddDisplay(string ip)//string name, Image img)
        {
            for (int i = 0; i < grid.RowCount; i++)
            {
                if (grid.Rows[i].Tag.Equals(ip))
                {
                    return;
                }
            }


            int    id         = grid.Rows.Add();
            string name       = "--Offline--";
            string resolution = "--Offline--";

            //Connection Test
            Probe probe       = new Probe();
            bool  isConnected = probe.TestIP(ip, true);

            grid.Rows[id].Tag = ip;
            if (isConnected)
            {
                grid.Rows[id].Cells[0].Value = Projection_Client.Properties.Resources.connected_sm;
                DisplayClient dc = new DisplayClient();
                dc.Connect(ip);
                name       = dc.RequestName();
                resolution = dc.RequestResolution();
                dc.Disconnect();
            }
            else
            {
                grid.Rows[id].Cells[0].Value = Projection_Client.Properties.Resources.disconnected_sm;
            }
            //gridDisplays.Rows[id].Cells[0].Style.Alignment = DataGridViewContentAlignment.MiddleLeft;
            grid.Rows[id].Cells[1].Value = name;
            grid.Rows[id].Cells[2].Value = resolution;
            //gridDisplays.Rows[id].Tag
            File.AppendAllText("screens.txt", ip + "\n");
        }
Exemplo n.º 3
0
        private void btnImportSlides_Click(object sender, EventArgs e)
        {
            #if MSO_BUILD
            if (gridDisplays.RowCount == 0)
            {
                MessageBox.Show(this, "Please add a screen first using 'Add Screen'!", "Projection", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            //Ret: Name,WidthxHeight,IP
            string screen = ShowSelector();
            if (screen == null)
            {
                return;
            }
            string[] splData = screen.Split(',');
            int      width   = int.Parse(splData[1].Split('x')[0]);
            int      height  = int.Parse(splData[1].Split('x')[1]);
            string   ip      = splData[2];

            if (screen == null)
            {
                return;
            }

            //string selScreenRes = screen.Substring(screen.IndexOf("[") + 1);
            //selScreenRes = selScreenRes.Substring(0, selScreenRes.Length - 1);
            //int width = int.Parse(selScreenRes.Split('x')[0]);
            //int height = int.Parse(selScreenRes.Split('x')[1]);

            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "Power Point|*.pptx|All Files|*.*";
            ofd.ShowDialog();
            if (String.IsNullOrEmpty(ofd.FileName))
            {
                return;
            }
            ApplicationClass pptApp = new ApplicationClass();

            Presentation pres = pptApp.Presentations.Open(ofd.FileName, MsoTriState.msoFalse,
                                                          MsoTriState.msoFalse, MsoTriState.msoFalse);

            List <string> files = new List <string>();
            for (int i = 1; i <= pres.Slides.Count; i++)
            {
                string file = Environment.CurrentDirectory + @"\slide" + i + ".png";
                files.Add(file);
                pres.Slides[i].Export(file, "PNG", width, height);
            }
            ProjectionCreator pc = new ProjectionCreator(files);
            pc.ShowDialog(this);
            if (pc.Tag == null)
            {
                return;
            }
            Projection    proj   = (Projection)pc.Tag;
            DisplayClient client = new DisplayClient();
            client.Connect(ip);
            client.SendProjection(proj);
            client.Disconnect();
            client = null;
            //MessageBox.Show(client.RequestProjectionManager().GetName());
            #endif
        }