예제 #1
0
        public void can_create_proxy_for_interface_that_inherits_other_interfaces()
        {
            var target = new Combined();
            var proxy  = Duck.Cast <ISimplistWithAdder>(target);

            Assert.AreEqual(3, proxy.AddOne(2));
        }
예제 #2
0
        public void can_cast_proxy_to_another_interface_supported_by_wrapped_object()
        {
            var target = new Combined();
            var proxy  = Duck.Cast <ISimplist>(target);

            Duck.Cast <IAdder>(proxy);
        }
 internal void Dispose()
 {
     Data.PropertyChanged  -= Data_PropertyChanged;
     Data.UpdatedViewports -= Data_UpdatedViewports;
     Combined.Clear();
     Excluded.Clear();
 }
        public void ShouldReturnAnInstanceOfCombined()
        {
            setRequireVariables();
            string[] endpoints = new string[] { "classify", "concepts", "entities", "extract", "hashtags", "language", "sentiment", "summarize" };
            Combined combined  = client.Combined(url: url, endpoints: endpoints);

            Assert.IsInstanceOfType(combined, typeof(Combined));
        }
        //LoadBtn_Click: Loads Trains and Bookings from a file and adjust TrainFactory
        private void LoadBtn_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog load_window = new OpenFileDialog();

            load_window.Filter = "DAT File|*.dat";
            load_window.Title  = "Load Rail Network data";
            load_window.ShowDialog();

            Combined loaded = null;

            if (!string.IsNullOrEmpty(load_window.FileName))
            {
                try
                {
                    loaded = TrainFacade.DeserializePair((FileStream)load_window.OpenFile());
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    return;
                }
            }
            else
            {
                return;
            }

            Trains   = loaded.Trains;
            Bookings = loaded.Bookings;
            //TrainFactory needs to be rebuilt because TrainFactory context is not serialized
            TrainFactory.Records = new Dictionary <string, List <string> >();
            if (Bookings.Count == 0)
            {
                foreach (Train t in Trains)
                {
                    TrainFactory.Records.Add(t.TrainID, new List <string>());
                }
            }
            else
            {
                foreach (Booking b in Bookings)
                {
                    if (!TrainFactory.Records.ContainsKey(b.TrainID))
                    {
                        TrainFactory.Records.Add(b.TrainID, new List <string> {
                            $"{b.Coach}{b.Seat.ToString()}"
                        });
                    }
                    else
                    {
                        TrainFactory.Records[b.TrainID].Add(b.Coach + b.Seat.ToString());
                    }
                }
            }

            MessageBox.Show("Loaded!");
        }
        private static async Task <List <Monkey> > CreateAndExportToFilesOneWoodAscync(int woodId, int numberOfMonkeys, int numberOfTrees, int width, int height)
        {
            var         combo = new Combined();
            var         m     = combo.CreateWoodsAndPlaceMonkeysInsideAndEscapeAsync(woodId, numberOfMonkeys, numberOfTrees, width, height);
            List <Task> tasks = new List <Task>();

            tasks.Add(Task.Run(() => ExportToFiles.Export.ExportToBitMap(m)));
            tasks.Add(Task.Run(() => ExportToFiles.Export.ExportToTextFile(m)));
            Task.WaitAll(tasks.ToArray());
            return(m);
        }
예제 #7
0
파일: Offer.cs 프로젝트: lulzzz/UITest-POC
 public Offer(int tenderId, string commericalRegisterNo, List <SupplierTenderQuantityTable> quantityTable, int?offerPresentationWayid, bool isSolidarity = false)
 {
     CommericalRegisterNo         = commericalRegisterNo;
     TenderId                     = tenderId;
     OfferStatusId                = (int)Enums.OfferStatus.UnderEstablishing;
     SupplierTenderQuantityTables = quantityTable;
     SetAttachmentsValuesToTrue();
     this.IsSolidarity      = isSolidarity;
     OfferPresentationWayId = offerPresentationWayid;
     Combined.Add(new OfferSolidarity((commericalRegisterNo), (int)Enums.UnRegisteredSuppliersInvitationType.SolidarityLeader));
     EntityCreated();
 }
        public void References()
        {
            Combined value1 = new Combined();
            Combined value2 = new Combined();
            Combined value3 = new Combined();

            value1.obj2 = new object();
            value2.obj2 = value1.obj2;
            value3.obj2 = new object();

            Assert.That(value1 == value2);
            Assert.That(value1 != value3);
        }
        private void Exclude(ViewportSetupFileViewModel model)
        {
            Combined.Remove(model);
            Data.Combined.SetExcluded(model.ProfileName);
            if (model == CurrentViewportSetup)
            {
                using (new HeliosUndoBatch())
                {
                    Data.GenerateCombined = false;
                    ConfigManager.UndoManager.AddUndoItem(new UndoExclude(this, model));
                }
            }

            AddExcluded(model);
            Data.InvalidateStatusReport();
        }
