示例#1
0
        private void RenderMarkDown(string location)
        {
            // For now we have a quick and dirty MD renderer, need to search Nuget or write the full md creator.
            string txt = GetMarkDown(location);

            string[]        lines           = txt.Split(Environment.NewLine.ToCharArray());
            TextBlockHelper TBH             = new TextBlockHelper(xIntroTextBlock);
            SolidColorBrush foregroundColor = (SolidColorBrush) new BrushConverter().ConvertFromString((TryFindResource("@Skin1_ColorA")).ToString());

            foreach (string line in lines)
            {
                string l = line.Replace("```$GingerCore.eTermResKey.BusinessFlow$```", GingerDicser.GetTermResValue(eTermResKey.BusinessFlow));

                if (l.StartsWith("### "))
                {
                    l = line.Substring(4);
                    TBH.AddFormattedText(l, foregroundColor, true);
                }
                else if (l.Length == 0)
                {
                    TBH.AddLineBreak();
                }
                else
                {
                    TBH.AddFormattedText(l, foregroundColor);
                }
            }

            // xIntroTextBlock.Text = GetMarkDown(location);
        }
示例#2
0
        private void FillLogData()
        {
            //get the log file text
            using (StreamReader sr = new StreamReader(mLogFilePath))
            {
                mLogText = sr.ReadToEnd();
            }

            //cut all log not relevent to last application launch
            int indexOfStart = mLogText.LastIndexOf("######################## Application version");

            if (indexOfStart == -1)
            {
                indexOfStart = 0;
            }

            mLogText = mLogText.Substring(indexOfStart);

            //split the log per log info
            string[] logs = mLogText.Split(new[] { Environment.NewLine }, StringSplitOptions.None);

            xLogDetailsTextBlock.Text = string.Empty;
            mTextBlockHelper          = new TextBlockHelper(xLogDetailsTextBlock);
            foreach (string log in logs)
            {
                if (log == string.Empty)
                {
                    mTextBlockHelper.AddLineBreak();
                    continue;
                }
                else if (log.Contains("#### Application version"))
                {
                    mTextBlockHelper.AddFormattedText(log, Brushes.Black, true);
                }
                else if (log.Contains("| INFO  |"))
                {
                    mTextBlockHelper.AddFormattedText(log, Brushes.Blue);
                }
                else if (log.Contains("| DEBUG |"))
                {
                    mTextBlockHelper.AddFormattedText(log, Brushes.Purple);
                }
                else if (log.Contains("| WARN  |"))
                {
                    mTextBlockHelper.AddFormattedText(log, Brushes.Orange);
                }
                else if (log.Contains("| ERROR |") || log.Contains("| FATAL |"))
                {
                    mTextBlockHelper.AddFormattedText(log, Brushes.Red, isBold: true);
                }
                else
                {
                    mTextBlockHelper.AddText(log);
                }

                mTextBlockHelper.AddLineBreak();
            }
        }
示例#3
0
        private void SetCreditInfo()
        {
            txtCredit.Text = string.Empty;
            TextBlockHelper TBH             = new TextBlockHelper(txtCredit);
            SolidColorBrush foregroundColor = (SolidColorBrush) new BrushConverter().ConvertFromString((TryFindResource("$Color_DarkBlue")).ToString());

            TBH.AddFormattedText("Inventor, Chief Architect & Developer:", foregroundColor);
            TBH.AddLineBreak();
            TBH.AddFormattedText("Yaron Weiss", foregroundColor, true);
            TBH.AddLineBreak();
            TBH.AddLineBreak();
        }
