Exemple #1
0
 /// <summary>
 /// Returns the one DemoApplicationContext.
 /// </summary>
 public static NewApplicationContext getAppContext()
 {
     if (appContext == null)
     {
         appContext = new NewApplicationContext();
     }
     return appContext;
 }
Exemple #2
0
     static void Main()
     {
     
    
     Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         // Start an application context and run one form inside it
         NewApplicationContext appContext = NewApplicationContext.getAppContext();
         appContext.RunForm(new Form1());
         Application.Run(appContext);
 }
Exemple #3
0
        private void OpenOldSpreadsheet(String[] messageTokens, String FileName)
        {
            this.Invoke((MethodInvoker)(() =>
            {
                Form1 newForm = new Form1(serverAddress);
                NewApplicationContext.getAppContext().RunForm(newForm);
                newForm.docID = int.Parse(messageTokens[1]);
                newForm.sheet = new Spreadsheet(s => true, Normalize, this.docID.ToString());
                newForm.spreadsheetPanel1.Enabled = true;
                newForm.button1.Enabled = true;
                newForm.ContentsBox.Enabled = true;
                newForm.spreadsheetPanel1.SelectionChanged += SpreadsheetPanel1_Selection;
                newForm.spreadsheetPanel1.SetSelection(0, 0);
                newForm.AddressLabel.Text = "A1:";
                newForm.Text = FileName;
                //if(newForm != null)
                //    Dictionary.Add(newForm.docID, newForm);

                //adds al the items in the spreadsheet file into the spreadsheet grid
                //char[] alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
                //List<char> list = alpha.ToList<char>();
                //for (int i = 2; i < messageTokens.Length; i++)
                //{

                //    string[] cellValue = messageTokens[i].Split(new Char[] { '\r' }, StringSplitOptions.RemoveEmptyEntries); ;

                //    string name = cellValue[0];
                //    string contents = sheet.GetCellContents(name).ToString();
                //    string value = sheet.GetCellValue(name).ToString();

                //    int col = list.IndexOf(char.Parse(name.Substring(0, 1)));
                //    int row = int.Parse(name.Substring(1, 1));

                //    spreadsheetPanel1.SetValue(col, row - 1, value);
                //}

                MessageBox.Show(null, "Spreadsheet created successfully, you can now edit.", "Spreadsheet Created Successfully", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }));
        }
Exemple #4
0
 /// <summary>
 /// Creates a new spreadsheet
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e">event</param>
 private void newToolStripMenuItem_Click(object sender, EventArgs e)
 {
     NewApplicationContext.getAppContext().RunForm(new Form1());
 }