private void reset(int targetId, Sugarism.EOperation op, int value) { if (Common.Instance.IsValidTarget(targetId)) { SelectedItem = TargetList[targetId]; } else { if (null == TargetList) { SelectedItem = null; } else if (TargetList.Length > 0) { SelectedItem = TargetList[0]; } else { SelectedItem = null; } } Op = op; Value = value; }
private void onCmdFeeling(int targetId, Sugarism.EOperation op, int value) { if (targetId != Id) return; operateFeeling(op, value); }
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if ((null == value) || (false == (value is Sugarism.EOperation))) { return(string.Empty); } Sugarism.EOperation c = (Sugarism.EOperation)value; return(c.ToString()); }
private EditFeeling() { _opList = new List <Sugarism.EOperation>(); Array arr = Enum.GetValues(typeof(Sugarism.EOperation)); foreach (var v in arr) { Sugarism.EOperation item = (Sugarism.EOperation)v; _opList.Add(item); } }
/// <summary> /// Show View.Popup.EditFeeling. /// </summary> /// <param name="targetId">Target Id before editing.</param> /// <param name="op">Operation before editing.</param> /// <param name="value">Value before editing.</param> /// <returns>Whether edit or not.</returns> public bool Show(int targetId, Sugarism.EOperation op, int value) { reset(targetId, op, value); View.Popup.EditFeeling view = new View.Popup.EditFeeling(this); bool?result = view.ShowDialog(); switch (result) { case true: return(true); default: return(false); } }
private void operateFeeling(Sugarism.EOperation op, int value) { switch (op) { case Sugarism.EOperation.Add: Feeling += value; break; case Sugarism.EOperation.Subtract: Feeling -= value; break; case Sugarism.EOperation.Assign: Feeling = value; break; default: break; } }
public void Invoke(int targetId, Sugarism.EOperation op, int value) { _event.Invoke(targetId, op, value); }
// default handler private void onCmdFeeling(int targetId, Sugarism.EOperation op, int value) { Log.Debug(string.Format("onCmdFeeling; targetId({0}), op({1}), value({2})", targetId, op, value)); }