public void FillXlsRow(IWorkbook workbook, ISheet sheet, string[] headers, IRow row, ICellStyle datestyle, double timezone)
        {
            row.CreateCell(0, CellType.String).SetCellValue(Controller.ToString());
            row.CreateCell(1, CellType.String).SetCellValue(DisplayId ?? Controller.ToString());

            var cell = row.CreateCell(2);

            cell.SetCellValue(Time.ToOffset(TimeSpan.FromMinutes(timezone)).DateTime);
            cell.CellStyle = datestyle;

            if (OperatorId != 0)
            {
                row.CreateCell(3, CellType.Numeric).SetCellValue(OperatorId);
            }

            row.CreateCell(4, CellType.String).SetCellValue(OpMode.ToString());
            row.CreateCell(5, CellType.String).SetCellValue(JobMode.ToString());
            if (JobCardId != null)
            {
                row.CreateCell(6, CellType.String).SetCellValue(JobCardId);
            }
            if (MoldId != null)
            {
                row.CreateCell(7, CellType.String).SetCellValue(MoldId);
            }

            for (var i = 8; i < headers.Length; i++)
            {
                var key = headers[i];
                if (Data.ContainsKey(key))
                {
                    row.CreateCell(i, CellType.Numeric).SetCellValue(Data[key]);
                }
            }
        }
        public MoveTextRangeDialog(TextRangeViewModel vm, OpMode mode, List <TextRangeViewModel> customList, Action updateHighlighter)
        {
            this.UpdateHighlighter = updateHighlighter;

            this.ViewModel  = vm;
            this.Mode       = mode;
            this.MethodInfo = GetMethodInfo();
            this.ReturnType = MethodInfo.ReturnType;

            this.Parameters = (from p in MethodInfo.GetParameters()
                               select new Parameter()
            {
                ParamType = p.ParameterType,
                Name = string.Format(CultureInfo.InvariantCulture, "{0}({1})", p.Name, p.ParameterType.Name),
                ParamEnums = p.ParameterType.IsEnum ? Enum.GetValues(p.ParameterType) : null
            }).ToList();

            InitializeComponent();

            // Set title with proper name based on mode.
            this.Title = mode.ToString();

            this.dgParams.ItemsSource = this.Parameters.Where(p => p.ParamType != typeof(Axe.Windows.Desktop.UIAutomation.Patterns.TextRange));
            // set the list and enforce to select the first item by default.
            this.lbxTargetRanges.ItemsSource   = customList;
            this.lbxTargetRanges.SelectedIndex = 0;

            switch (mode)
            {
            case OpMode.MoveEndpointByRange:
                this.lbTargetTR.Visibility      = Visibility.Visible;
                this.lbxTargetRanges.Visibility = Visibility.Visible;
                break;

            case OpMode.Move:
            case OpMode.MoveEndpointByUnit:
                this.lbxTargetRanges.Visibility = Visibility.Collapsed;
                this.lbTargetTR.Visibility      = Visibility.Collapsed;
                break;

            case OpMode.Compare:
                this.dgParams.Visibility = Visibility.Collapsed;
                break;

            case OpMode.CompareEndpoints:
            default:
                break;
            }
        }
        public void FillXlsRow(IWorkbook workbook, ISheet sheet, string[] headers, IRow row, ICellStyle datestyle, double timezone)
        {
            row.CreateCell(0, CellType.String).SetCellValue(Controller.ToString());
            row.CreateCell(1, CellType.String).SetCellValue(DisplayId ?? Controller.ToString());

            var cell = row.CreateCell(2);

            cell.SetCellValue(Time.ToOffset(TimeSpan.FromMinutes(timezone)).DateTime);
            cell.CellStyle = datestyle;

            if (Connected.HasValue)
            {
                row.CreateCell(3, CellType.Boolean).SetCellValue(Connected.Value ? "Connected" : "Disconnected");
            }
            if (OperatorId.HasValue)
            {
                row.CreateCell(4, CellType.Numeric).SetCellValue(OperatorId.Value);
            }
            if (!string.IsNullOrWhiteSpace(IP))
            {
                row.CreateCell(5, CellType.String).SetCellValue(IP);
            }
            if (OpMode.HasValue)
            {
                row.CreateCell(6, CellType.String).SetCellValue(OpMode.ToString());
            }
            if (JobMode.HasValue)
            {
                row.CreateCell(7, CellType.String).SetCellValue(JobMode.ToString());
            }
            if (JobCardId != null)
            {
                row.CreateCell(8, CellType.String).SetCellValue(JobCardId);
            }
            if (MoldId.HasValue)
            {
                row.CreateCell(9, CellType.String).SetCellValue(MoldId.ToString());
            }
        }