private void Save() { var name = MicroserviceName.Text; if (string.IsNullOrEmpty(name)) { MessageBox.Show("ConfigM Manifest Name is required"); IsEditing = false; IsNew = false; SaveButton.IsEnabled = false; return; } if (IsNew) { _newModel = new Manifest { name = MicroserviceName.Text, description = MicroserviceDesc.Text, cachettl = Convert.ToInt32(MicroserviceCacheTTL.Text), modified = DateTime.Now, version = "1.0" }; // Attributes var attributes = AttributeEditor.Items.Cast<Attribute>().ToList(); foreach (var a in attributes.Where(a => a.name != "<New>")) { _newModel.lineitems[a.name] = a.value; } _configM.Create(_newModel); SaveDialog saved = new SaveDialog(); saved.Text = string.Format("{0} saved", _newModel.name); saved.ShowDialog(); } else { var index = MicroserviceList.SelectedIndex; _curManifest = _manifests.list[index]; _curManifest.name = MicroserviceName.Text; _curManifest.description = MicroserviceDesc.Text; _curManifest.cachettl = Convert.ToInt32(MicroserviceCacheTTL.Text); _curManifest.modified = DateTime.Now; _curManifest.version = MicroserviceVersion.Text; // Attributes var attributes = AttributeEditor.Items.Cast<Attribute>().ToList(); foreach (var a in attributes.Where(a => a.name != "<New>")) { _curManifest.lineitems[a.name] = a.value; } _configM.Update(_curManifest); SaveDialog saved = new SaveDialog(); saved.Text = string.Format("{0} saved", _curManifest.name); saved.ShowDialog(); } IsEditing = false; IsNew = false; SaveButton.IsEnabled = false; InitializeUx(); }
private void Save() { var name = MicroserviceName.Text; if (string.IsNullOrEmpty(name)) { MessageBox.Show("ConfigM Manifest Name is required"); IsEditing = false; IsNew = false; SaveButton.IsEnabled = false; return; } if (IsNew) { _newModel = new Manifest { name = MicroserviceName.Text, description = MicroserviceDesc.Text, cachettl = Convert.ToInt32(MicroserviceCacheTTL.Text), modified = DateTime.Now, version = "1.0" }; // Attributes var attributes = AttributeEditor.Items.Cast <Attribute>().ToList(); foreach (var a in attributes.Where(a => a.name != "<New>")) { _newModel.lineitems[a.name] = a.value; } _configM.Create(_newModel); SaveDialog saved = new SaveDialog(); saved.Text = string.Format("{0} saved", _newModel.name); saved.ShowDialog(); } else { var index = MicroserviceList.SelectedIndex; _curManifest = _manifests.list[index]; _curManifest.name = MicroserviceName.Text; _curManifest.description = MicroserviceDesc.Text; _curManifest.cachettl = Convert.ToInt32(MicroserviceCacheTTL.Text); _curManifest.modified = DateTime.Now; _curManifest.version = MicroserviceVersion.Text; // Attributes var attributes = AttributeEditor.Items.Cast <Attribute>().ToList(); foreach (var a in attributes.Where(a => a.name != "<New>")) { _curManifest.lineitems[a.name] = a.value; } _configM.Update(_curManifest); SaveDialog saved = new SaveDialog(); saved.Text = string.Format("{0} saved", _curManifest.name); saved.ShowDialog(); } IsEditing = false; IsNew = false; SaveButton.IsEnabled = false; InitializeUx(); }