예제 #10
0
        public AmateurRadioCallSign GetByCallSign(string callSign)
        {
            if (string.IsNullOrEmpty(callSign))
            {
                return(null);
            }

            if (Combined.ContainsKey(callSign.ToUpperInvariant()))
            {
                return(Combined[callSign.ToUpperInvariant()]);
            }

            //slower, but an acceptable fallback when the dictionary match fails
            return((from c in Combined.Values
                    where c.CallSign.Replace(" ", "").Equals(callSign.Replace(" ", ""), StringComparison.InvariantCultureIgnoreCase)
                    select c)?.FirstOrDefault());
        }
예제 #11
0
        /// <summary>
        /// called when the current profile has been saved under a different name
        /// </summary>
        private void HandleProfileNameChange()
        {
            string oldName = CurrentViewportSetup.ProfileName;
            string newName = Data.CurrentProfileName;

            Debug.Assert(oldName != newName);

            ResetCurrentMonitorSetupSelection();
            ViewportSetupFileViewModel model = Combined.FirstOrDefault(m => m.ProfileName == newName);

            if (model != null)
            {
                ConfigureCurrentProfile(model);

                // after fixups, check if in the correct list
                if (Data.Combined.IsCombined(model.ProfileName))
                {
                    return;
                }

                Combined.Remove(model);
                AddExcluded(model);
                return;
            }

            model = Excluded.FirstOrDefault(m => m.ProfileName == newName);
            if (model != null)
            {
                ConfigureCurrentProfile(model);

                // after fixups, check if in the correct list
                if (!Data.Combined.IsCombined(model.ProfileName))
                {
                    return;
                }

                Excluded.Remove(model);
                AddCombined(model);
                return;
            }

            // not found
            AddCurrentProfile();
        }
예제 #12
0
 private void ResetCurrentMonitorSetupSelection()
 {
     if (CurrentViewportSetup.ProfileName == null)
     {
         // special entry for unsaved profile, just remove it
         if (Combined.Contains(CurrentViewportSetup))
         {
             Combined.Remove(CurrentViewportSetup);
         }
         else if (Excluded.Contains(CurrentViewportSetup))
         {
             Excluded.Remove(CurrentViewportSetup);
         }
     }
     else
     {
         // keep it, but this is no longer the special entry for current
         CurrentViewportSetup.IsCurrentProfile = false;
     }
 }
예제 #13
0
        protected override void AttachToProfileOnMainThread()
        {
            base.AttachToProfileOnMainThread();

            // customize naming in case of custom Documents folder
            string documentsFolderName = Path.GetFileName(ConfigManager.DocumentPath);

            _combinedMonitorSetupName = string.IsNullOrEmpty(documentsFolderName) ? "Helios" : documentsFolderName;

            // read persistent config
            _monitorLayoutMode = ConfigManager.SettingsManager.LoadSetting(PREFERENCES_SETTINGS_GROUP,
                                                                           "MonitorLayoutMode", MonitorLayoutMode.FromTopLeftCorner);

            // real initialization, not just a test instantiation
            Combined.Initialize();
            CurrentProfileName = string.IsNullOrWhiteSpace(Profile.Path) ? null : Profile.Name;

            // NOTE: intentional crash if there is no Application.Current.Dispatcher
            _geometryChangeTimer = new DispatcherTimer(
                TimeSpan.FromMilliseconds(100),
                DispatcherPriority.Normal,
                OnDelayedGeometryChange,
                Application.Current.Dispatcher)
            {
                IsEnabled = false
            };
            _renderer = new MonitorSetupGenerator(this);

            CreateShadowObjects();

            // we only update our models if the monitor layout matches
            _monitorsValid = CheckMonitorsValid;

            // calculate initial geometry, if we can
            UpdateAllGeometry();

            // register for changes
            Profile.Monitors.CollectionChanged += Monitors_CollectionChanged;
            Profile.PropertyChanged            += Profile_PropertyChanged;
        }
