Пример #1
0
        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;
        }
Пример #2
0
        private void onCmdFeeling(int targetId, Sugarism.EOperation op, int value)
        {
            if (targetId != Id)
                return;

            operateFeeling(op, value);
        }
Пример #3
0
        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());
        }
Пример #4
0
        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);
            }
        }
Пример #5
0
        /// <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);
            }
        }
Пример #6
0
        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;
            }
        }
Пример #7
0
 public void Invoke(int targetId, Sugarism.EOperation op, int value) { _event.Invoke(targetId, op, value); }
Пример #8
0
 // 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));
 }