|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CodeProject;
namespace PassingValuesAcrossProjectsUsingInterface
{
public partial class MainController : Form, GlobalInterface.iSatellite
{
TweenLibrary tween;
Random destXY = new Random(DateTime.Now.Millisecond);
List<Form> forms;
public MainController()
{
InitializeComponent();
InitializeControls();
InitializeControlEvents();
}
public void InitializeControls()
{
PlanetEarth.Form1 earth = new PlanetEarth.Form1();
earth.InitializeSatellite(this);
earth.Show();
PlanetMars.Form1 mars = new PlanetMars.Form1();
mars.InitializeSatellite(this);
mars.Show();
PlanetSaturn.Form1 saturn = new PlanetSaturn.Form1();
saturn.InitializeSatellite(this);
saturn.Show();
forms = new List<Form>()
{
earth, mars, saturn
};
tween = new TweenLibrary();
timer1.Interval = Convert.ToInt32(TimeSpan.FromSeconds(3).TotalMilliseconds);
timer1.Tick += new EventHandler(timer1_Tick);
timer1.Start();
}
public void InitializeControlEvents()
{
this.LocationChanged += new EventHandler(Form1_LocationChanged);
}
/// <summary>
/// update child form positions
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void Form1_LocationChanged(object sender, EventArgs e)
{
int last_y = this.Location.Y;
foreach (Form frm in forms)
{
frm.Location = new Point(this.Location.X + this.Size.Width, last_y);
last_y = frm.Location.Y + frm.Size.Height;
}
}
void timer1_Tick(object sender, EventArgs e)
{
this.NextPosition = new Point()
{
X = destXY.Next(this.ClientSize.Width),
Y = destXY.Next(this.ClientSize.Height)
};
tween.startTweenEvent(picSatellite, this.NextPosition.X, this.NextPosition.Y, "easeinoutcubic", 100);
}
/// <summary>
/// Implement GlobalInterface.iSatellite property
/// </summary>
public Point NextPosition { get; set; }
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am an experienced Applications Developer and had worked professionally for over 6 years. I have been writing codes and building different applications for over 13+ years. My work is mostly for Microsoft technologies such as .NET. Yes I am Microsoft technology enthusiast.
My field of expertise in .NET technology are Desktop and Windows Mobile and Windows Phone. I occasionally write ASP.NET too for clients.
I have wide experience of different programming languages and scripts such as: Turbo Pascal, Batch Scripts, C/C++, Visual Basic Classic, Visual Basic .NET, Java, HTML, CSS, ASP Classic, VB Script, ASP.NET, T-SQL, MySQL, PHP, C#, Javascript, jQuery, HTML5, RegEx, XAML, XML, JSON, and XPath
I am also experienced in different platforms such as: Google Data API, Google Map API, Twitter API, Facebook API, Flickr API, Skydrive API, SVN, GitHub, Drupal, and Orchard.
I am interested in Microsoft technologies, User Experience and User Interfaces, Algorithms, Robotics, Astronomy, Architecture, Electrical, Mechanics, and Extra Therestrial Life on other planets.
I am also offering free coding and application development consultations with students having a problem with their Thesis projects.
View my full Curriculum Vitae here
http://ss.jaysonragasa.net/?mycv