예제 #14
0
        public static Patterns Parse(IEnumerable <string> lines)
        {
            var patterns = new Patterns();

            foreach (var line in lines)
            {
                var split   = line.Seperate(':');
                var id      = split[0].Int32();
                var pattern = split[1];

                if (pattern[1] == 'a' || pattern[1] == 'b')
                {
                    patterns[id] = pattern[1];
                }
                else
                {
                    var piped = pattern.Seperate('|');
                    patterns[id] = piped.Length == 1
                        ? Combined.Parse(pattern, patterns)
                        : new Or(Combined.Parse(piped[0], patterns), Combined.Parse(piped[1], patterns));
                }
            }
            return(patterns);
        }
예제 #15
0
        public void cdrDeferred()
        {
            string branchTransitNumber       = TestContext.DataRow["BranchTransit"].ToString();
            string transactionSequenceNumber = TestContext.DataRow["TransactionSequenceNumber"].ToString();
            string teller = TestContext.DataRow["Teller"].ToString();
            int    count  = 0;

            foreach (char a in transactionSequenceNumber)
            {
                count++;
            }

            for (int i = 0; i < 4 - count; i++)
            {
                transactionSequenceNumber = '0' + transactionSequenceNumber;
            }

            Combined objCombinedClasses = new Combined();
            string   text = objCombinedClasses.PutCheck();

            CodedUITest2 c2 = new CodedUITest2();

            c2.CodedUITestMethod1(branchTransitNumber, transactionSequenceNumber, teller, text);
        }
예제 #16
0
        public void OverlapImage()
        {
            Image i = null;

            if (Filename == null)
            {
                i = Image.FromFile(".\\ExampleImage\\B_noisy.bmp");
            }
            else
            {
                i = Image.FromFile(Filename);
            }
            Bitmap image = null;

            if (UseResultPic)
            {
                image = FindBitMapByLabal(GetNowStepPicture());
                //Q5_source = null;
                //Q5_pic = null;
            }
            else
            {
                image = new Bitmap(i);
            }
            if (image == null)
            {
                image = new Bitmap(i);
            }
            Bitmap Combined;

            if (Q5_pic == null)
            {
                Combined = new Bitmap(image.Width, image.Height);

                int[]      sobelX           = { -1, 0, 1, -2, 0, 2, -1, 0, 1 };
                int[]      sobelY           = { 1, 2, 1, 0, 0, 0, -1, -2, -1 };
                int[]      data             = new int[9];
                List <int> datas3           = new List <int>();
                Bitmap     Graylevel_extend = ExtendBitmap(image);
                for (int x = 1; x < Graylevel_extend.Width - 1; ++x)
                {
                    for (int y = 1; y < Graylevel_extend.Height - 1; ++y)
                    {
                        data[0] = Graylevel_extend.GetPixel(x - 1, y - 1).R;
                        data[1] = Graylevel_extend.GetPixel(x, y - 1).R;
                        data[2] = Graylevel_extend.GetPixel(x + 1, y - 1).R;
                        data[3] = Graylevel_extend.GetPixel(x - 1, y).R;
                        data[4] = Graylevel_extend.GetPixel(x, y).R;
                        data[5] = Graylevel_extend.GetPixel(x + 1, y).R;
                        data[6] = Graylevel_extend.GetPixel(x - 1, y + 1).R;
                        data[7] = Graylevel_extend.GetPixel(x, y + 1).R;
                        data[8] = Graylevel_extend.GetPixel(x + 1, y + 1).R;
                        int gx = FilterProcess(sobelX, data);
                        int gy = FilterProcess(sobelY, data);
                        datas3.Add(Math.Abs(gx) + Math.Abs(gy));
                        Combined.SetPixel(x - 1, y - 1, Color.FromArgb(image.GetPixel(x - 1, y - 1).A, 0, 0, 0));
                    }
                }
                Normalize(datas3, 255, Combined);
                Q5_pic    = Combined;
                Q5_source = image;
            }
            else
            {
                Debug.Print("extsit");
                Combined = Q5_pic;
            }
            Bitmap Graylevel_t = new Bitmap(Combined.Width, Combined.Height);
            Bitmap Overlap     = new Bitmap(Combined.Width, Combined.Height);

            for (int x = 0; x < Combined.Width; ++x)
            {
                for (int y = 0; y < Combined.Height; ++y)
                {
                    Color C = Combined.GetPixel(x, y);

                    Color t;
                    Color r;
                    if (C.B < threshold)
                    {
                        t = Color.FromArgb(C.A, 0, 0, 0);
                        r = Q5_source.GetPixel(x, y);
                    }
                    else
                    {
                        t = Color.FromArgb(C.A, 255, 255, 255);
                        r = Color.FromArgb(Q5_source.GetPixel(x, y).A, 0, 255, 0);
                    }

                    Graylevel_t.SetPixel(x, y, t);
                    Overlap.SetPixel(x, y, r);
                }
            }
            AddStack("Source", Q5_source, true, false, null);
            AddStack("Combined", Combined, true, false, null);
            AddStack("Threshold", Graylevel_t, true, false, null);
            AddStack("Overlap", Overlap, true, false, null);
            ++total_step;
        }
