public void SaveGesture() { if (_newGesture) { Id = _provider.SaveNewDynamicGestureClass(Name, null); // Need to get id } var editedGesture = new DGClass(Instances); var sampleInstance = (Instances.Any()) ? Instances.FirstOrDefault().Instance : null; var gestureWrapper = new DGClassWrapper() { Id = this.Id, Name = this.Name, Gesture = editedGesture, SampleInstance = sampleInstance }; _provider.SaveDynamicGestureClass(gestureWrapper); if (Changeset.ChangesExist()) { // Update the StaticGestureInstances table foreach (int instanceId in Changeset.DeletedGestureInstances) { _provider.DeleteDynamicGestureInstance(instanceId); } foreach (var instance in Changeset.NewGestureInstances) { _provider.SaveNewDynamicGestureInstance(Id, instance.Instance); } } _mvm.UpdateDynamicGestureLibrary(); }
public void SaveGesture() { Dictionary <string, int> featureWeightsDict = null; if (_newGesture) { Id = _provider.SaveNewStaticGestureClass(Name, null); // Need to get id } else { // Fill featureWeightsDict featureWeightsDict = new Dictionary <string, int>(); foreach (var fw in FeatureWeights) { featureWeightsDict.Add(fw.Name, fw.Weight); } } var editedGesture = new SGClass(Instances, featureWeightsDict); var sampleInstance = (Instances.Any()) ? Instances.FirstOrDefault().Gesture : null; var gestureWrapper = new SGClassWrapper() { Id = this.Id, Name = this.Name, Gesture = editedGesture, SampleInstance = sampleInstance }; _provider.SaveStaticGestureClass(gestureWrapper); if (Changeset.ChangesExist()) { // Update the StaticGestureInstances table foreach (int instanceId in Changeset.DeletedGestureInstances) { _provider.DeleteStaticGestureInstance(instanceId); } foreach (var instance in Changeset.NewGestureInstances) { _provider.SaveNewStaticGestureInstance(Id, instance.Gesture); } } _mvm.UpdateStaticGestureLibrary(); }