Ejemplo n.º 1
0
 public void Flush()
 {
     Frames.Clear();
     CommandRow.Flush(this, 0);
     CommandCol.Flush(this, 0);
     PopSet.Flush(this, 0);
 }
Ejemplo n.º 2
0
 public Slave(ref CommandRow <Pulse.OperationClass> op_class, ref CommandRow <Pulse.PulseTypes> p_types,
              DecodeFunction func, string name = "N/A")
 {
     _name     = name;
     _op_class = op_class;
     _p_types  = p_types;
     _func     = func;
 }
Ejemplo n.º 3
0
        //public ExcelWorksheet EnsureWorksheet() => WS ?? (WS = WB.Worksheets.Add($"Sheet {WB.Worksheets.Count + 1}"));

        //public ExcelRangeBase Get(string cells) => WS.Cells[this.DecodeAddress(cells)];

        //public ExcelRangeBase Next(ExcelRangeBase range, NextDirection? nextDirection = null) => (nextDirection ?? NextDirection) == NextDirection.Column ? range.Offset(0, DeltaX) : range.Offset(DeltaY, 0);
        //public ExcelColumn Next(ExcelColumn col) => throw new NotImplementedException();
        //public ExcelRow Next(ExcelRow row) => throw new NotImplementedException();

        public void Flush()
        {
            //if (Sets.Count == 0) this.WriteRowLast(null);
            Frames.Clear();
            CommandRow.Flush(this, 0);
            CommandCol.Flush(this, 0);
            PopSet.Flush(this, 0);
        }
        public GridViewCommandRow(RadGridView grid)
        {
            this.RadGridView = grid;
            this.CommandRow  = new ContentControl();
            CommandRow.SetValue(Grid.RowProperty, 1);

            if (this.ViewCommandTemplate == null)
            {
                this.ViewCommandTemplate = App.Current.Resources["CommandRowTemplate"] as ControlTemplate;
            }

            if (this.EditCommandTemplate == null)
            {
                this.EditCommandTemplate = App.Current.Resources["CommandRowEditTemplate"] as ControlTemplate;
            }
        }
Ejemplo n.º 5
0
        async Task IActionProvider.ProcessDeltaCommandsAsync(
            bool doNotProcessIfDataLoss,
            CommandCollection commands,
            CancellationToken ct)
        {
            using (var stream = new MemoryStream())
                using (var writer = new StreamWriter(stream))
                    using (var csvWriter = new CsvWriter(writer, CultureInfo.InvariantCulture))
                    {
                        csvWriter.WriteHeader <CommandRow>();
                        csvWriter.NextRecord();

                        foreach (var group in commands.CommandGroups)
                        {
                            foreach (var command in group.Commands)
                            {
                                var row = new CommandRow
                                {
                                    Command    = command.CommandFriendlyName,
                                    ScriptPath = command.ScriptPath,
                                    Script     = command.ToScript()
                                };

                                csvWriter.WriteRecord(row);
                            }
                        }
                        csvWriter.Flush();
                        writer.Flush();
                        stream.Flush();

                        var csvContent = ASCIIEncoding.UTF8.GetString(stream.ToArray());

                        await _fileGateway.SetFileContentAsync(
                            _filePath,
                            csvContent,
                            ct);
                    }
        }
Ejemplo n.º 6
0
        private async Task <CommandInformation> From(CommandRow commandRow)
        {
            var commandInformation = new CommandInformation {
                Id            = Guid.Parse(commandRow.RowKey),
                IsStarted     = commandRow.IsStarted,
                IsDone        = commandRow.IsDone,
                IsSuccessful  = commandRow.IsSuccessful,
                ExecutionDate = commandRow.ExecutionDate,
                Type          = commandRow.Type
            };

            if (string.IsNullOrEmpty(commandRow.Events))
            {
                return(commandInformation);
            }
            var eventIdentifiers = commandRow.GetEventIdentifiers(_jsonConverter);

            if (eventIdentifiers.Any())
            {
                commandInformation.EventInformations = (await GetEventInformation(eventIdentifiers)).ToArray();
            }
            return(commandInformation);
        }
Ejemplo n.º 7
0
                private CommandRow <Errors> ScanInnerErrors()
                {
                    if (_pulses.Count == 0)
                    {
                        return(null);
                    }
                    CommandRow <Errors> res = new CommandRow <Errors>();
                    uint   j          = 1;
                    Errors last_error = Errors.TRNoErorrs;

                    //Pulse.OperationClass last_class = _pulses[0].OpClass;
                    if (_pulses[0].Type == Pulse.PulseTypes.OWErrorType)
                    {
                        last_error = Errors.OWTypeError;
                    }
                    for (int i = 1; i < _pulses.Count; i++)
                    {
                        switch (_pulses[i].OpClass)
                        {
                        case Pulse.OperationClass.OWNoClass:
                            if (_pulses[i].Type == Pulse.PulseTypes.OWErrorType)
                            {
                                if (last_error == Errors.OWTypeError)
                                {
                                    j++;
                                }
                                else
                                {
                                    res.Add(last_error, j);
                                    last_error = Errors.OWTypeError;
                                    j          = 1;
                                }
                            }
                            else
                            {
                                goto default;
                            }
                            break;

                        case Pulse.OperationClass.OWReadWrite:     //Check timeslot
                            if (_pulses[i - 1].OpClass == Pulse.OperationClass.OWReadWrite)
                            {
                                if (TimeslotViolation(_pulses[i - 1], _pulses[i]))
                                {
                                    if (last_error == Errors.OWTimeslotViolation)
                                    {
                                        j++;
                                    }
                                    else
                                    {
                                        res.Add(last_error, j);
                                        last_error = Errors.OWTimeslotViolation;
                                        j          = 1;
                                    }
                                }
                                else
                                {
                                    goto default;
                                }
                            }
                            else
                            {
                                goto default;
                            }
                            break;

                        default:
                            if (last_error == Errors.TRNoErorrs)
                            {
                                j++;
                            }
                            else
                            {
                                res.Add(last_error, j);
                                last_error = Errors.TRNoErorrs;
                                j          = 1;
                            }
                            break;
                        }
                    }
                    res.Add(last_error, j);
                    return(res);
                }