Ejemplo n.º 1
0
        private void ok_button_Click(object sender, EventArgs e)
        {
            RadioButton chosen = this.panel1.Controls.OfType <RadioButton>().FirstOrDefault(r => r.Checked);

            if (chosen.Name.Equals(this.Generate_radioButton.Name))
            {
                //Start SelectionForm
            }
            else if (chosen.Name.Equals(this.Existing_radioButton.Name))
            {
                OpenFileDialog fileChooser = GetFileChooser("Browse for Presentation");
                DialogResult   result      = fileChooser.ShowDialog();
                if (result == DialogResult.OK)
                {
                    //Open PowerPoint with the existing presentation
                    Program.REF_APPLICATION  = PowerPointControl.OpenPowerPointApplication();
                    Program.REF_PRESENTATION = PowerPointControl.StartExistingPresentation(ref Program.REF_APPLICATION, fileChooser.FileName);
                    SlideShowObserver observer = new SlideShowObserver(ref Program.REF_APPLICATION, ref Program.REF_PRESENTATION, "http://localhost/powerpointcontrol");
                    //Start API
                    API.Register();
                    //Hide window
                    WindowState = FormWindowState.Minimized;
                }
            }
            else
            {
                throw new NotSupportedException("This functionality should never be reached");
            }
        }
Ejemplo n.º 2
0
        private void SetResource(string filePath, bool loadWithTypeNone = false)
        {
            var typeInfo = FileType.GetFileViewType(filePath);

            if (loadWithTypeNone)
            {
                typeInfo.Type = FileViewType.None;
            }
            if (lastViewType != typeInfo.Type || MyGrid.Children[0] is HelloControl)
            {
                lastViewType = typeInfo.Type;
                MyGrid.Children.Clear();
            }
            else if (MyGrid.Children.Count == 1)
            {
                (MyGrid.Children[0] as FileControl).OnFileChanged((filePath, typeInfo.Ext));
                return;
            }
            FileControl fc;

            switch (typeInfo.Type)
            {
            case FileViewType.Image:
                fc = new ImageControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.Code:
            case FileViewType.Txt:
                fc = new TextControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.Music:
                fc = new MusicControl();
                GlobalNotify.OnResizeMode(false);
                break;

            case FileViewType.Video:
                fc = new VideoControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.Pdf:
                fc = new PdfControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.Excel:
                fc = new ExcelControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.Word:
                fc = new WordControl();
                GlobalNotify.OnResizeMode(true);
                break;

            case FileViewType.PowerPoint:
                fc = new PowerPointControl();
                GlobalNotify.OnResizeMode(true);
                break;

            default:
                fc = new CommonControl();
                GlobalNotify.OnResizeMode(false);
                break;
            }
            if (fc != null)
            {
                LoadFile(fc, filePath, typeInfo.Ext);
            }
        }