Example #1
0
        void EditModeOff(object sender, dynamic e)
        {
            if (_spread.ActiveSheet == null || _spread.ActiveSheet.ActiveCell == null)
            {
                return;
            }

            var text = _spread.ActiveSheet.ActiveCell.Text;

            if (_beforeValue == text)
            {
                return;
            }

            if (_spread.ActiveSheet.ActiveCell.CellType != null)
            {
                var type = _spread.ActiveSheet.ActiveCell.CellType.GetType();
                if (_typeFinder.GetType("FarPoint.Win.Spread.CellType.ButtonCellType").IsAssignableFrom(type))
                {
                    return;
                }
                else if (_typeFinder.GetType("FarPoint.Win.Spread.CellType.CheckBoxCellType").IsAssignableFrom(type))
                {
                    AddUsingNamespace("System.Windows.Forms");
                    var val = (text == "True" || text == "Checked") ? "CheckState.Checked" :
                              (text == "False" || text == "Unchecked") ? "CheckState.Unchecked" : "CheckState.Indeterminate";
                    AddSentence(new TokenName(), ".EmulateEditCheckState(", val, new TokenAsync(CommaType.Before), ");");
                    return;
                }
                else if (_typeFinder.GetType("FarPoint.Win.Spread.CellType.MultiColumnComboBoxCellType").IsAssignableFrom(type) ||
                         _typeFinder.GetType("FarPoint.Win.Spread.CellType.MultiOptionCellType").IsAssignableFrom(type) ||
                         _typeFinder.GetType("FarPoint.Win.Spread.CellType.SliderCellType").IsAssignableFrom(type))
                {
                    AddSentence(new TokenName(), ".EmulateEditValue(", text, new TokenAsync(CommaType.Before), ");");
                    return;
                }
            }
            AddSentence(new TokenName(), ".EmulateEditText(", GenerateUtility.AdjustText(text), new TokenAsync(CommaType.Before), ");");
        }
Example #2
0
 public override void Optimize(List <Sentence> code)
 {
     GenerateUtility.RemoveDuplicationFunction(this, code, "EmulateChangeActiveSheet");
     GenerateUtility.RemoveDuplicationFunction(this, code, "ActiveSheet.EmulateChangeActiveCell");
 }