예제 #17
0
        public void References()
        {
            Combined value1 = new Combined();
            Combined value2 = new Combined();
            Combined value3 = new Combined();

            value1.obj2 = new object();
            value2.obj2 = value1.obj2;
            value3.obj2 = new object();

            Assert.That(value1 == value2);
            Assert.That(value1 != value3);
        }
예제 #18
0
        public static void Main(string[] args)
        {
            File.Copy("template/Tables.docx", "WordTables.docx", true);
            var dt = new DataTable();

            dt.Columns.Add("Col1");
            dt.Columns.Add("Col2");
            dt.Columns.Add("Col3");
            for (int i = 0; i < 100; i++)
            {
                dt.Rows.Add("a" + i, "b" + i, "c" + i);
            }
            var dt4 = new DataTable();

            dt4.Columns.Add("Name");
            dt4.Columns.Add("Description");
            //for (int i = 0; i < 10; i++)
            //dt4.Rows.Add("Name" + i, "Description" + i);
            var factory =
                Configuration.Builder
                .Include(Top10Rows)
                .Include <DataTable>(Limit10Table)
                .NavigateSeparator(':')
                .Include(LimitDataTable)
                .Include(CollapseNonEmpty)
                .Build();
            var dynamicResize1 = new object[7, 3] {
                { "a", "b", "c" },
                { "a", null, "c" },
                { "a", "b", null },
                { null, "b", "c" },
                { "a", null, null },
                { null, null, null },
                { "a", "b", "c" },
            };
            var dynamicResize2 = new object[7, 3] {
                { "a", "b", "c" },
                { null, null, "c" },
                { null, null, null },
                { null, "b", "c" },
                { "a", null, null },
                { null, "b", null },
                { "a", "b", null },
            };
            var map = new Dictionary <string, object>[] {
                new Dictionary <string, object> {
                    { "1", "a" }, { "2", "b" }, { "3", "c" }
                },
                new Dictionary <string, object> {
                    { "1", "a" }, { "2", null }, { "3", "c" }
                },
                new Dictionary <string, object> {
                    { "1", "a" }, { "2", "b" }, { "3", null }
                },
                new Dictionary <string, object> {
                    { "1", null }, { "2", "b" }, { "3", "c" }
                },
                new Dictionary <string, object> {
                    { "1", "a" }, { "2", null }, { "3", null }
                },
                new Dictionary <string, object> {
                    { "1", null }, { "2", null }, { "3", null }
                },
                new Dictionary <string, object> {
                    { "1", "a" }, { "2", "b" }, { "3", "c" }
                },
            };
            var combined = new Combined
            {
                Beers = new[]
                {
                    new Beer {
                        Name = "Heineken", Description = "Green and cold", Columns = new [, ] {
                            { "Light", "International" }
                        }
                    },
                    new Beer {
                        Name = "Leila", Description = "Blueish", Columns = new [, ] {
                            { "Blue", "Domestic" }
                        }
                    }
                },
                Headers = new[, ] {
                    { "Bottle", "Where" }
                }
            };
            var fixedItems = new Fixed[] {
                new Fixed {
                    Name = "A", Quantity = 1, Price = 42
                },
                new Fixed {
                    Name = "B", Quantity = 2, Price = 23
                },
                new Fixed {
                    Name = "C", Quantity = 3, Price = 505
                },
                new Fixed {
                    Name = "D", Quantity = 4, Price = 99
                },
                new Fixed {
                    Name = "E", Quantity = 5, Price = 199
                },
                new Fixed {
                    Name = "F", Quantity = 6, Price = 0
                },
                new Fixed {
                    Name = "G", Quantity = 7, Price = 7
                }
            };

            using (var doc = factory.Open("WordTables.docx"))
            {
                doc.Process(
                    new
                {
                    Table1                = dt,
                    Table2                = dt,
                    DynamicResize         = dynamicResize1,
                    DynamicResizeAndMerge = dynamicResize2,
                    Nulls    = map,
                    Table4   = dt4,
                    Combined = combined,
                    Fixed    = fixedItems
                });
            }
            Process.Start(new ProcessStartInfo("WordTables.docx")
            {
                UseShellExecute = true
            });
        }
