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; }
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 }