Exemplo n.º 1
0
        /// <summary>
        /// Click Accept triggers attempt to connect to server
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Accept1_Click(object sender, EventArgs e)
        {
            servername = ServerInput1.Text + ".eng.utah.edu";

            // Attempt to connect to the server.  We want this blocking and to only exit upon success.
            Networking.ConnectToServer(Connected, servername);

            System.Threading.Thread.Sleep(800);

            if (warden != null) /* <<< Replace with connection success bool*/
            // If connection successful, open Document Name Dialog and close this window
            {
                SpreadsheetContext.getAppContext().RunForm(new DocNameDialog(warden));

                Close();
            }
            else
            {
                // connection failed should let the user know that something went wrong
                DialogResult badConnect = MessageBox.Show("Connection to Server failed.",
                                                          "Connection Failure Warning",
                                                          MessageBoxButtons.OK,
                                                          MessageBoxIcon.Warning);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Returns the one ApplicationContext.
 /// </summary>
 public static SpreadsheetContext getAppContext()
 {
     if (appContext == null)
     {
         appContext = new SpreadsheetContext();
     }
     return(appContext);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Click Open Handeler.  Sends the file name to the server and to the spreadsheet for the header.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Open1_Click(object sender, EventArgs e)
        {
            filename = OpenInput1.Text + ".sprd"; // may want to do some error checking here (don't want .sprd.sprd)

            // open a new Spreadsheet form and apply filename as header.
            SpreadsheetContext.getAppContext().RunForm(new SSForm(warden, filename));

            Close();
        }
Exemplo n.º 4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Start an application context and run one form inside it
            SpreadsheetContext appContext = SpreadsheetContext.getAppContext();

            appContext.RunForm(new ConnectionDialog());
            Application.Run(appContext);
        }
Exemplo n.º 5
0
 /// <summary>
 /// When you select New it will create an empty spreadsheet windows application.
 /// Using the first SSForm constructor.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     SpreadsheetContext.getAppContext().RunForm(new ConnectionDialog());
 }