예제 #19
0
 private void AddCombined(ViewportSetupFileViewModel model)
 {
     Combined.Add(model);
     CalculateStatus();
 }
예제 #20
0
        public static List <Smi> Combine(List <Smi> inputUpper, List <Smi> inputLower)
        {
            List <CombinedGroup> groups = new List <CombinedGroup>();
            CombinedGroup        lastGroup = new CombinedGroup();
            Combined             last = new Combined();
            int ui = 0, li = 0;

            while (ui < inputUpper.Count && li < inputLower.Count)
            {
                Smi uLine = inputUpper[ui];
                Smi lLine = inputLower[li];

                int comp = uLine.start - lLine.start;
                if (comp < 0)
                {
                    // 위 바뀜

                    if (last.lower.Length == 0)
                    {
                        // 아래가 빈 싱크인 상태로 위가 바뀜 -> 새 그룹
                        groups.Add((lastGroup = new CombinedGroup()));
                    }

                    lastGroup.combineds.Add((last = new Combined()
                    {
                        start = uLine.start,
                        syncType = uLine.syncType,
                        upper = uLine.text.Replace("&nbsp;", "").Length == 0 ? new string[] { } : Combined.ToLines(uLine.text),
                        lower = (string[])last.lower.Clone()
                    }));
                    if (last.upper.Length > lastGroup.upperLineCount)
                    {
                        lastGroup.upperLineCount = last.upper.Length;
                    }

                    ui++;
                }
                else if (comp > 0)
                {
                    // 아래 바뀜

                    if (last.upper.Length == 0)
                    {
                        // 위가 빈 싱크인 상태로 위가 바뀜 -> 새 그룹
                        groups.Add((lastGroup = new CombinedGroup()));
                    }

                    lastGroup.combineds.Add((last = new Combined()
                    {
                        start = lLine.start,
                        syncType = lLine.syncType,
                        upper = (string[])last.upper.Clone(),
                        lower = lLine.text.Replace("&nbsp;", "").Length == 0 ? new string[] { } : Combined.ToLines(lLine.text)
                    }));
                    if (last.lower.Length > lastGroup.lowerLineCount)
                    {
                        lastGroup.lowerLineCount = last.lower.Length;
                    }

                    li++;
                }
                else
                {
                    // 동시

                    // 새 그룹
                    groups.Add((lastGroup = new CombinedGroup()));

                    lastGroup.combineds.Add((last = new Combined()
                    {
                        start = uLine.start,
                        syncType = (uLine.syncType == SyncType.frame || lLine.syncType == SyncType.frame) ? SyncType.frame : SyncType.normal,
                        upper = uLine.text.Replace("&nbsp;", "").Length == 0 ? new string[] { } : Combined.ToLines(uLine.text),
                        lower = lLine.text.Replace("&nbsp;", "").Length == 0 ? new string[] { } : Combined.ToLines(lLine.text)
                    }));
                    lastGroup.upperLineCount = last.upper.Length;
                    lastGroup.lowerLineCount = last.lower.Length;

                    ui++; li++;
                }
            }
            for (; ui < inputUpper.Count; ui++)
            {
                Smi uLine = inputUpper[ui];

                if (last.lower.Length == 0)
                {
                    // 아래가 빈 싱크인 상태로 위가 바뀜 -> 새 그룹
                    groups.Add((lastGroup = new CombinedGroup()));
                }

                lastGroup.combineds.Add((last = new Combined()
                {
                    start = uLine.start,
                    syncType = uLine.syncType,
                    upper = uLine.text.Replace("&nbsp;", "").Length == 0 ? new string[] { } : Combined.ToLines(uLine.text),
                    lower = (string[])last.lower.Clone()
                }));
                if (last.upper.Length > lastGroup.upperLineCount)
                {
                    lastGroup.upperLineCount = last.upper.Length;
                }
            }
            for (; li < inputLower.Count; li++)
            {
                Smi lLine = inputLower[li];

                if (last.upper.Length == 0)
                {
                    // 위가 빈 싱크인 상태로 위가 바뀜 -> 새 그룹
                    groups.Add((lastGroup = new CombinedGroup()));
                }

                lastGroup.combineds.Add((last = new Combined()
                {
                    start = lLine.start,
                    syncType = lLine.syncType,
                    upper = (string[])last.upper.Clone(),
                    lower = lLine.text.Replace("&nbsp;", "").Length == 0 ? new string[] { } : Combined.ToLines(lLine.text)
                }));
                if (last.lower.Length > lastGroup.lowerLineCount)
                {
                    lastGroup.lowerLineCount = last.lower.Length;
                }
            }

            List <Smi> result = new List <Smi>();

            foreach (CombinedGroup group in groups)
            {
                foreach (Combined combined in group.combineds)
                {
                    int   maxUpperIndex = 0, maxLowerIndex = 0;
                    float maxUpperWidth = 0, maxLowerWidth = 0;
                    for (int i = 0; i < combined.upper.Length; i++)
                    {
                        float width = Smi.GetLineWidth(combined.upper[i]);
                        if (width > maxUpperWidth)
                        {
                            maxUpperIndex = i;
                            maxUpperWidth = width;
                        }
                    }
                    for (int i = 0; i < combined.lower.Length; i++)
                    {
                        float width = Smi.GetLineWidth(combined.lower[i]);
                        if (width > maxLowerWidth)
                        {
                            maxLowerIndex = i;
                            maxLowerWidth = width;
                        }
                    }

                    // 정렬용 글자 수 맞춰주기
                    if (combined.upper.Length > 0 && combined.lower.Length > 0)
                    {
                        if (maxUpperWidth > maxLowerWidth)
                        {
                            //string left = Smi.GetLineAppend(combined.lower[maxLowerIndex], maxUpperWidth, true);
                            string left = Width.GetAppend(Smi.GetLineWidth(combined.lower[maxLowerIndex]), maxUpperWidth, true);
                            if (left.Length > 0)
                            {
                                string right = Width.AppendToRight(left);
                                for (int i = 0; i < combined.lower.Length; i++)
                                {
                                    //combined.lower[i] = "<b></b>" + left + combined.lower[i] + right + "<b></b>";
                                    combined.lower[i] = left + combined.lower[i] + right;
                                }
                            }
                        }
                        else
                        {
                            //string left = Smi.GetLineAppend(combined.upper[maxUpperIndex], maxLowerWidth, true);
                            string left = Width.GetAppend(Smi.GetLineWidth(combined.upper[maxUpperIndex]), maxLowerWidth, true);
                            if (left.Length > 0)
                            {
                                string right = Width.AppendToRight(left);
                                for (int i = 0; i < combined.upper.Length; i++)
                                {
                                    //combined.upper[i] = "<b></b>" + left + combined.upper[i] + right + "<b></b>";
                                    combined.upper[i] = left + combined.upper[i] + right;
                                }
                            }
                        }
                    }

                    Smi smi = new Smi()
                    {
                        start    = combined.start,
                        syncType = combined.syncType,
                        text     = ""
                    };
                    for (int i = 0; i < group.upperLineCount - combined.upper.Length; i++)
                    {
                        smi.text += "<b> </b>" + (i < group.upperLineCount - 1 ? "<br>" : "");
                    }
                    for (int i = 0; i < combined.upper.Length; i++)
                    {
                        smi.text += combined.upper[i] + (i < combined.upper.Length - 1 ? "<br>" : "");
                    }
                    if (group.upperLineCount > 0 && group.lowerLineCount > 0)
                    {
                        smi.text += "<br>";
                    }
                    for (int i = 0; i < group.lowerLineCount - combined.lower.Length; i++)
                    {
                        smi.text += "<b> </b>" + (i < (group.lowerLineCount - 1) ? "<br>" : "");
                    }
                    for (int i = 0; i < combined.lower.Length; i++)
                    {
                        smi.text += combined.lower[i] + (i < (combined.lower.Length - 1) ? "<br>" : "");
                    }

                    if (smi.text.Length == 0)
                    {
                        smi.text = "&nbsp;";
                    }
                    else
                    {
                        if (smi.text.StartsWith(" ") || smi.text.StartsWith(" "))
                        {
                            smi.text = "​" + smi.text;
                        }
                        if (smi.text.EndsWith(" ") || smi.text.EndsWith(" "))
                        {
                            smi.text = smi.text + "​";
                        }
                    }

                    result.Add(smi);
                }
            }
            return(result);
        }
