Beispiel #1
0
        public void OpenSolution(ISolutionReader reader, string file, Action <string, int> callback = null)
        {
            var files = reader.GetFiles(file);

            if (files != null)
            {
                if (MappedData.Data.Count() > 0 && MessageBox.Show("Удалить уже добавленные файлы?", "Добавлеие решения", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    Helpers.mainCTX.Send(_ => MappedData.Clear(), null);
                    foreach (var w in watchers)
                    {
                        w.Value.EnableRaisingEvents = false;
                    }
                    watchers.Clear();
                }
                foreach (var d in new HashSet <string>(files.Select(f => Path.GetDirectoryName(f)), StringComparer.InvariantCultureIgnoreCase))
                {
                    setWatcher(d);
                }
                AddFiles(files, callback);
                foreach (var f in files)
                {
                    _SolutionsFiles.Add(f);
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Обновляет разметку изменившихся файлов
 /// </summary>
 /// <param name="callback">Колбэк метод (путь, индекс), сначало вернет пустой путь и количество файлов, затем путь и индес файла</param>
 public void Remap(Action <string, int> callback = null)
 {
     ResetWatchers();
     EditingEnabled = false;
     try
     {
         var lst = FilesTree.Files.ToArray();
         if (callback != null)
         {
             callback(null, lst.Count());
         }
         int cnt = 0;
         foreach (var data in lst)
         {
             MappedData.UpdateData(data, true);
             if (callback != null)
             {
                 callback((data as FileContainer)?.FullPath, ++cnt);
             }
         }
     }
     finally
     {
         EditingEnabled = true;
         FilterFiles();
         GC.Collect();
     }
 }
Beispiel #3
0
 private void btnUpdateFile_Click(object sender, RoutedEventArgs e)
 {
     if (colorizer.Data != null)
     {
         MappedData.UpdateData(colorizer.Data, true);
     }
 }
        public object Convert(object o, Type type, object parameter, CultureInfo culture)
        {
            var item = o as ITranslationItem;

            if (string.IsNullOrWhiteSpace(item.Translation))
            {
                return(NoTrans);
            }

            var rec = MappedData.GetValueRecord(item.Value) as IMapValueRecord;

            if (rec.Data.Count == 0)
            {
                if (rec.WasLinked)
                {
                    return(UnbindedVal);
                }
                else if (Translations.TranslatesDictionary.IndexOf(rec) >= 0)
                {
                    return(NotBindedTrans);
                }
                else
                {
                    return(NotBindedVal);
                }
            }
            else if (Translations.TranslatesDictionary.IndexOf(rec) < 0)
            {
                return(Brushes.SkyBlue);
            }

            return(null);
        }
Beispiel #5
0
        /// <summary>
        /// load bitmap from pointer
        /// </summary>
        void load(Queue staggingQ, CommandPool staggingCmdPool, IntPtr bitmap, bool generateMipmaps = true)
        {
            long size = info.extent.width * info.extent.height * 4 * info.extent.depth;

            if (MemoryFlags.HasFlag(VkMemoryPropertyFlags.HostVisible))
            {
                Map();
                unsafe {
                    System.Buffer.MemoryCopy(bitmap.ToPointer(), MappedData.ToPointer(), size, size);
                }
                Unmap();

                if (generateMipmaps)
                {
                    BuildMipmaps(staggingQ, staggingCmdPool);
                }
            }
            else
            {
                using (HostBuffer stagging = new HostBuffer(Dev, VkBufferUsageFlags.TransferSrc, (UInt64)size, bitmap)) {
                    PrimaryCommandBuffer cmd = staggingCmdPool.AllocateAndStart(VkCommandBufferUsageFlags.OneTimeSubmit);

                    stagging.CopyTo(cmd, this);
                    if (generateMipmaps)
                    {
                        BuildMipmaps(cmd);
                    }

                    cmd.End();
                    staggingQ.Submit(cmd);
                    staggingQ.WaitIdle();
                    cmd.Free();
                }
            }
        }
Beispiel #6
0
        /*
         * Function uses 'fileData' data member to parse and generate
         * a 'MappedData' objects and place them in a 2D array
         */
        public MappedData[,] map()
        {
            // First, the latitude and longitude intervals must be listed!
            int    numberLat;
            double latitudeInterDecimal;
            int    numberLon;
            double longitudeInterDecimal;

            // Retrieve data from the header of DTED to create latitude/longitude grid
            numberLat             = fileData.Header.NumberLatitudeLines;
            latitudeInterDecimal  = fileData.Header.LatitudeInterval / 3600 * .0175;  // Get interval of latitude in decimal value
            numberLon             = fileData.Header.NumberLongitudeLines;
            longitudeInterDecimal = fileData.Header.LongitudeInterval / 3600 * .0175; // Get interval of longitude in decimal value

            // Get decimal degree of the origin point for cell
            double latDecimal = fileData.Header.LatitudeOrigin.getDecimalDegree();
            double lonDecimal = fileData.Header.LongitudeOrigin.getDecimalDegree();

            double[] latValues = new double[numberLat];
            double[] lonValues = new double[numberLon];

            MappedData[,] mappedData = new MappedData[numberLat, numberLon];

            // Generate latitude values for grid based on interval from file
            for (int i = 0; i < numberLat; ++i)
            {
                latValues[i] = latDecimal;
                latDecimal  += latitudeInterDecimal;
            }

            // Generate longitude values for grid based on interval from file
            for (int i = 0; i < numberLon; ++i)
            {
                lonValues[i] = lonDecimal;
                lonDecimal  += longitudeInterDecimal;
            }

            int[][]   elevData = fileData.ElevationGrid; // Get elevation data to map onto latitude and longitude posts
            int       elev;                              // Hold particular elevation from the data
            Latitude  lat;                               // Latitude at post
            Longitude lon;                               // Longitude at post

            // Generate latitude and longitude grid data mapped to elevation

            // Must go along longitude lines as outer loop from left to right
            for (int i = 0; i < numberLon; ++i)
            {
                // Starting with lowest latitude and work to the top from bottom to top
                for (int j = 0; j < numberLat; ++j)
                {
                    elev             = elevData[i][j];
                    lat              = new Latitude(latValues[j]);
                    lon              = new Longitude(lonValues[i]);
                    mappedData[j, i] = new MappedData(lat, lon, elev);
                }
            }

            return(mappedData);
        }
        public async Task ReduceAsync(MappedData map)
        {
            var value = await StateManager.GetOrAddStateAsync(map.CompanyName, 0);

            await StateManager.SetStateAsync(map.CompanyName, ++value);

            _counter++;
        }
Beispiel #8
0
        /// <summary>
        /// Сохраняем новый текст файла
        /// </summary>
        /// <param name="text">Новый текст</param>
        public void SaveText(string text)
        {
            var path     = FullPath;
            var encoding = UseWriteEncoding ? WriteEncoding : Helpers.GetEncoding(path, Helpers.Encoding);

            System.IO.File.WriteAllText(path, text, encoding);
            MappedData.UpdateData(this, true);
        }
        public void Should_be_able_to_get_empty_list_for_non_existent_items()
        {
            var data = new MappedData();

            var mappedRows = data.MappedRows <Order>().ToList();

            Assert.AreEqual(0, mappedRows.Count);
        }
Beispiel #10
0
        public void UpdateData(string path, bool ifChanged)
        {
            PathBase p;

            if (Find(path, out p))
            {
                MappedData.UpdateData(p as FileContainer, ifChanged);
            }
        }
Beispiel #11
0
        /*
         * Function will scale 'rawTerrainData' into specified dimensions
         * through the use of averaging the data for sub matrix chunks.
         */
        public MappedData[,] scale(double scaleFactor)
        {
            // Find neccessary dimensions and scale both dimensions evenly!
            int rowDimensions    = (int)(rawDataRowDimensions * scaleFactor);
            int columnDimensions = (int)(rawDataColumnDimensions * scaleFactor);

            // Don't allow 'scaling-up'
            if (rowDimensions > rawDataRowDimensions || columnDimensions > rawDataColumnDimensions)
            {
                return(rawData); // Simply return normal non-scaled data
            }

            MappedData[,] scaledData = new MappedData[rowDimensions, columnDimensions]; // Matrix will contain scaled down data

            // Need to generate sub-matrices in order to scale down, so we need to figure out size
            int subMatrixRowSize    = (rawDataRowDimensions / rowDimensions) + 1;
            int subMatrixColumnSize = (rawDataColumnDimensions / columnDimensions) + 1;

            MappedData[,] subMatrix = new MappedData[subMatrixRowSize, subMatrixColumnSize];

            // Declare increment amount for both row and column. This will be based on the modulus of the 'rawData' dimensions divided by 'scaledDimensions'
            int incrementRow;
            int incrementColumn;

            // If the row dimensions did not divide evenly then we have overlap, which changes increment amount
            if (rawDataRowDimensions % rowDimensions > 0)
            {
                incrementRow = subMatrixRowSize - 1;
            }
            else
            {
                incrementRow = subMatrixRowSize;
            }

            // If the column dimensions did not divide evenly then we have overlap, which changes increment amount
            if (rawDataColumnDimensions % columnDimensions > 0)
            {
                incrementColumn = subMatrixColumnSize - 1;
            }
            else
            {
                incrementColumn = subMatrixColumnSize;
            }

            // Start generating sub-matrices and creating weighted data to put into scaled matrix
            for (int j = 0, col = 0; j < (rawDataColumnDimensions - (subMatrixColumnSize - 1)); j += incrementColumn, ++col)
            {
                for (int i = 0, row = (rowDimensions - 1); i < (rawDataRowDimensions - (subMatrixRowSize - 1)); i += incrementRow, --row)
                {
                    subMatrix = generateSubMatrix(i, j,
                                                  subMatrixRowSize, subMatrixColumnSize); // Generate and assign generated sub-matrix
                    scaledData[row, col] = new MappedData(subMatrix[0, 0].Latitude, subMatrix[0, 0].Longitude, calculateAverage(subMatrix));
                }
            }

            return(scaledData);
        }
Beispiel #12
0
 public FileContainer(PathPart parent, string name) : base(name)
 {
     Parent = parent;
     Parent.Add(this);
     if (this != MappedData.AddData(this))
     {
         throw new Exception("Duplicated.");
     }
 }
Beispiel #13
0
        private void code_MouseHover(object sender, System.Windows.Input.MouseEventArgs e)
        {
            if (colorizer.Data == null || (toolTip.IsOpen && toolBrd.Child == ContentTextEdit))
            {
                return;
            }
            toolTip.IsOpen = false;
            var pos = code.GetPositionFromPoint(e.GetPosition(code));

            if (!pos.HasValue)
            {
                return;
            }
            var offset = code.Document.GetOffset(pos.Value.Location);
            var units  = colorizer.Data.ItemsAt <IMapUnitLink>(offset);

            if (units.Count > 0)
            {
                var files = MappedData.Data.Where(d => d.Items != null && d.Items.OfType <IMapUnitEntry>().Any(el => units.Any(u => u.Value.Equals(el.Value, System.StringComparison.InvariantCultureIgnoreCase)))).ToArray();
                if (files.Length == 0)
                {
                    return;
                }
                var btn = new Button()
                {
                    Content = files[0]
                };
                btn.Click     += Btn_Click;
                toolBrd.Child  = btn;
                toolTip.IsOpen = true;
                e.Handled      = true;
                return;
            }
            var item = colorizer.Data.ValueItemAt(offset);

            if (item == null)
            {
                return;
            }
            var mapItm = MappedData.GetValueRecord(item.Value) as IMapValueRecord;

            if (mapItm == null)
            {
                return;
            }
            toolTipCloseTimer.Stop();
            var str = mapItm.Translation;

            ContentTextEdit.Text = str;
            ContentTextEdit.Tag  = mapItm;
            ContentText.Text     = str;
            toolBrd.Child        = string.IsNullOrWhiteSpace(str) ? EmptyText : ContentText;
            toolTip.IsOpen       = true;
            e.Handled            = true;
        }
        public Task <MappedData> MapAsync(string text)
        {
            var jobject = JObject.Parse(text);
            var company = jobject["Company"].Value <string>();

            var mapData = new MappedData()
            {
                CompanyName = company
            };

            return(Task.FromResult(mapData));
        }
Beispiel #15
0
        /*
         * Function will generate sub-matrix from 'rawTerrainData' data member to be used to
         * generate an average for the elevation. It will parse the 'rawData' starting at
         * 'startRow' and 'startColumn' and ITERATES UP to 'rowDimensions' and 'columnDimensions'
         */
        private MappedData[,] generateSubMatrix(int startRow, int startColumn, int rowDimensions, int columnDimensions)
        {
            // Allocate sub-matrix
            MappedData[,] subMatrix = new MappedData[rowDimensions, columnDimensions];

            // Start generating sub-matrix
            for (int i = 0; i < rowDimensions; ++i)
            {
                for (int j = 0; j < columnDimensions; ++j)
                {
                    subMatrix[i, j] = rawData[(startRow + i), (startColumn + j)];
                }
            }

            return(subMatrix);
        }
        public void Should_be_able_overwrite_a_list_of_mapped_rows()
        {
            var data   = new MappedData();
            var row1   = CreateDataRow();
            var row2   = CreateDataRow();
            var row3   = CreateDataRow();
            var row4   = CreateDataRow();
            var order1 = new Order("ON-1", DateTime.Now);
            var order2 = new Order("ON-2", DateTime.Now);
            var order3 = new Order("ON-3", DateTime.Now);
            var order4 = new Order("ON-4", DateTime.Now);

            data.Add(new List <MappedRow <Order> >
            {
                new MappedRow <Order>(row1, order1),
                new MappedRow <Order>(row2, order2)
            });

            var mappedRows = data.MappedRows <Order>().ToList();

            Assert.AreEqual(2, mappedRows.Count);
            Assert.AreSame(row1, mappedRows[0].Row);
            Assert.AreSame(order1, mappedRows[0].Result);
            Assert.AreSame(row2, mappedRows[1].Row);
            Assert.AreSame(order2, mappedRows[1].Result);

            mappedRows = data.MappedRows <Order>(mr => mr.Result.OrderNumber.Contains("2")).ToList();

            Assert.AreEqual(1, mappedRows.Count);
            Assert.AreSame(row2, mappedRows[0].Row);
            Assert.AreSame(order2, mappedRows[0].Result);

            data.Add(new List <MappedRow <Order> >
            {
                new MappedRow <Order>(row3, order3),
                new MappedRow <Order>(row4, order4)
            });

            mappedRows = data.MappedRows <Order>().ToList();

            Assert.AreEqual(2, mappedRows.Count);
            Assert.AreSame(row3, mappedRows[0].Row);
            Assert.AreSame(order3, mappedRows[0].Result);
            Assert.AreSame(row4, mappedRows[1].Row);
            Assert.AreSame(order4, mappedRows[1].Result);
        }
        public void Should_be_able_overwrite_a_list_of_mapped_rows()
        {
            var data = new MappedData();
            var row1 = CreateDataRow();
            var row2 = CreateDataRow();
            var row3 = CreateDataRow();
            var row4 = CreateDataRow();
            var order1 = new Order("ON-1", DateTime.Now);
            var order2 = new Order("ON-2", DateTime.Now);
            var order3 = new Order("ON-3", DateTime.Now);
            var order4 = new Order("ON-4", DateTime.Now);

            data.Add(new List<MappedRow<Order>>
                {
                    new MappedRow<Order>(row1, order1),
                    new MappedRow<Order>(row2, order2)
                });

            var mappedRows = data.MappedRows<Order>().ToList();

            Assert.AreEqual(2, mappedRows.Count);
            Assert.AreSame(row1, mappedRows[0].Row);
            Assert.AreSame(order1, mappedRows[0].Result);
            Assert.AreSame(row2, mappedRows[1].Row);
            Assert.AreSame(order2, mappedRows[1].Result);

            mappedRows = data.MappedRows<Order>(mr => mr.Result.OrderNumber.Contains("2")).ToList();

            Assert.AreEqual(1, mappedRows.Count);
            Assert.AreSame(row2, mappedRows[0].Row);
            Assert.AreSame(order2, mappedRows[0].Result);

            data.Add(new List<MappedRow<Order>>
                {
                    new MappedRow<Order>(row3, order3),
                    new MappedRow<Order>(row4, order4)
                });

            mappedRows = data.MappedRows<Order>().ToList();

            Assert.AreEqual(2, mappedRows.Count);
            Assert.AreSame(row3, mappedRows[0].Row);
            Assert.AreSame(order3, mappedRows[0].Result);
            Assert.AreSame(row4, mappedRows[1].Row);
            Assert.AreSame(order4, mappedRows[1].Result);
        }
        private void BtnApply_Click(object sender, RoutedEventArgs e)
        {
            if (Data.IsChanged)
            {
                MessageBox.Show("Не возможно произвести замену, т.к. данные были изменены.");
                MappedData.UpdateData(Data, false);
                return;
            }

            var itm = ((Button)sender).DataContext as Tuple <int, int, string>;

            //если запись уже есть, то проверим одинаковы ли переводы, и если они разные спросим как быть
            //иначе создадим новую запись и зададим её перевод
            if (MappedData.IsValueExists(NewValue))
            {
                var mapItm = (IMapValueRecord)MappedData.GetValueRecord(NewValue);
                if (string.IsNullOrWhiteSpace(mapItm.Translation))
                {
                    mapItm.Translation = Translation;
                }
                else if (!string.IsNullOrWhiteSpace(mapItm.Translation) && !string.Equals(mapItm.Translation, Translation))
                {
                    switch (MessageBox.Show(
                                $"Значение:\r\n\"{mapItm.Value}\"\r\nТекущий перевод:\r\n\"{mapItm.Translation}\"\r\nНовый перевод:\r\n\"{Translation}\"\r\n\r\nЗаменить перевод?"
                                , "Редактирование"
                                , MessageBoxButton.YesNoCancel
                                , MessageBoxImage.Question
                                ))
                    {
                    case MessageBoxResult.Cancel: return;

                    case MessageBoxResult.Yes: mapItm.Translation = Translation; break;
                    }
                }
            }
            else
            {
                ((IMapValueRecord)MappedData.GetValueRecord(NewValue)).Translation = Translation;
            }

            Data.SaveText(Data.Text.Remove(itm.Item1, itm.Item2).Insert(itm.Item1, itm.Item3));
        }
        public IEnumerable <Order> Assemble(MappedData data)
        {
            var result = new List <Order>();

            foreach (var orderRow in data.MappedRows <Order>())
            {
                var order = orderRow.Result;

                foreach (var orderLineRow in data.MappedRows <OrderLine>())
                {
                    if (orderLineRow.Row["OrderNumber"].Equals(order.OrderNumber))
                    {
                        order.AddLine(orderLineRow.Result);
                    }
                }

                result.Add(order);
            }

            return(result);
        }
        public void Should_be_able_to_assemble_item()
        {
            var now = DateTime.Now;
            var mappedData = new MappedData();

            var orderTable = new DataTable();

            orderTable.Columns.Add("OrderNumber", typeof(string));
            orderTable.Columns.Add("OrderDate", typeof(DateTime));

            const string orderNumber = "ON-10";

            mappedData.Add(new MappedRow<Order>(orderTable.Rows.Add(orderNumber, now), new Order(orderNumber, now)));

            var orderLineTable = new DataTable();

            orderLineTable.Columns.Add("OrderNumber", typeof(string));
            orderLineTable.Columns.Add("ProductId", typeof(string));
            orderLineTable.Columns.Add("Quantity", typeof(int));
            orderLineTable.Columns.Add("UnitCost", typeof(double));

            mappedData.Add(new List<MappedRow<OrderLine>>
                {
                    new MappedRow<OrderLine>(orderLineTable.Rows.Add(orderNumber, "SKU-1", 5, 10), new OrderLine("SKU-1", 5, 10)),
                    new MappedRow<OrderLine>(orderLineTable.Rows.Add(orderNumber, "SKU-2", 1, 65), new OrderLine("SKU-2", 1, 65)),
                    new MappedRow<OrderLine>(orderLineTable.Rows.Add(orderNumber, "SKU-3", 10, 10.5), new OrderLine("SKU-3", 10, 10.5))
                });

            var order = new OrderAssembler().AssembleItem(mappedData);

            Assert.AreEqual(orderNumber, order.OrderNumber);
            Assert.AreEqual(now, order.OrderDate);
            Assert.AreEqual(3, order.Lines.Count());
            Assert.AreEqual(50, order.Lines.ElementAt(0).TotalCost());
            Assert.AreEqual(65, order.Lines.ElementAt(1).TotalCost());
            Assert.AreEqual(105, order.Lines.ElementAt(2).TotalCost());
            Assert.AreEqual(220, order.Total());
        }
Beispiel #21
0
        public void Should_be_able_to_assemble_item()
        {
            var now        = DateTime.Now;
            var mappedData = new MappedData();

            var orderTable = new DataTable();

            orderTable.Columns.Add("OrderNumber", typeof(string));
            orderTable.Columns.Add("OrderDate", typeof(DateTime));

            const string orderNumber = "ON-10";

            mappedData.Add(new MappedRow <Order>(orderTable.Rows.Add(orderNumber, now), new Order(orderNumber, now)));

            var orderLineTable = new DataTable();

            orderLineTable.Columns.Add("OrderNumber", typeof(string));
            orderLineTable.Columns.Add("ProductId", typeof(string));
            orderLineTable.Columns.Add("Quantity", typeof(int));
            orderLineTable.Columns.Add("UnitCost", typeof(double));

            mappedData.Add(new List <MappedRow <OrderLine> >
            {
                new MappedRow <OrderLine>(orderLineTable.Rows.Add(orderNumber, "SKU-1", 5, 10), new OrderLine("SKU-1", 5, 10)),
                new MappedRow <OrderLine>(orderLineTable.Rows.Add(orderNumber, "SKU-2", 1, 65), new OrderLine("SKU-2", 1, 65)),
                new MappedRow <OrderLine>(orderLineTable.Rows.Add(orderNumber, "SKU-3", 10, 10.5), new OrderLine("SKU-3", 10, 10.5))
            });

            var order = new OrderAssembler().AssembleItem(mappedData);

            Assert.AreEqual(orderNumber, order.OrderNumber);
            Assert.AreEqual(now, order.OrderDate);
            Assert.AreEqual(3, order.Lines.Count());
            Assert.AreEqual(50, order.Lines.ElementAt(0).TotalCost());
            Assert.AreEqual(65, order.Lines.ElementAt(1).TotalCost());
            Assert.AreEqual(105, order.Lines.ElementAt(2).TotalCost());
            Assert.AreEqual(220, order.Total());
        }
        public void Should_be_able_to_add_and_overwrite_a_single_mapped_row()
        {
            var data = new MappedData();
            var row1 = CreateDataRow();
            var row2 = CreateDataRow();
            var order1 = new Order("ON-1", DateTime.Now);
            var order2 = new Order("ON-2", DateTime.Now);

            data.Add(new MappedRow<Order>(row1, order1));

            var mappedRows = data.MappedRows<Order>().ToList();

            Assert.AreEqual(1, mappedRows.Count);
            Assert.AreSame(row1, mappedRows[0].Row);
            Assert.AreSame(order1, mappedRows[0].Result);

            data.Add(new MappedRow<Order>(row2, order2));

            mappedRows = data.MappedRows<Order>().ToList();

            Assert.AreEqual(1, mappedRows.Count);
            Assert.AreSame(row2, mappedRows[0].Row);
            Assert.AreSame(order2, mappedRows[0].Result);
        }
        public void Should_be_able_to_add_and_overwrite_a_single_mapped_row()
        {
            var data   = new MappedData();
            var row1   = CreateDataRow();
            var row2   = CreateDataRow();
            var order1 = new Order("ON-1", DateTime.Now);
            var order2 = new Order("ON-2", DateTime.Now);

            data.Add(new MappedRow <Order>(row1, order1));

            var mappedRows = data.MappedRows <Order>().ToList();

            Assert.AreEqual(1, mappedRows.Count);
            Assert.AreSame(row1, mappedRows[0].Row);
            Assert.AreSame(order1, mappedRows[0].Result);

            data.Add(new MappedRow <Order>(row2, order2));

            mappedRows = data.MappedRows <Order>().ToList();

            Assert.AreEqual(1, mappedRows.Count);
            Assert.AreSame(row2, mappedRows[0].Row);
            Assert.AreSame(order2, mappedRows[0].Result);
        }
        public void Should_be_able_to_get_empty_list_for_non_existent_items()
        {
            var data = new MappedData();

            var mappedRows = data.MappedRows<Order>().ToList();

            Assert.AreEqual(0, mappedRows.Count);
        }
Beispiel #25
0
        static Action <VisualLineElement> ValueTypeToAction(IMapRangeItem item)
        {
            if (item is IMapMethodItem)
            {
                return (VisualLineElement element) =>
                       {
                           element.TextRunProperties.SetForegroundBrush(Brushes.BlueViolet);
                       }
            }
            ;
            if (item is IMapUnitEntry)
            {
                return (VisualLineElement element) =>
                       {
                           element.TextRunProperties.SetForegroundBrush(Brushes.OrangeRed);
                       }
            }
            ;
            if (item is IMapUnitLink)
            {
                return (VisualLineElement element) =>
                       {
                           element.TextRunProperties.SetForegroundBrush(Brushes.Orange);
                       }
            }
            ;
            if (item is IMapValueItem)
            {
                if (item is IMapBackgroundColorRange)
                {
                    return (VisualLineElement element) =>
                           {
                               element.TextRunProperties.SetForegroundBrush(Brushes.Blue);
                               var itv = item as IMapValueItem;
                               if (itv != null && string.IsNullOrWhiteSpace((MappedData.GetValueRecord(itv.Value) as IMapValueRecord).Translation))
                               {
                                   element.TextRunProperties.SetTextDecorations(decorStrikethrough);
                               }
                               element.TextRunProperties.SetBackgroundBrush((item as IMapBackgroundColorRange).BackgroundColor);
                           }
                }
            }
            ;
            else
            {
                return (VisualLineElement element) =>
                       {
                           element.TextRunProperties.SetForegroundBrush(Brushes.Blue);

                           var itv = item as IMapValueItem;
                           if (itv != null && string.IsNullOrWhiteSpace((MappedData.GetValueRecord(itv.Value) as IMapValueRecord).Translation))
                           {
                               element.TextRunProperties.SetTextDecorations(decorStrikethrough);
                           }
                       }
            };
            else if (item is IMapForeColorRange)
            {
                if (item is IMapBackgroundColorRange)
                {
                    return (VisualLineElement element) =>
                           {
                               element.TextRunProperties.SetForegroundBrush((item as IMapForeColorRange).ForegroundColor);
                               element.BackgroundBrush = (item as IMapBackgroundColorRange).BackgroundColor;
                           }
                }
            }
            ;
            else
            {
                return((VisualLineElement element) => element.TextRunProperties.SetForegroundBrush((item as IMapForeColorRange).ForegroundColor));
            }
Beispiel #26
0
 public void UnMap()
 {
     MappedData.RemoveData(this);
 }