示例#4
0
        private void SetApplicationInfo()
        {
            txtBlkApplicationInfo.Text = string.Empty;
            TextBlockHelper TBH = new TextBlockHelper(txtBlkApplicationInfo);

            SolidColorBrush foregroundColor = (SolidColorBrush) new BrushConverter().ConvertFromString((TryFindResource("$Color_DarkBlue")).ToString());

            //Application info
            TBH.AddFormattedText("Application:", foregroundColor, true);
            TBH.AddLineBreak();
            TBH.AddFormattedText(App.AppFullProductName, foregroundColor);
            TBH.AddLineBreak();
            TBH.AddFormattedText("Version: " + App.AppVersion, foregroundColor);
            TBH.AddLineBreak();
            TBH.AddFormattedText(App.ApplicationInfo.LegalCopyright, foregroundColor);
            TBH.AddLineBreak();
            TBH.AddFormattedText("All rights reserved.", foregroundColor);
            TBH.AddLineBreak();
            TBH.AddLineBreak();

            //Assembly Info
            TBH.AddFormattedText("Assembly Details:", foregroundColor, true);
            TBH.AddLineBreak();
            TBH.AddFormattedText("File Name: '" + App.ApplicationInfo.FileName + "'", foregroundColor);
            TBH.AddLineBreak();
            TBH.AddFormattedText("Build Time: " + App.AppBuildTime, foregroundColor);
        }
        private void DisplayAndColorTextRanges()
        {
            TextBlockHelper TBH               = new TextBlockHelper(xTextBlock);
            int             stringIndex       = 0;
            int             nodeToDeleteIndex = 0;

            while (stringIndex < mApplicationAPIModel.RequestBody.Length - 1 && nodeToDeleteIndex < mNodesToDeleteList.Count)
            {
                if (mNodesToDeleteList[nodeToDeleteIndex].stringNodeRange != null)
                {
                    if (stringIndex != mNodesToDeleteList[nodeToDeleteIndex].stringNodeRange.Item1) //No color
                    {
                        TBH.AddText(mApplicationAPIModel.RequestBody.Substring(stringIndex, mNodesToDeleteList[nodeToDeleteIndex].stringNodeRange.Item1 - stringIndex));
                        stringIndex = mNodesToDeleteList[nodeToDeleteIndex].stringNodeRange.Item1;
                    }
                    else //With color
                    {
                        TBH.AddFormattedText(mApplicationAPIModel.RequestBody.Substring(stringIndex, mNodesToDeleteList[nodeToDeleteIndex].stringNodeRange.Item2 - stringIndex), System.Windows.Media.Brushes.Red, true);
                        stringIndex = mNodesToDeleteList[nodeToDeleteIndex].stringNodeRange.Item2;
                        nodeToDeleteIndex++;
                    }
                }
            }

            if (stringIndex < mApplicationAPIModel.RequestBody.Length - 1)
            {
                TBH.AddText(mApplicationAPIModel.RequestBody.Substring(stringIndex, mApplicationAPIModel.RequestBody.Length - stringIndex));
            }
        }
        // AddEnvironmentWizard mWizard;
        public AddNewEnvIntroPage()
        {
            InitializeComponent();

            TextBlockHelper TBH = new TextBlockHelper(xNewEnvironmentIntroTxtBlock);

            SolidColorBrush foregroundColor = (SolidColorBrush)new BrushConverter().ConvertFromString((TryFindResource("$Color_DarkBlue")).ToString());
            //Application info
            TBH.AddFormattedText("For What Environments are Needed?", foregroundColor, true);
            TBH.AddLineBreak();            
            TBH.AddFormattedText("Environments are needed for storing data like: login credentials, DB/Unix servers connection information and similar details which changed per testing environments." , foregroundColor);
            TBH.AddLineBreak();
            TBH.AddFormattedText("Idea is that you will be able to map your automation flow to a generic detail of the Environment and then control the actual used data by simply changing the selected Environment to execute with", foregroundColor);
            TBH.AddLineBreak();
            TBH.AddLineBreak();
            TBH.AddLineBreak();
            TBH.AddFormattedText("How to Integrate Environment Details in Automation Flow?", foregroundColor, true);
            TBH.AddLineBreak();            
            TBH.AddFormattedText("Use the Value Expression editor for adding Environment value expression in any input field which support it", foregroundColor);
            TBH.AddLineBreak();
            TBH.AddLineBreak();
            TBH.AddLineBreak();
            TBH.AddFormattedText("Important to Know:", foregroundColor, true);
            TBH.AddLineBreak();            
            TBH.AddFormattedText("All configured Environments must have identical Applications/Params/DB/Unix names- only actual end point data value supposed to be different for each Environment ", foregroundColor);
            TBH.AddLineBreak();
            TBH.AddLineBreak();
            TBH.AddLineBreak();        
        }
        public AddPOMIntroWizardPage()
        {
            InitializeComponent();

            TextBlockHelper TBH = new TextBlockHelper(xNewPOMIntroTxtBlock);

            SolidColorBrush foregroundColor = (SolidColorBrush) new BrushConverter().ConvertFromString((TryFindResource("@Skin1_ColorA")).ToString());

            //Application info
            TBH.AddFormattedText("For What POMs is Needed?", foregroundColor, true);
            TBH.AddLineBreak();
            TBH.AddFormattedText("POMs are needed for storing page elementslike: Buttons, Textboxes and DropDown lists ect.", foregroundColor);
            TBH.AddLineBreak();
            TBH.AddFormattedText("Idea is that you will be able to maintain your page elements better and keep tracking on the elements availability in any case of the page elements properties changes to minimize failures during execution causes such changes and avoid duplications while using the same control on different acrtions", foregroundColor);
            TBH.AddLineBreak();
            TBH.AddLineBreak();
            TBH.AddLineBreak();
            TBH.AddFormattedText("How to Create a POM?", foregroundColor, true);
            TBH.AddLineBreak();
            TBH.AddFormattedText("You can create the POM by simply follow the Wizard and learn a spesific relevant page elements then you can filter founded elements list and select only the elements which neeeded to perform the automation", foregroundColor);
            TBH.AddLineBreak();
            TBH.AddLineBreak();
            TBH.AddLineBreak();
            TBH.AddFormattedText("How to Integrate POM in Automation Flow?", foregroundColor, true);
            TBH.AddLineBreak();
            TBH.AddFormattedText("After creating the POM Use the Element Action to perform operation on a spesific Page Element", foregroundColor);
            TBH.AddLineBreak();
            TBH.AddLineBreak();
            TBH.AddLineBreak();
        }
