Exemple #1
0
      /// <summary>
      /// This will load the file and pass the text to the editor.
      /// </summary>
      /// <param name="sender"></param>
      /// <param name="e"></param>
      private void submnuLoad_Click(object sender, RoutedEventArgs e)
      {
          Stream myStream = null;
          OpenFileDialog openFileDialog1 = new OpenFileDialog();

          openFileDialog1.InitialDirectory = "c:\\";
          openFileDialog1.Filter = "ssf files (*.ssf)|*.ssf|All files (*.*)|*.*";
          openFileDialog1.FilterIndex = 1;
          openFileDialog1.RestoreDirectory = true;
          String text = "";

          if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
          {
              try
              {
                  if ((myStream = openFileDialog1.OpenFile()) != null)
                  {
                      StreamReader sr = new StreamReader(openFileDialog1.FileName);
                      using(sr)
                      {
                          string line;
                          while ((line = sr.ReadLine()) != null)
                              text = text + line + "\n";
                      }
                  }
                  ProgWin editor = new ProgWin(ProgWin.editorType.owner);
                  editor.Show();
                  editor.loadProgram(0, 0, text);
                  editor.setUserList(userList);
              }
              catch (Exception ex)
              {
                  System.Windows.MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message);
              }
          }

      }
Exemple #2
0
 private void submnuNew_Click(object sender, RoutedEventArgs e)
 {
   ProgWin editor = new ProgWin(ProgWin.editorType.owner);
   //owner is the user itself. so pass the username here
   //list of the users in swarm
   //take the program name and send the program name
   editor.Show();
   editor.setUserList(userList);
 }