Beispiel #1
0
        public void SendChangeCommand(Command.CommandChange command)
        {
            var setting    = new DataContractJsonSerializerSettings();
            var serializer = new DataContractJsonSerializer(typeof(Command.CommandHeader <Command.CommandChange>), setting);

            serializer.WriteObject(m_stream, new Command.CommandHeader <Command.CommandChange>()
            {
                CommandBodyType = Command.CommandType.Change,
                CommandBody     = command,
            });
            var endl  = "\n";
            var endlb = Encoding.UTF8.GetBytes(endl);

            m_stream.Write(endlb, 0, endlb.Count());
        }
Beispiel #2
0
        private void emitChange(List <ChangedValue> changedList)
        {
            var command = new Command.CommandChange();

            command.ChangedCell = new List <Command.CommandChange.ValueChange>();
            foreach (var changed in changedList)
            {
                command.ChangedCell.Add(
                    new Command.CommandChange.ValueChange()
                {
                    ColumnName = m_columnName[changed.Position.Column],
                    RowName    = m_rowName[changed.Position.Row],
                    NewValue   = changed.Value,
                }
                    );
            }
            ChangeEvent?.Invoke(command);
        }
Beispiel #3
0
        public void ValueChange(Command.CommandChange command)
        {
            if (m_worksheet == null)
            {
                return;
            }
            foreach (var changedCell in command.ChangedCell)
            {
                var position = findCell(changedCell.RowName, changedCell.ColumnName);

                if (position.Column < 0 || position.Row < 0)
                {
                    continue;
                }
                m_dataTable[position.Row, position.Column] = changedCell.NewValue;
                dynamic cell = m_worksheet.Cells[position.Row + m_headerRow + 1, position.Column + m_headerColumn + 1];
                cell.Value = changedCell.NewValue;
            }
        }
Beispiel #4
0
 private void ExcecuteChange(Command.CommandChange command)
 {
     Changed?.Invoke(command);
 }