示例#8
0
        private void SetApplicationInfo()
        {
            txtBlkApplicationInfo.Text = string.Empty;
            TextBlockHelper TBH             = new TextBlockHelper(txtBlkApplicationInfo);
            SolidColorBrush foregroundColor = (SolidColorBrush) new BrushConverter().ConvertFromString((TryFindResource("$Color_DarkBlue")).ToString());

            //Application info
            TBH.AddFormattedText("Application:", foregroundColor, true);
            TBH.AddLineBreak();
            TBH.AddFormattedText(ApplicationInfo.ApplicationName, foregroundColor);
            TBH.AddLineBreak();
            TBH.AddFormattedText("Version: " + ApplicationInfo.ApplicationVersionWithInfo, foregroundColor);
            TBH.AddLineBreak();
            TBH.AddLineBreak();

            //Assembly Info
            TBH.AddFormattedText("Assembly Details:", foregroundColor, true);
            TBH.AddLineBreak();
            TBH.AddFormattedText("Build Time: " + ApplicationInfo.ApplicationBuildTime, foregroundColor);
        }
        public override void WriteLine(string value)
        {
            base.WriteLine(value);

            mTextBlock.Dispatcher.BeginInvoke(new Action(() =>
            {
                //TODO: add expander make it cooler
                //Expander exp = new Expander() { Width = 50, Height = 50 };
                //exp.Content = ...
                //mTextBlock.Inlines.Add(exp);

                if (value.Contains("ERROR") || value.Contains("FATAL"))
                {
                    //Label l = new Label() { Foreground = Brushes.Red };
                    //mTextBlock.Inlines.Add(l);
                    mTextBlockHelper.AddFormattedText(value.ToString() + Environment.NewLine, txtColor: Brushes.Red, isBold: true);
                    ErrorsCounter++;
                }
                else if (value.Contains("INFO"))
                {
                    //System.Windows.Shapes.Ellipse e = new System.Windows.Shapes.Ellipse() { Width = 10, Height = 10, Stroke = Brushes.Yellow, StrokeThickness = 2 };
                    //Label l = new Label() { Foreground = Brushes.Cyan };
                    //mTextBlock.Inlines.Add(l);
                    mTextBlockHelper.AddFormattedText(value.ToString() + Environment.NewLine, txtColor: Brushes.Cyan, isBold: false);
                }
                else if (value.Contains("WARN"))
                {
                    mTextBlockHelper.AddFormattedText(value.ToString() + Environment.NewLine, txtColor: Brushes.Orange, isBold: false);
                }
                else
                {
                    mTextBlockHelper.AddText(value.ToString() + Environment.NewLine);
                }

                //mTextBlock.Inlines.Add(value.ToString() + Environment.NewLine);
                ((ScrollViewer)mTextBlock.Parent).ScrollToEnd();
            }));
        }
        private void ShowVBSWarnHelp()
        {
            xHelpPanelText.Text = string.Empty;
            TextBlockHelper TBH = new TextBlockHelper(xHelpPanelText);

            TBH.AddUnderLineText("Help:");
            TBH.AddLineBreak();

            string msg = "Value Expression Contains VBS Operation."
                         + Environment.NewLine +
                         "VBS operations are slow and works only on Windows OS, please consider changing it to CS expression.";;

            TBH.AddFormattedText(msg, Brushes.OrangeRed);
        }
        private void RenderMarkDown(string location)
        {
            // For now we have a quick and dirty MD renderer, need to search Nuget or write the full md creator.
            string txt = GetMarkDown(location);

            string[]        lines = txt.Split(Environment.NewLine.ToCharArray());
            TextBlockHelper TBH   = new TextBlockHelper(xIntroTextBlock);

            TBH.AddLineBreak();
            SolidColorBrush foregroundColor = (SolidColorBrush) new BrushConverter().ConvertFromString((TryFindResource("$Color_DarkBlue")).ToString());

            foreach (string line in lines)
            {
                string l = line.Replace("```$GingerCore.eTermResKey.BusinessFlow$```", GingerDicser.GetTermResValue(eTermResKey.BusinessFlow));

                //Remove BOM (byte-order mark) Char if exists
                if (l.StartsWith(Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble()), StringComparison.Ordinal))
                {
                    l = l.Replace(Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble()), "");
                }

                if (l.StartsWith("### "))
                {
                    l = l.Substring(4);
                    TBH.AddFormattedText(l, foregroundColor, true);
                }
                else if (l.Length == 0)
                {
                    TBH.AddLineBreak();
                }
                else
                {
                    TBH.AddFormattedText(l, foregroundColor);
                }
            }
        }
