public void Commit() { if (_profile == null) { return; } _profile.ClearAssigns(); this.Assigns.Where(a => !String.IsNullOrEmpty(a.Action)) .GroupBy(a => a.Group) .ForEach(g => g.GroupBy(a => Tuple.Create(a.Key, a.Modifier)) .Select(a => new KeyAssign(a.Key.Item1, a.Key.Item2, a.Select(m => new KeyAssignActionDescription { ActionName = m.Action, Argument = String.IsNullOrEmpty(m.Argument) ? null : m.Argument }))) .ForEach(a => this._profile.SetAssign(g.Key, a))); _profile.Save(KeyAssignManager.KeyAssignsProfileDirectoryPath); }
public void AddNewKeyAssign() { var response = this.Messenger.GetResponse(new TransitionMessage(typeof(AddNewKeyAssignWindow), new AddNewKeyAssignDialogViewModel(), TransitionMode.Modal)); var tranvm = (AddNewKeyAssignDialogViewModel)response.TransitionViewModel; if (tranvm.Result) { var assign = new KeyAssignProfile(tranvm.FileName); if (tranvm.IsCreateAsCopy) { assign.SetAssigns( KeyAssignManager.CurrentProfile .ToString() .Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries)); } assign.Save(KeyAssignManager.KeyAssignsProfileDirectoryPath); RefreshKeyAssignCandidates(); } }