private void PerformItemSave(object sender, EventArgs e) { ConfigurationItem childItem = ((Control)sender).Tag as ConfigurationItem; if (childItem == null) { return; } try { ValidateResult result = _configApiClient.ValidateItem(childItem); if (result.ValidatedOk) { _configApiClient.SetItem(childItem); // Reload parent item _item = _configApiClient.GetItem(_item.Path); } else { if (result.ErrorResults.Any()) { MessageBox.Show(result.ErrorResults[0].ErrorText, "Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } catch (Exception ex) { MessageBox.Show("Unable to Save:" + ex.Message); } InitalizeUI(); }
public void Init() { ConfigurationItem privacyFolder = _configApiClient.GetItem(_item.ParentPath); ConfigurationItem camera = _configApiClient.GetItem(privacyFolder.ParentPath); Property cameraId = camera.Properties.FirstOrDefault <Property>(p => p.Key == "Id"); Item cameraItem = Configuration.Instance.GetItem(new Guid(cameraId.Value), Kind.Camera); _bitmapSource = new BitmapSource(); _bitmapSource.Init(); _bitmapSource.Item = cameraItem; _bitmapSource.NewBitmapEvent += BitmapSource_NewBitmapEvent; _bitmapSource.LiveStart(); }