예제 #21
0
        public static void Main(string[] args)
        {
            File.Copy("template/Tables.docx", "WordTables.docx", true);
            var dt = new DataTable();

            dt.Columns.Add("Col1");
            dt.Columns.Add("Col2");
            dt.Columns.Add("Col3");
            for (int i = 0; i < 100; i++)
            {
                dt.Rows.Add("a" + i, "b" + i, "c" + i);
            }
            var dt4 = new DataTable();

            dt4.Columns.Add("Name");
            dt4.Columns.Add("Description");
            //for (int i = 0; i < 10; i++)
            //dt4.Rows.Add("Name" + i, "Description" + i);
            var factory =
                Configuration.Builder
                .Include(Top10Rows)
                .Include <DataTable>(Limit10Table)
                .Include(CollapseNonEmpty)
                .Build();
            var dynamicResize1 = new object[7, 3] {
                { "a", "b", "c" },
                { "a", null, "c" },
                { "a", "b", null },
                { null, "b", "c" },
                { "a", null, null },
                { null, null, null },
                { "a", "b", "c" },
            };
            var dynamicResize2 = new object[7, 3] {
                { "a", "b", "c" },
                { null, null, "c" },
                { null, null, null },
                { null, "b", "c" },
                { "a", null, null },
                { null, "b", null },
                { "a", "b", null },
            };
            var map = new Dictionary <string, object>[] {
                new Dictionary <string, object> {
                    { "1", "a" }, { "2", "b" }, { "3", "c" }
                },
                new Dictionary <string, object> {
                    { "1", "a" }, { "2", null }, { "3", "c" }
                },
                new Dictionary <string, object> {
                    { "1", "a" }, { "2", "b" }, { "3", null }
                },
                new Dictionary <string, object> {
                    { "1", null }, { "2", "b" }, { "3", "c" }
                },
                new Dictionary <string, object> {
                    { "1", "a" }, { "2", null }, { "3", null }
                },
                new Dictionary <string, object> {
                    { "1", null }, { "2", null }, { "3", null }
                },
                new Dictionary <string, object> {
                    { "1", "a" }, { "2", "b" }, { "3", "c" }
                },
            };
            var combined = new Combined
            {
                Beers = new[]
                {
                    new Beer {
                        Name = "Heineken", Description = "Green and cold", Columns = new [, ] {
                            { "Light", "International" }
                        }
                    },
                    new Beer {
                        Name = "Leila", Description = "Blueish", Columns = new [, ] {
                            { "Blue", "Domestic" }
                        }
                    }
                },
                Headers = new[, ] {
                    { "Bottle", "Where" }
                }
            };

            using (var doc = factory.Open("WordTables.docx"))
            {
                doc.Process(
                    new
                {
                    Table1                = dt,
                    Table2                = dt,
                    DynamicResize         = dynamicResize1,
                    DynamicResizeAndMerge = dynamicResize2,
                    Nulls    = map,
                    Table4   = dt4,
                    Combined = combined
                });
            }
            Process.Start("WordTables.docx");
        }
