Click here to Skip to main content
15,880,608 members
Articles / Web Development / HTML

Remofi - Your Own PowerPoint Controller for Mobile Devices

Rate me:
Please Sign up or sign in to vote.
4.86/5 (6 votes)
14 Aug 2011Ms-PL5 min read 29.9K   1K   14  
This article shows you an example of how to control your computer program like PPT through your mobile WIFI device.
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 System.Net;

namespace Remofi
{
    public partial class MainForm : Form
    {
        MicroServerCore msc;
        public MainForm()
        {
            InitializeComponent();
            string hostName = Dns.GetHostName();
            IPAddress[] ipa = Dns.GetHostAddresses(hostName);
            foreach (IPAddress ip in ipa)
            {
                if (ip.ToString().StartsWith("10.") ||
                    ip.ToString().StartsWith("192."))
                {
                    cmbBoxIP.Items.Add(ip);
                    cmbBoxIP.SelectedItem = ip;
                }
            }
            txtPort.Text = "1688";
        }

        private void btnStart_Click(object sender, EventArgs e)
        {
            if (msc != null)
            {
                msc.Stop();
                msc = null;
            }
            else
            {
                try
                {
                    var ip = cmbBoxIP.SelectedItem;
                    msc = new MicroServerCore((IPAddress)cmbBoxIP.SelectedItem, Convert.ToInt32(txtPort.Text));
                    btnStop.Enabled = true;
                    btnStart.Enabled = false;
                    lblMessage.Text =
                        string.Format(@"http://{0}:{1}", 
                            cmbBoxIP.SelectedItem.ToString(), txtPort.Text);
                }
                catch(Exception ex)
                {
                    MessageBox.Show("Initialize failed : {0}", ex.Message);
                }
            }
        }

        private void btnStop_Click(object sender, EventArgs e)
        {
            if (msc != null)
            {
                msc.Stop();
                msc = null;
                btnStart.Enabled = true;
                btnStop.Enabled = false;
            }
            lblMessage.Text = string.Empty;
        }

        private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (msc != null)
            {
                msc.Stop();
                msc = null;
            }
        }
    }
}

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.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)


Written By
Software Developer
China China
My name is Charlie and interested in working on fun projects.

Comments and Discussions