Exemplo n.º 1
0
        /// <summary>
        /// Filters search items, if category was selected.
        /// </summary>
        internal void Filter()
        {
            var allowedCategories = SearchCategories.Where(cat => cat.IsSelected);

            FilteredResults = searchResults.Where(x => allowedCategories
                                                  .Select(cat => cat.Name)
                                                  .Contains(x.Category));

            // Report selected categories to instrumentation
            StringBuilder strBuilder = new StringBuilder();

            foreach (var category in SearchCategories)
            {
                strBuilder.Append(category.Name);
                strBuilder.Append(" : ");
                if (category.IsSelected)
                {
                    strBuilder.Append("Selected");
                }
                else
                {
                    strBuilder.Append("Unselected");
                }
                strBuilder.Append(", ");
            }

            InstrumentationLogger.LogPiiInfo("Filter-categories", strBuilder.ToString().Trim());
        }
Exemplo n.º 2
0
        protected virtual void OnClicked()
        {
            if (Clicked != null)
            {
                var nodeModel = Model.CreateNode();
                Clicked(nodeModel, Position);

                InstrumentationLogger.LogPiiInfo("Search-NodeAdded", FullName);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Log the message to the the correct path
        /// </summary>
        /// <param name="message"></param>
        private void Log(string message, LogLevel level, bool reportModification)
        {
            lock (this.guardMutex)
            {
                //Don't overwhelm the logging system
                if (debugSettings.VerboseLogging)
                {
                    InstrumentationLogger.LogPiiInfo("LogMessage-" + level.ToString(), message);
                }

                switch (level)
                {
                //write to the console
                case LogLevel.Console:
                    if (ConsoleWriter != null)
                    {
                        try
                        {
                            ConsoleWriter.AppendLine(string.Format("{0}", message));
                            FileWriter.WriteLine(string.Format("{0} : {1}", DateTime.Now, message));
                            FileWriter.Flush();
                            RaisePropertyChanged("ConsoleWriter");
                        }
                        catch
                        {
                            // likely caught if the writer is closed
                        }
                    }
                    break;

                //write to the file
                case LogLevel.File:
                    if (FileWriter != null)
                    {
                        try
                        {
                            FileWriter.WriteLine(string.Format("{0} : {1}", DateTime.Now, message));
                            FileWriter.Flush();
                        }
                        catch
                        {
                            // likely caught if the writer is closed
                        }
                    }
                    break;
                }

                if (reportModification)
                {
                    RaisePropertyChanged("LogText");
                }
            }
        }
Exemplo n.º 4
0
        public CrashPrompt(CrashPromptArgs args, DynamoViewModel dynamoViewModel)
        {
            InitializeComponent();

            productName            = dynamoViewModel.BrandingResourceProvider.ProductName;
            Title                  = string.Format(Wpf.Properties.Resources.CrashPromptDialogTitle, productName);
            txtOverridingText.Text = string.Format(Wpf.Properties.Resources.CrashPromptDialogCrashMessage, productName);

            InstrumentationLogger.LogAnonymousEvent("CrashPrompt", "Stability");
            StabilityTracking.GetInstance().NotifyCrash();

            if (args.HasDetails())
            {
                this.details = args.Details;
                this.CrashDetailsContent.Text = args.Details;
                this.btnDetails.Visibility    = Visibility.Visible;

                InstrumentationLogger.LogPiiInfo("CrashPrompt", args.Details);
            }
            else
            {
                InstrumentationLogger.LogPiiInfo("CrashPrompt", args.Details);
            }

            if (args.IsFilePath())
            {
                folderPath = Path.GetDirectoryName(args.FilePath);
                btnOpenFolder.Visibility = Visibility.Visible;
            }

            if (args.IsDefaultTextOverridden())
            {
                string overridingText = args.OverridingText;

                if (args.IsFilePath())
                {
                    overridingText = overridingText.Replace("[FILEPATH]", args.FilePath);
                }

                ConvertFormattedTextIntoTextblock(this.txtOverridingText, overridingText);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        ///     Performs a search and updates the observable SearchResults property.
        /// </summary>
        /// <param name="query"> The search query </param>
        public void SearchAndUpdateResults(string query)
        {
            if (Visible != true)
            {
                return;
            }

            InstrumentationLogger.LogPiiInfo("Search", query);

            // if the search query is empty, go back to the default treeview
            if (string.IsNullOrEmpty(query))
            {
                return;
            }

            var foundNodes = Search(query);

            RaisePropertyChanged("SearchRootCategories");

            SearchResults = new ObservableCollection <NodeSearchElementViewModel>(foundNodes);
            RaisePropertyChanged("SearchResults");
        }
Exemplo n.º 6
0
        public CrashPrompt(CrashPromptArgs args)
        {
            InitializeComponent();

            InstrumentationLogger.LogAnonymousEvent("CrashPrompt", "Stability");
            StabilityTracking.GetInstance().NotifyCrash();

            if (args.HasDetails())
            {
                this.details = args.Details;
                this.CrashDetailsContent.Text = args.Details;
                this.btnDetails.Visibility    = Visibility.Visible;

                InstrumentationLogger.LogPiiInfo("CrashPrompt", args.Details);
            }
            else
            {
                InstrumentationLogger.LogPiiInfo("CrashPrompt", args.Details);
            }

            if (args.IsFilePath())
            {
                folderPath = Path.GetDirectoryName(args.FilePath);
                btnOpenFolder.Visibility = Visibility.Visible;
            }

            if (args.IsDefaultTextOverridden())
            {
                string overridingText = args.OverridingText;

                if (args.IsFilePath())
                {
                    overridingText = overridingText.Replace("[FILEPATH]", args.FilePath);
                }

                ConvertFormattedTextIntoTextblock(this.txtOverridingText, overridingText);
            }
        }