Experts
I would like to shuffle windows forms automatically every after 5 mins. windows forms contains Multiple querys , Multiple videos, Multiple powerpoints.
I am having three windows forms, as follows.
Forms 1 code :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Daily_System {
public partial class Form1: Form {
public Form1() {
InitializeComponent();
timer1.Enabled = true;
timer1.Interval = 5000;
timer1.Tick += timer1_Tick;
timer1.Start();
}
private void Form1_Load(object sender, EventArgs e) {
this.WindowState = FormWindowState.Maximized;
CenterToScreen();
}
private Timer timer1 = new Timer();
private void button1_Click_1(object sender, EventArgs e) {
this.WindowState = FormWindowState.Minimized;
Form2 f = new Form2(); // This is bad
timer2.Enabled = true;
}
private void timer2_Tick(object sender, EventArgs e) {
button1.PerformClick();
}
}
}
Forms 2: Microsoft Powerpoint file
multiple powerpoint files from network folder(path)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using Core = Microsoft.Office.Core;
namespace Daily_System {
public partial class Form2: Form {
public Form2() {
InitializeComponent();
this.WindowState = FormWindowState.Minimized;
timer1.Enabled = true;
timer1.Interval = 15000;
timer1.Start();
}
private void Tick(object sender, EventArgs e) {
Form3 Next = new Form3();
Next.Show();
this.Hide();
timer1.Stop(); //Stop timer after tick once
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.BeginInvoke(new MethodInvoker(delegate() {
button1.PerformClick();
}));
}
private void button1_Click(object sender, EventArgs e) {
Microsoft.Office.Interop.PowerPoint.Application pptApp = new Microsoft.Office.Interop.PowerPoint.Application();
Microsoft.Office.Core.MsoTriState ofalse = Microsoft.Office.Core.MsoTriState.msoFalse;
Microsoft.Office.Core.MsoTriState otrue = Microsoft.Office.Core.MsoTriState.msoTrue;
pptApp.Visible = otrue;
pptApp.Activate();
Microsoft.Office.Interop.PowerPoint.Presentations ps = pptApp.Presentations;
var opApp = new Microsoft.Office.Interop.PowerPoint.Application();
pptApp.SlideShowEnd += PpApp_SlideShowEnd;
var ppPresentation = ps.Open(@ "C:\Users\ok\Downloads\Parks-WASD2017.pptx", ofalse, ofalse, otrue);
var settings = ppPresentation.SlideShowSettings;
settings.Run();
}
private void PpApp_SlideShowEnd(Microsoft.Office.Interop.PowerPoint.Presentation Pres) {
Pres.Saved = Microsoft.Office.Core.MsoTriState.msoTrue;
Pres.Close();
}
private void Form2_Load(object sender, EventArgs e) {
}
private void button2_Click(object sender, EventArgs e) {
this.WindowState = FormWindowState.Minimized;
Form3 f = new Form3(); // This is bad
f.Show(); /// f.Show();
timer1.Enabled = true;
this.Hide();
timer1.Stop(); //Stop timer after tick once
}
private void timer1_Tick_1(object sender, EventArgs e) {
button2.PerformClick();
}
}
}
Forms 3: Multiple video files (MP4,FLV,MOV,etc)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Daily_System {
public partial class Form3: Form {
public Form3() {
InitializeComponent();
timer1.Enabled = true;
timer1.Interval = 15000;
timer1.Start();
}
private void Form3_Load(object sender, EventArgs e) {
axWindowsMediaPlayer1.settings.autoStart = true;
}
private void axWindowsMediaPlayer1_Enter_1(object sender, EventArgs e) {
axWindowsMediaPlayer1.URL = @ "C:\Users\ok\Downloads\ok.mp4";
}
private void button1_Click(object sender, EventArgs e) {
this.WindowState = FormWindowState.Minimized;
Form1 f = new Form1(); // This is bad
f.Show(); /// f.Show();
timer1.Enabled = true;
this.Hide();
timer1.Stop(); //Stop timer after tick once
}
private void timer1_Tick_1(object sender, EventArgs e) {
button1.PerformClick();
}
}
}
Multiple video files from network folder(Path)
Requirement:
Each forms should change and display every after 5 min.
example : first form1 should display then after 5 mins form1 should minimized and form2 should show the slideshow and then after 5 mins form2 should minimized and form3 should play the video and then after 5 mins form3 should minimized and pause the video then form1 should display.
It should keep doing the same steps as above.
Final condition: All forms should stop exactly at 6 pm(Everyday) and it should start automatically at 7 am (Everyday).
Please advise...