示例#12
0
        private void SetMessageText()
        {
            UserMessaheTextBlock.Text = string.Empty;
            TextBlockHelper TBH = new TextBlockHelper(UserMessaheTextBlock);

            TBH.AddText("Source control conflicts has been identified for the path:");
            TBH.AddLineBreak();
            TBH.AddBoldText(mConflictPath);
            TBH.AddLineBreak();
            TBH.AddLineBreak();
            TBH.AddText("Conflicts are usually been created when 2 users working on the same item in parallel and one of the users check-in his changes.");
            TBH.AddLineBreak();
            TBH.AddLineBreak();
            TBH.AddFormattedText("You probably won't be able to use the item which mention in the path till conflicts will be resolved.", System.Windows.Media.Brushes.Red, true, true);
            TBH.AddLineBreak();
            TBH.AddLineBreak();
            TBH.AddText("Please select below if you want to keep your changes or get server changes for each conflict.");
        }
        private void FillExceptionData()
        {
            //General
            GeneralErrorDetailsTextBlock.Text = "Unexpected error occurred, please report it to Ginger Core Team along with all steps to reproduce.";

            //Full
            FullErrorDetailsTextBlock.Text = string.Empty;
            TextBlockHelper TBH = new TextBlockHelper(FullErrorDetailsTextBlock);

            TBH.AddBoldText("Message: ");
            TBH.AddFormattedText(mException.Message, System.Windows.Media.Brushes.Red, true);
            TBH.AddLineBreak();
            TBH.AddLineBreak();
            TBH.AddBoldText("Source: ");
            TBH.AddText(mException.Source);
            TBH.AddLineBreak();
            TBH.AddLineBreak();
            TBH.AddBoldText("Stack Trace: ");
            TBH.AddLineBreak();
            TBH.AddText(mException.StackTrace);
            TBH.AddLineBreak();
            TBH.AddLineBreak();
        }
