Example #1
0
        internal static bool Find(UISheet currentSheet, string text, bool isResetStartPoint, bool isMatchCase, bool isMatchWholeWord, out bool isReachedSearchStart)
        {
            isReachedSearchStart = false;
            //if (currentLinkedNode == null)
            var currentLinkedNode = currentSheet.dataGridView1.CurrentCell.Tag as LinkedListNode<FindTag>;
            if (isResetStartPoint || searchStartLinkedNode == null)
                searchStartLinkedNode = currentLinkedNode;

            var current = GetNextLinkedNode(currentLinkedNode);
            if (!isMatchCase)
                text = text.ToLower();
            bool bReturn = false;

            while (current != searchStartLinkedNode)
            {
                string cellText = current.Value.DataGridViewCell.Value?.ToString();
                if (cellText == null)
                    cellText = "";
                if (!isMatchCase)
                    cellText = cellText.ToLower();
                if (isMatchWholeWord)
                {
                    if (cellText == text)
                        bReturn = true;
                }
                else
                {
                    if (cellText.Contains(text))
                        bReturn = true;
                }
                if (bReturn)
                    current.Value.Select();
                if (current.Next == null)
                    current = findTagLinkedList.First;
                current = current.Next;
                if (bReturn)
                {
                    currentLinkedNode = current;
                    return true;
                }
            }

            if (!isResetStartPoint)
                isReachedSearchStart = true;

            return false;
        }
Example #2
0
        //internal DocmentEditorPane EditorPane { get; set; }
        internal void InitUI(ExcelCodeConfig excelCodeConfig)
        {
            this.ExcelCodeConfig = excelCodeConfig;
            this.tabControl1.TabPages.Clear();

            if (excelCodeConfig != null)
            {
                ExcelConfig = ExcelConfig.LoadConfig(excelCodeConfig.AbsoluteFileName);
                if (ExcelConfig != null)
                {
                    excelCodeConfig.ExcelConfig = this.ExcelConfig;
                    foreach (var sheetConfig in ExcelConfig.SheetConfigData.Values)
                    {
                        UISheet uiSheet = new UISheet();
                        //uiSheet.EditorPane = EditorPane;
                        uiSheet.Dock = DockStyle.Fill;
                        uiSheet.SetSheetConfig(sheetConfig, excelCodeConfig);

                        TabPage tabPage = new TabPage(sheetConfig.Name);
                        tabPage.Tag = uiSheet;
                        tabPage.Controls.Add(uiSheet);
                        tabControl1.TabPages.Add(tabPage);
                    }
                }
            }
        }