예제 #22
0
 /// <summary>
 ///   Compares to.
 /// </summary>
 /// <returns>The to.</returns>
 /// <param name="other">Other.</param>
 public int CompareTo(Utility other)
 {
     return(Combined.CompareTo(other.Combined));
 }
예제 #23
0
        public void cdrNight()
        {
            //string branch = TestContext.DataRow["Branch"].ToString();
            //string account = TestContext.DataRow["CustomerAcc"].ToString();
            //string transit = TestContext.DataRow["CustomerTransit"].ToString();
            string sequence = seq.ToString();
            //string action = TestContext.DataRow["Action"].ToString();

            // string branch = TestContext.DataRow["Date"].ToString();
            string branch  = "12345";
            string transit = TestContext.DataRow["Time"].ToString();
            string account = TestContext.DataRow["Sequence"].ToString();

            // string action = TestContext.DataRow["Classification"].ToString();

            Playback.PlaybackSettings.SendKeysAsScanCode = true;

            //if (branch.Length > 0 && account.Length == 0 && transit.Length == 0 && action.Equals("Open Branch"))
            //{
            //    this.UIMap.OpenBranchParams.UIItemEditText = branch; // assign branch transit text box value =12345
            //    this.UIMap.OpenBranch(); // call your recorded method
            //}

            Combined objCombinedClasses = new Combined();
            string   text = objCombinedClasses.PutCheck();

            if (text != branch)
            {
                DefferedDeposit objDefferedDeposit = new DefferedDeposit();
                objDefferedDeposit.CloseBranch();

                NightDeposit objNightDeposit = new NightDeposit();
                objNightDeposit.NightDepositTab();

                this.UIMap.OpenBranchParams.UIItemEditText = branch;           // assign branch transit text box value =12345
                this.UIMap.OpenBranch();                                       // call your recorded method

                this.UIMap.EnterAccandTransitParams.UIItemEditText  = account; //setting the values to account text box : values that you read from CSV file
                this.UIMap.EnterAccandTransitParams.UIItemEditText1 = transit; //setting the values to transit text box : values that you read from CSV file
                this.UIMap.EnterAccandTransit();                               // Call your method
                Playback.Wait(1000);
                //if (action.Equals("Match Envelope"))
                //{
                //    string newTransit = transit.Insert(5, "-");
                //    this.UIMap.SelectandMatchDepositParams.UIItemListSelectedItemsAsString = newTransit;
                //    this.UIMap.SelectandMatchDeposit();
                //    Playback.Wait(1000);

                //    this.UIMap.SaveDepositParams.UIItemEditText = sequence;
                //    this.UIMap.SaveDeposit();
                //    Playback.Wait(2000);
                //}
                //else if (action.Equals("New Deposit"))
                //{
                this.UIMap.NewDepositParams.UIItemEditText2 = sequence;     //seq number is a static variable : which is incremented by the constructor every time codedui executes a new row
                this.UIMap.NewDeposit();

                //}
            }
            else if (text == branch && account.Length > 0 && transit.Length > 0)
            {
                this.UIMap.EnterAccandTransitParams.UIItemEditText  = account; //setting the values to account text box : values that you read from CSV file
                this.UIMap.EnterAccandTransitParams.UIItemEditText1 = transit; //setting the values to transit text box : values that you read from CSV file
                this.UIMap.EnterAccandTransit();                               // Call your method
                Playback.Wait(1000);
                //if (action.Equals("Match Envelope"))
                //{
                //    string newTr  ansit = transit.Insert(5, "-");
                //    this.UIMap.SelectandMatchDepositParams.UIItemListSelectedItemsAsString = newTransit;
                //    this.UIMap.SelectandMatchDeposit();
                //    Playback.Wait(1000);

                //    this.UIMap.SaveDepositParams.UIItemEditText = sequence;
                //    this.UIMap.SaveDeposit();
                //    Playback.Wait(2000);
                //}
                //else if (action.Equals("New Deposit"))
                //{
                this.UIMap.NewDepositParams.UIItemEditText2 = sequence;     //seq number is a static variable : which is incremented by the constructor every time codedui executes a new row
                this.UIMap.NewDeposit();

                //}
            }
            //this.UIMap.CloseBranch();
            //this.UIMap.ExitCDR();
        }
예제 #24
0
 /// <summary>
 /// Returns a hash code for this instance.
 /// </summary>
 /// <returns>
 /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
 /// </returns>
 public override int GetHashCode()
 {
     return(Combined.GetHashCode());
 }