Exemplo n.º 1
0
        /// <summary>
        /// All button presses are routed via comamnds here which do execute one of these commands
        /// </summary>
        /// <returns></returns>
        private Dictionary <string, ICommand> CreateUICommands()
        {
            Dictionary <string, ICommand> commands = new Dictionary <string, ICommand>
            {
                { "LogSlow", CreateCommand(_ => Hooker.LogSlowEvent()) },
                { "LogFast", CreateCommand(_ => Hooker.LogFastEvent()) },
                { "Config", CreateCommand(_ => ShowConfigDialog()) },
                { "TraceRefresh", CreateCommand(_ =>
                    {
                        TraceSessions = LocalTraceControler.GetTraceSessions();
                        WCFHost.GetTraceSessions.Execute();
                    }) },
                { "StartTracing", CreateCommand(_ => StartTracing()) },
                { "StopTracing", CreateCommand(_ => StopTracing()) },
                { "CancelTracing", CreateCommand(_ => CancelTracing()) },
                { "RegisterETWProvider", CreateCommand(_ =>
                    {
                        string output = HookEvents.RegisterItself();
                        SetStatusMessage("Registering ETW provider: " + output);
                    }) },
                { "ConfigReset", CreateCommand(_ => {
                        Configuration.Default.Reset();
                        Configuration.Default.Save();
                        LoadSettings();
                    }) },
                { "ShowMessages", CreateCommand(_ => ShowMessages()) },
                { "NetworkSendToggle", CreateCommand(_ => NetworkSendState.NetworkSendChangeState()) },
                { "NetworkReceiveToggle", CreateCommand(_ => NetworkReceiveState.NetworkReceiveChangeState()) },
                { "ClearStatusMessages", CreateCommand(_ => StatusMessages.Clear()) },
                { "ShowCommandLineOptions", CreateCommand(_ => ShowCommandLineOptions()) },
                { "About", CreateCommand(_ => AboutBox()) },
            };


            return(commands);
        }