Example #1
0
        /// <summary>
        /// Show the create or join screen
        /// </summary>
        /// <returns>True if we will be in a session, false otherwise</returns>
        public bool DoCreateJoinGame()
        {
            if (deviceAddress != null)
            {
                deviceAddress.Dispose();
            }

            deviceAddress = new Address();

            if (createJoinForm != null)
            {
                createJoinForm.Dispose();
            }

            createJoinForm           = new CreateJoinForm(peerObject, deviceAddress, this);
            createJoinForm.Disposed += new System.EventHandler(this.FormDisposed);

            //Set the address's service provider (this will be the device address)
            deviceAddress.ServiceProvider = serviceProviderGuid;
            DialogResult drCreateJoin = createJoinForm.ShowDialog();

            if (drCreateJoin == DialogResult.Cancel)
            {
                return(false);
            }

            this.isHost = (drCreateJoin == DialogResult.Yes);
            return(true);
        }
Example #2
0
        /// <summary>
        /// Handler for when our form is disposed
        /// </summary>
        public void FormDisposed(object sender, EventArgs e)
        {
            if (sender == createJoinForm)
            {
                createJoinForm = null;
            }

            if (sender == serviceProviderForm)
            {
                serviceProviderForm = null;
            }
        }