Example #1
0
 private void storeUsersButton_Click(object sender, System.EventArgs e)
 {
     try {
         AdministrationClient.UpdateAlgorithmUsers(Content.Id, refreshableLightweightUserView.GetCheckedUsers().Select(x => x.Id).ToList());
         storeUsersButton.Enabled = false;
     }
     catch (Exception ex) {
         ErrorHandling.ShowErrorDialog(this, "Store authorized users and groups failed.", ex);
     }
 }
Example #2
0
 private void storeDataButton_Click(object sender, EventArgs e)
 {
     CallAsync(
         () => {
         if (dataViewHost.Content != null)
         {
             using (MemoryStream stream = new MemoryStream()) {
                 XmlGenerator.Serialize(dataViewHost.Content, stream);
                 stream.Close();
                 data = stream.ToArray();
             }
         }
         AdministrationClient.UpdateProblemData(Content.Id, data);
     },
         "Store problem data failed.",
         null
         );
 }
Example #3
0
        private void RemoveItems(IEnumerable <T> items, out IEnumerable <T> successful, out IEnumerable <T> unsuccessful, out Exception exception)
        {
            List <T> removed    = new List <T>();
            List <T> notremoved = new List <T>();

            exception = null;
            foreach (T item in items)
            {
                try {
                    AdministrationClient.Delete(item);
                    removed.Add(item);
                }
                catch (Exception ex) {
                    exception = ex;
                    notremoved.Add(item);
                }
            }
            successful   = removed;
            unsuccessful = notremoved;
        }
Example #4
0
 private void storeDataButton_Click(object sender, EventArgs e)
 {
     CallAsync(
         () => {
         if (dataViewHost.Content != null)
         {
             using (MemoryStream stream = new MemoryStream()) {
                 IAlgorithm algorithm = dataViewHost.Content as IAlgorithm;
                 algorithm.Prepare(true);
                 XmlGenerator.Serialize(algorithm, stream);
                 stream.Close();
                 data = stream.ToArray();
             }
         }
         AdministrationClient.UpdateAlgorithmData(Content.Id, data);
     },
         "Store algorithm data failed.",
         null
         );
 }
Example #5
0
 private void refreshDataButton_Click(object sender, EventArgs e)
 {
     CallAsync(
         () => {
         data = null;
         dataViewHost.Content = null;
         data = AdministrationClient.GetAlgorithmData(Content.Id);
         if (data != null)
         {
             using (MemoryStream stream = new MemoryStream(data)) {
                 try {
                     dataViewHost.Content = XmlParser.Deserialize <IContent>(stream);
                 }
                 catch (Exception) { }
                 stream.Close();
             }
         }
     },
         "Refresh algorithm data failed.",
         () => SetEnabledStateOfControls()
         );
 }
Example #6
0
        protected override void OnContentChanged()
        {
            base.OnContentChanged();

            platformComboBox.SelectedValueChanged -= new EventHandler(platformComboBox_SelectedValueChanged);
            if (AdministrationClient.Instance.Platforms != null)
            {
                platformComboBoxValues = AdministrationClient.Instance.Platforms.ToList();
            }
            platformComboBox.DataSource            = platformComboBoxValues;
            platformComboBox.SelectedValueChanged += new EventHandler(platformComboBox_SelectedValueChanged);

            algorithmClassComboBox.SelectedValueChanged -= new EventHandler(algorithmClassComboBox_SelectedValueChanged);
            if (AdministrationClient.Instance.AlgorithmClasses != null)
            {
                algorithmClassComboBoxValues = AdministrationClient.Instance.AlgorithmClasses.ToList();
            }
            algorithmClassComboBox.DataSource            = algorithmClassComboBoxValues;
            algorithmClassComboBox.SelectedValueChanged += new EventHandler(algorithmClassComboBox_SelectedValueChanged);

            data = null;
            dataViewHost.Content = null;
            if (Content == null)
            {
                platformComboBox.SelectedIndex                    = -1;
                algorithmClassComboBox.SelectedIndex              = -1;
                dataTypeNameTextBox.Text                          = string.Empty;
                dataTypeTypeNameTextBox.Text                      = string.Empty;
                refreshableLightweightUserView.Content            = null;
                refreshableLightweightUserView.FetchSelectedUsers = null;
            }
            else
            {
                platformComboBox.SelectedItem                     = platformComboBoxValues.FirstOrDefault(p => p.Id == Content.PlatformId);
                algorithmClassComboBox.SelectedItem               = algorithmClassComboBoxValues.FirstOrDefault(a => a.Id == Content.AlgorithmClassId);
                dataTypeNameTextBox.Text                          = Content.DataTypeName;
                dataTypeTypeNameTextBox.Text                      = Content.DataTypeTypeName;
                refreshableLightweightUserView.Content            = Access.AccessClient.Instance;
                refreshableLightweightUserView.FetchSelectedUsers = new Func <List <Guid> >(delegate { return(AdministrationClient.GetAlgorithmUsers(Content.Id)); });
            }
        }
Example #7
0
 public void Store()
 {
     AdministrationClient.Store(this);
     Modified = false;
 }