private void AddMissingPlatformsButton_Click(object sender, EventArgs e)
 {
     AddMissingPlatformsButton.Enabled = false;
     AddMissingPlatformsButton.Text    = "Working...";
     Cursor.Current = Cursors.WaitCursor;
     Application.DoEvents();
     try
     {
         string error;
         var    programPlatforms = ArgosWebSite.GetPlatformList(Program.UserName, Program.Password, out error);
         var    addedNewPlatform = false;
         if (error != null)
         {
             MessageBox.Show("Argos Web Server returned an error" + Environment.NewLine + error, "Server Error",
                             MessageBoxButtons.OK, MessageBoxIcon.Error);
             return;
         }
         foreach (var item in programPlatforms)
         {
             if (item.Item1 == Program.ProgramId)
             {
                 if (Program.ArgosPlatforms.All(p => p.PlatformId != item.Item2))
                 {
                     var platform = new ArgosPlatform
                     {
                         ArgosProgram = Program,
                         PlatformId   = item.Item2,
                         Active       = true
                     };
                     Database.ArgosPlatforms.InsertOnSubmit(platform);
                     addedNewPlatform = true;
                 }
             }
         }
         if (addedNewPlatform && SubmitChanges())
         {
             PlatformDataChanged();
         }
     }
     finally
     {
         AddMissingPlatformsButton.Enabled = true;
         AddMissingPlatformsButton.Text    = "Add Missing Platforms";
         Cursor.Current = Cursors.Default;
     }
 }
Пример #2
0
        public static void TestGetPlatformList()
        {
            string error;
            var    result = ArgosWebSite.GetPlatformList("xxx", "xxx", out error);

            if (error != null)
            {
                Console.WriteLine(error);
            }
            else
            {
                foreach (var tuple in result)
                {
                    Console.WriteLine("Program: {0}, Platform: {1}", tuple.Item1, tuple.Item2);
                }
            }
        }