示例#14
0
        private void FillLogData()
        {
            //get the log file text
            using (StreamReader sr = new StreamReader(mLogFilePath))
            {
                mLogText = sr.ReadToEnd();
            }

            //cut all log not relevent to last application launch
            int indexOfStart = mLogText.LastIndexOf("######################## Application version");

            if (indexOfStart == -1)
            {
                indexOfStart = 0;
            }

            mLogText = mLogText.Substring(indexOfStart);

            //split the log per log info
            string[] logs = mLogText.Split(new[] { Environment.NewLine }, StringSplitOptions.None);

            xLogDetailsTextBlock.Text = string.Empty;
            mTextBlockHelper          = new TextBlockHelper(xLogDetailsTextBlock);
            bool allowLogDetailsWrite = true;

            foreach (string log in logs)
            {
                if (log == string.Empty)
                {
                    if (allowLogDetailsWrite)
                    {
                        mTextBlockHelper.AddLineBreak();
                    }
                    continue;
                }
                else if (log.Contains("#### Application version"))
                {
                    mTextBlockHelper.AddFormattedText(log, Brushes.Black, true);
                }
                else if (IsLogHeader(log))
                {
                    if (mLogLevel == eLogShowLevel.ALL || log.Contains("| " + mLogLevel.ToString()))
                    {
                        mTextBlockHelper.AddFormattedText(log, GetProperLogTypeBrush(log), isBold: true);
                        mTextBlockHelper.AddLineBreak();
                        allowLogDetailsWrite = true;
                    }
                    else
                    {
                        allowLogDetailsWrite = false;
                    }
                }
                else
                {
                    if (allowLogDetailsWrite)
                    {
                        mTextBlockHelper.AddText(log);
                        mTextBlockHelper.AddLineBreak();
                    }
                }
            }
        }
        private void SetDependenciesHelper()
        {
            try
            {
                txtBlkDependenciesHelper.Text = string.Empty;
                TextBlockHelper TBH = new TextBlockHelper(txtBlkDependenciesHelper);

                //check if the mechanisem is enabeled
                switch (mDepededItemType)
                {
                case (eDependedItemsType.Actions):
                    if (((Activity)mParentObject).EnableActionsVariablesDependenciesControl == false)
                    {
                        TBH.AddFormattedText("The Actions-" + GingerDicser.GetTermResValue(eTermResKey.Variables) + " Dependencies control is disabled, in order to change the dependencies configurations you must enable it first.", Brushes.OrangeRed, true);
                        return;
                    }
                    break;

                case (eDependedItemsType.Activities):
                    if (((BusinessFlow)mParentObject).EnableActivitiesVariablesDependenciesControl == false)
                    {
                        TBH.AddFormattedText("The " + GingerDicser.GetTermResValue(eTermResKey.Activities) + "-" + GingerDicser.GetTermResValue(eTermResKey.Variables) + " Dependencies control is disabled, in order to change the dependencies configurations you must enable it first.", Brushes.OrangeRed, true);
                        return;
                    }
                    break;
                }


                //check for missing depended items/variables
                bool dependedItemsOrVarsAremissing = false;
                switch (mDepededItemType)
                {
                case (eDependedItemsType.Actions):
                    if (((Activity)mParentObject).Acts.Count == 0)
                    {
                        TBH.AddFormattedText("Add Actions to the " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " in order to configure dependencies.", Brushes.OrangeRed, true);
                        TBH.AddLineBreak();
                        dependedItemsOrVarsAremissing = true;
                    }
                    break;

                case (eDependedItemsType.Activities):
                    if (((BusinessFlow)mParentObject).Activities.Count == 0)
                    {
                        TBH.AddFormattedText("Add " + GingerDicser.GetTermResValue(eTermResKey.Activities) + " to the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " in order to configure dependencies.", Brushes.OrangeRed, true);
                        TBH.AddLineBreak();
                        dependedItemsOrVarsAremissing = true;
                    }
                    break;
                }

                if (mParentListVars == null || mParentListVars.Count == 0)
                {
                    switch (mDepededItemType)
                    {
                    case (eDependedItemsType.Actions):
                        TBH.AddFormattedText("Add " + GingerDicser.GetTermResValue(eTermResKey.Variables) + " from type 'Selection List' to the " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " in order to configure dependencies.", Brushes.OrangeRed, true);
                        break;

                    case (eDependedItemsType.Activities):
                        TBH.AddFormattedText("Add " + GingerDicser.GetTermResValue(eTermResKey.Variables) + " from type 'Selection List' to the " + GingerDicser.GetTermResValue(eTermResKey.BusinessFlow) + " in order to configure dependencies.", Brushes.OrangeRed, true);
                        break;
                    }
                    TBH.AddLineBreak();
                    dependedItemsOrVarsAremissing = true;
                }
                if (dependedItemsOrVarsAremissing)
                {
                    return;
                }

                //Set helper according to selected row
                DataRowView currentRow = (DataRowView)grdDependencies.grdMain.CurrentItem;
                if (currentRow != null)
                {
                    TBH.AddFormattedText("'" + currentRow.Row[0].ToString() + "'", null, true, true);
                    switch (mDepededItemType)
                    {
                    case (eDependedItemsType.Actions):
                        TBH.AddUnderLineText(" Action Dependencies Configurations Meaning:");
                        break;

                    case (eDependedItemsType.Activities):
                        TBH.AddUnderLineText(" " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " Dependencies Configurations Meaning:");
                        break;
                    }
                    TBH.AddLineBreak();
                    Dictionary <string, List <string> > actionConfigs = new Dictionary <string, List <string> >();
                    int colsIndex = 2;
                    foreach (VariableBase var in mParentListVars)
                    {
                        List <string> configuredVals = new List <string>();
                        foreach (OptionalValue optVal in ((VariableSelectionList)var).OptionalValuesList)
                        {
                            if ((bool)currentRow[colsIndex] == true)
                            {
                                configuredVals.Add(optVal.Value);
                            }
                            colsIndex++;
                        }
                        actionConfigs.Add(var.Name, configuredVals);
                    }
                    List <KeyValuePair <string, List <string> > > notConfiguredVars = actionConfigs.Where(d => d.Value.Count == 0).ToList();
                    if (notConfiguredVars.Count == 0)
                    {
                        switch (mDepededItemType)
                        {
                        case (eDependedItemsType.Actions):
                            TBH.AddText("The action will be executed only in case:");
                            break;

                        case (eDependedItemsType.Activities):
                            TBH.AddText("The " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " will be executed only in case:");
                            break;
                        }
                        TBH.AddLineBreak();
                        bool isFirst = true;
                        foreach (KeyValuePair <string, List <string> > configuredVar in actionConfigs)
                        {
                            if (!isFirst)
                            {
                                TBH.AddText("And");
                                TBH.AddLineBreak();
                            }
                            isFirst = false;
                            TBH.AddBoldText("'" + configuredVar.Key + "' ");
                            TBH.AddText(GingerDicser.GetTermResValue(eTermResKey.Variable) + " selected value is: ");
                            string vars = string.Empty;
                            foreach (string configVal in configuredVar.Value)
                            {
                                vars = vars + "'" + configVal + "' Or ";
                            }
                            vars = vars.Remove(vars.Length - 4, 4);
                            TBH.AddText(vars);
                            TBH.AddLineBreak();
                        }
                    }
                    else
                    {
                        switch (mDepededItemType)
                        {
                        case (eDependedItemsType.Actions):
                            TBH.AddFormattedText("The action won't be executed in any case because it missing dependency configurations for the " + GingerDicser.GetTermResValue(eTermResKey.Variable) + "/s: ", Brushes.OrangeRed, true);
                            break;

                        case (eDependedItemsType.Activities):
                            TBH.AddFormattedText("The " + GingerDicser.GetTermResValue(eTermResKey.Activity) + " won't be executed in any case because it missing dependency configurations for the " + GingerDicser.GetTermResValue(eTermResKey.Variable) + "/s: ", Brushes.OrangeRed, true);
                            break;
                        }
                        TBH.AddLineBreak();
                        foreach (KeyValuePair <string, List <string> > notConfiguredVar in notConfiguredVars)
                        {
                            TBH.AddFormattedText("'" + notConfiguredVar.Key + "'", Brushes.OrangeRed);
                            TBH.AddLineBreak();
                        }
                    }
                }
                else
                {
                    TBH.AddText("Select cell/row for information.");
                }
            }
            catch (Exception ex)
            {
                Reporter.ToLog(eLogLevel.ERROR, "Failed to set the " + mDepededItemType.ToString() + "-Variables dependencies helper text", ex);
            }
        }
示例#16
0
        private async Task FillLogData()
        {
            //get the log file text
            using (StreamReader sr = new StreamReader(Amdocs.Ginger.CoreNET.log4netLib.GingerLog.GingerLogFile))
            {
                mLogText = sr.ReadToEnd();
            }

            //cut all log not relevant to last application launch
            int indexOfStart = mLogText.LastIndexOf("######################## Application version");

            if (indexOfStart == -1)
            {
                indexOfStart = 0;
            }

            mLogText = mLogText.Substring(indexOfStart);

            //split the log per log info
            string[] logs = mLogText.Split(new[] { Environment.NewLine }, StringSplitOptions.None);

            xLogDetailsTextBlock.Text = string.Empty;
            mTextBlockHelper          = new TextBlockHelper(xLogDetailsTextBlock);
            bool allowLogDetailsWrite = true;
            int  start = logs.Length > NoOfLinesToShow ? logs.Length - NoOfLinesToShow : 0;

            for (int i = start; i < logs.Length; i++)
            {
                if (logs[i] == string.Empty)
                {
                    if (allowLogDetailsWrite)
                    {
                        mTextBlockHelper.AddLineBreak();
                    }
                    continue;
                }
                else if (logs[i].Contains("#### Application version"))
                {
                    mTextBlockHelper.AddFormattedText(logs[i], Brushes.Black, true);
                }
                else if (IsLogHeader(logs[i]))
                {
                    if (mLogLevel == eLogShowLevel.ALL || logs[i].Contains("| " + mLogLevel.ToString()))
                    {
                        mTextBlockHelper.AddFormattedText(logs[i], GetProperLogTypeBrush(logs[i]), isBold: true);
                        mTextBlockHelper.AddLineBreak();
                        allowLogDetailsWrite = true;
                    }
                    else
                    {
                        allowLogDetailsWrite = false;
                    }
                }
                else
                {
                    if (allowLogDetailsWrite)
                    {
                        mTextBlockHelper.AddText(logs[i]);
                        mTextBlockHelper.AddLineBreak();
                    }
                }
            }
        }