Exemple #1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="browser"></param>
        public OpenWebBrowserFunction(ClientBrowser browser)
        {
            if (browser == null)
            {
                throw new ArgumentNullException("browser");
            }

            Browser = browser;
        }
Exemple #2
0
 /// <summary>
 /// Open the walli homepage in a browser.
 /// </summary>
 /// <param name="sender">Object that raised the event.</param>
 /// <param name="e">Event arguments.</param>
 private void Hyperlink_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (App.Wait("Opening home page..."))
             ClientBrowser.GetDefaultBrowser().OpenUrl("https://github.com/natewallace/walli");
     }
     catch
     {
     }
 }
 /// <summary>
 /// Display apex documentation site.
 /// </summary>
 public override void Execute()
 {
     try
     {
         using (App.Wait("Opening apex reference..."))
             ClientBrowser.GetDefaultBrowser().OpenUrl("http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm");
     }
     catch
     {
     }
 }
Exemple #4
0
 /// <summary>
 /// Display user guide.
 /// </summary>
 public override void Execute()
 {
     try
     {
         using (App.Wait("Opening user guide..."))
             ClientBrowser.GetDefaultBrowser().OpenUrl("https://github.com/natewallace/walli/wiki");
     }
     catch
     {
     }
 }
Exemple #5
0
        public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter)
        {
            try
            {
                if (!IsEnabled(logLevel))
                {
                    return;
                }

                // If level is debug, information or warning, stop here, do not go any further
                if (logLevel == LogLevel.Debug || logLevel == LogLevel.Information || logLevel == LogLevel.Warning)
                {
                    //TODO: Write log to log file here
                    return;
                }

                if (formatter == null)
                {
                    throw new ArgumentNullException(nameof(formatter));
                }

                var message = exception == null?
                              formatter(state, exception) :
                                  $"{formatter(state, exception)}{Environment.NewLine}{Environment.NewLine}{exception}";

                if (string.IsNullOrWhiteSpace(message))
                {
                    return;
                }

                HttpContext   httpContext = null;
                string        hostAddress = string.Empty;
                ClientBrowser browser     = null;
                string        userName    = null;

                var httpContextAccessor = _services.GetRequiredService <IHttpContextAccessor>();
                if (httpContextAccessor != null)
                {
                    httpContext = httpContextAccessor.HttpContext;
                    if (httpContext != null)
                    {
                        hostAddress = httpContext.Request.Host.Value;
                        var userAgent = httpContext.Request.Headers["User-Agent"];
                        browser = userAgent == string.Empty ? null : new UserAgent(userAgent).Browser;

                        // Get value of Authorization header
                        var authHeaders = httpContext.Request.Headers["Authorization"];

                        // Get the JWT token
                        var jwtToken = authHeaders[0].Split(' ')[1];

                        if (!string.IsNullOrWhiteSpace(jwtToken))
                        {
                            // Decrypt the token
                            var decrytedToken = new JwtSecurityToken(jwtToken);

                            // Return claims
                            var claims = decrytedToken.Claims.ToList();

                            var email     = claims.FirstOrDefault(c => c.Type == "email")?.Value ?? string.Empty;
                            var companyNo = claims.FirstOrDefault(c => c.Type == "companyNo")?.Value ?? string.Empty;

                            //userName = $"Company: {companyNo}; Email: {email}";
                            userName = $"Company: {companyNo}";
                        }
                    }
                }

                var model = new TEntity
                {
                    Browser     = browser == null ? "" : browser.Name + " " + browser.Version,
                    Username    = userName,
                    Url         = httpContext == null ? "" : httpContext.Request.Path.Value,
                    Date        = DateTime.UtcNow,
                    Message     = Trim(message, MaximumMessageLength),
                    Level       = Trim($"{logLevel}", MaxLoggerLength),
                    Logger      = Trim($"{_name}", MaxLoggerLength),
                    Thread      = Trim($"{eventId}", MaxThreadLength),
                    HostAddress = Trim($"{hostAddress}", MaxHostLength)
                };

                switch (logLevel)
                {
                case LogLevel.Critical:
                case LogLevel.Error:
                    if (exception != null)
                    {
                        var exceptionPosition = GetExceptionPosition(exception);
                        model.ExceptionType = exception.GetType().Name;
                        model.Method        = exceptionPosition.Method;
                        model.Row           = exceptionPosition.Row;
                        model.Column        = exceptionPosition.Column;
                        model.Exception     = Trim($"{exception}", AppLog.MaximumExceptionLength);
                        // Save log to database:
                        // SaveLogToDB(model);
                        // Only send mail when there is an exception on production env:
                        //if (model.HostAddress.Contains("secure.complyto.com"))
                        //{
                        SendEmailReport(model);
                        //}
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Exemple #6
0
        private void WorkerDoWork(object sender, DoWorkEventArgs e)
        {
            CreateWcfClient();

            AddMessageLineSafe("Сравнение версий");
            var newOnly     = (bool)e.Argument;
            var clientFiles = newOnly ? ClientBrowser.GetFileVersions() : new List <FileVersion>();

            var serverFiles = ServerBrowser.GetFileVersions(targetSystem);

            if (serverFiles.Count == 0)
            {
                LogHelper.InfoFormat("{0} файлов на клиенте, файлов на сервере нет", clientFiles.Count);
                return;
            }

            var lackFiles = ClientBrowser.CompareWithServer(serverFiles, clientFiles);

            if (lackFiles.Count == 0)
            {
                LogHelper.InfoFormat("{0} файлов на клиенте, {1} файлов на сервере - нет файлов для обновления",
                                     clientFiles.Count,
                                     serverFiles.Count);
                return;
            }

            AddMessageLineSafe(string.Format("{0} файлов нуждаются в обновлении" + Environment.NewLine, lackFiles.Count));
            var msg = "Загрузка следующих обновлений:" + Environment.NewLine +
                      string.Join(Environment.NewLine, lackFiles);

            AddMessageLineSafe(msg);
            LogHelper.Info(msg);

            var            percent = 0;
            IUpdateManager channel = null;

            ReportProgressForLocalServerUnitManager(0, lackFiles.Count, false);

            var updatedCount = 0;

            foreach (var file in lackFiles)
            {
                if (worker.CancellationPending)
                {
                    break;
                }
                var fileClientPath = string.Format("{0}{1}", ClientBrowser.ownPath, file); // абсолютное имя файла на клиенте
                var targetDir      = Path.GetDirectoryName(fileClientPath);
                try
                {
                    if (!Directory.Exists(targetDir))
                    {
                        Directory.CreateDirectory(targetDir);
                    }
                }
                catch (Exception ex)
                {
                    LogHelper.ErrorFormat("Error creating directory {0}: {1}", targetDir, ex);
                    continue;
                }

                if (!TryDownloadFile(file, fileClientPath, ref channel))
                {
                    DisplayError();
                }
                else
                {
                    AddMessageLineSafe("Обновлен " + file.FileName);
                    LogHelper.Info("Обновлен " + file.FileName);
                }
                worker.ReportProgress(100 * (++percent) / lackFiles.Count);

                updatedCount++;
                ReportProgressForLocalServerUnitManager(updatedCount, lackFiles.Count - updatedCount, false);
            }

            ReportProgressForLocalServerUnitManager(lackFiles.Count, 0, true);
        }
        /// <summary>
        /// Load functions for this application.
        /// </summary>
        public void LoadFunctions()
        {
            //
            // SYSTEM
            //

            NewProjectFunction newLocalProject = new NewProjectFunction();

            App.Instance.Menu.AddFunction(newLocalProject, "SYSTEM", 0);
            App.Instance.ToolBar.AddFunction(newLocalProject);

            OpenProjectFunction openLocalProject = new OpenProjectFunction();

            App.Instance.Menu.AddFunction(openLocalProject, "SYSTEM", 1);
            App.Instance.ToolBar.AddFunction(openLocalProject);

            CloseProjectFunction closeLocalProject = new CloseProjectFunction();

            App.Instance.Menu.AddFunction(closeLocalProject, "SYSTEM", 2);

            DeleteProjectFunction deleteProject = new DeleteProjectFunction();

            App.Instance.Menu.AddFunction(deleteProject, "SYSTEM", 3);

            //
            // PROJECT | New
            //

            App.Instance.Menu.AddFunction(new FunctionGrouping("NEWSALESFORCE", "New", true), "PROJECT");

            NewClassFunction newClassFunction = new NewClassFunction();

            App.Instance.Menu.AddFunction(newClassFunction, "NEWSALESFORCE");
            App.Instance.RegisterFunction(newClassFunction);

            NewTriggerFunction newTriggerFunction = new NewTriggerFunction();

            App.Instance.Menu.AddFunction(newTriggerFunction, "NEWSALESFORCE");
            App.Instance.RegisterFunction(newTriggerFunction);

            NewPageFunction newPageFunction = new NewPageFunction();

            App.Instance.Menu.AddFunction(newPageFunction, "NEWSALESFORCE");
            App.Instance.RegisterFunction(newPageFunction);

            NewComponentFunction newComponentFunction = new NewComponentFunction();

            App.Instance.Menu.AddFunction(newComponentFunction, "NEWSALESFORCE");
            App.Instance.RegisterFunction(newComponentFunction);

            NewManifestFunction newManifestFunction = new NewManifestFunction();

            App.Instance.Menu.AddFunction(newManifestFunction, "NEWSALESFORCE");
            App.Instance.RegisterFunction(newManifestFunction);

            NewSnippetSystemFunction newSnippetSystemFunction = new NewSnippetSystemFunction();

            App.Instance.Menu.AddFunction(newSnippetSystemFunction, "NEWSALESFORCE");
            App.Instance.RegisterFunction(newSnippetSystemFunction);

            NewSnippetProjectFunction newSnippetProjectFunction = new NewSnippetProjectFunction();

            App.Instance.Menu.AddFunction(newSnippetProjectFunction, "NEWSALESFORCE");
            App.Instance.RegisterFunction(newSnippetProjectFunction);

            //
            // PROJECT | Team
            //

            App.Instance.Menu.AddFunction(new FunctionGrouping("TEAMSALESFORCE", "Team", true), "PROJECT");

            ConfigureSourceControlFunction sourceControlFunction = new ConfigureSourceControlFunction();

            App.Instance.Menu.AddFunction(sourceControlFunction, "TEAMSALESFORCE");

            CheckoutFolderFunction checkoutFolderFunction = new CheckoutFolderFunction();

            App.Instance.Menu.AddFunction(checkoutFolderFunction, "TEAMSALESFORCE");

            CheckoutHistoryFunction checkoutHistoryFunction = new CheckoutHistoryFunction();

            App.Instance.Menu.AddFunction(new FunctionSeparator(checkoutHistoryFunction), "TEAMSALESFORCE");
            App.Instance.Menu.AddFunction(checkoutHistoryFunction, "TEAMSALESFORCE");
            App.Instance.RegisterFunction(checkoutHistoryFunction);

            CheckoutFileFunction checkoutFileFunction = new CheckoutFileFunction();

            App.Instance.Menu.AddFunction(checkoutFileFunction, "TEAMSALESFORCE");
            App.Instance.RegisterFunction(checkoutFileFunction);

            CheckinFileFunction checkinFileFunction = new CheckinFileFunction();

            App.Instance.Menu.AddFunction(checkinFileFunction, "TEAMSALESFORCE");
            App.Instance.RegisterFunction(checkinFileFunction);

            CheckoutFileUndoFunction checkoutFileUndoFunction = new CheckoutFileUndoFunction();

            App.Instance.Menu.AddFunction(checkoutFileUndoFunction, "TEAMSALESFORCE");
            App.Instance.RegisterFunction(checkoutFileUndoFunction);

            CheckoutFileHistoryFunction checkoutFileHistoryFunction = new CheckoutFileHistoryFunction();

            App.Instance.Menu.AddFunction(checkoutFileHistoryFunction, "TEAMSALESFORCE");
            App.Instance.RegisterFunction(checkoutFileHistoryFunction);

            //
            // PROJECT | Open Web Browser
            //

            App.Instance.Menu.AddFunction(new FunctionGrouping("Open Web Browser", "Open Web Browser", true), "PROJECT");
            if (ClientBrowser.GetInstalledBrowsers().Length == 0)
            {
                OpenWebBrowserFunction webBrowser = new OpenWebBrowserFunction(ClientBrowser.GetDefaultBrowser());
                App.Instance.Menu.AddFunction(webBrowser, "Open Web Browser");
            }
            else
            {
                foreach (ClientBrowser cb in ClientBrowser.GetInstalledBrowsers())
                {
                    OpenWebBrowserFunction webBrowser = new OpenWebBrowserFunction(cb);
                    App.Instance.Menu.AddFunction(webBrowser, "Open Web Browser");
                }
            }

            OpenRecentWebBrowserFunction recentWebBrowserFunction = new OpenRecentWebBrowserFunction();

            App.Instance.ToolBar.AddFunction(new FunctionSeparator(recentWebBrowserFunction));
            App.Instance.ToolBar.AddFunction(recentWebBrowserFunction);

            //
            // Project | Test
            //

            App.Instance.Menu.AddFunction(new FunctionGrouping("TESTSALESFORCE", "Test", true), "PROJECT");

            TestManagerFunction testManager = new TestManagerFunction();

            App.Instance.Menu.AddFunction(testManager, "TESTSALESFORCE");

            CodeCoverageAllFunction codeCoverageAllFunction = new CodeCoverageAllFunction();

            App.Instance.Menu.AddFunction(codeCoverageAllFunction, "TESTSALESFORCE");

            SearchFilesFunction searchFilesFunction = new SearchFilesFunction();

            App.Instance.ToolBar.AddFunction(searchFilesFunction);
            App.Instance.Menu.AddFunction(searchFilesFunction, "PROJECT");

            DataEditFunction dataEdit = new DataEditFunction();

            App.Instance.ToolBar.AddFunction(dataEdit);
            App.Instance.Menu.AddFunction(dataEdit, "PROJECT");

            NewReportFunction newReport = new NewReportFunction();

            App.Instance.Menu.AddFunction(newReport, "PROJECT");

            MergeManifestFunction mergeManifestFunction = new MergeManifestFunction();

            App.Instance.Menu.AddFunction(mergeManifestFunction, "PROJECT");
            App.Instance.RegisterFunction(mergeManifestFunction);

            LogViewerFunction logViewerFunction = new LogViewerFunction();

            App.Instance.Menu.AddFunction(logViewerFunction, "PROJECT");
            App.Instance.ToolBar.AddFunction(logViewerFunction);

            ReloadSymbolsFunction reloadSymbols = new ReloadSymbolsFunction();

            App.Instance.Menu.AddFunction(reloadSymbols, "PROJECT");

            ResetSearchIndexFunction resetSearchIndexFunction = new ResetSearchIndexFunction();

            App.Instance.Menu.AddFunction(resetSearchIndexFunction, "PROJECT");

            PropertiesFunction propertiesSourceFileFunction = new PropertiesFunction();

            App.Instance.Menu.AddFunction(new FunctionSeparator(propertiesSourceFileFunction), "PROJECT");

            DeleteSourceFileFunction deleteSourceFileFunction = new DeleteSourceFileFunction();

            App.Instance.Menu.AddFunction(deleteSourceFileFunction, "PROJECT");
            App.Instance.RegisterFunction(deleteSourceFileFunction);

            DeleteManifestFunction deleteManifestFunction = new DeleteManifestFunction();

            App.Instance.Menu.AddFunction(deleteManifestFunction, "PROJECT");
            App.Instance.RegisterFunction(deleteManifestFunction);

            DeletePackageFunction deletePackageFunction = new DeletePackageFunction();

            App.Instance.Menu.AddFunction(deletePackageFunction, "PROJECT");
            App.Instance.RegisterFunction(deletePackageFunction);

            DeleteSnippetFunction deleteSnippetFunction = new DeleteSnippetFunction();

            App.Instance.Menu.AddFunction(deleteSnippetFunction, "PROJECT");
            App.Instance.RegisterFunction(deleteSnippetFunction);

            RefreshFolderFunction refreshFolderFunction = new RefreshFolderFunction();

            App.Instance.RegisterFunction(refreshFolderFunction);

            IndexFileFunction indexFileFunction = new IndexFileFunction();

            App.Instance.Menu.AddFunction(indexFileFunction, "PROJECT");
            App.Instance.RegisterFunction(indexFileFunction);

            App.Instance.Menu.AddFunction(propertiesSourceFileFunction, "PROJECT");
            App.Instance.RegisterFunction(propertiesSourceFileFunction);

            //ViewCheckpointsFunction viewCheckpointsFunction = new ViewCheckpointsFunction();
            //App.Instance.Menu.AddFunction(viewCheckpointsFunction, "PROJECT");
            //App.Instance.ToolBar.AddFunction(viewCheckpointsFunction);

            //
            // DOCUMENT
            //

            ExecuteDataQueryFunction executeQueryFunction = new ExecuteDataQueryFunction();

            App.Instance.ToolBar.AddFunction(new FunctionSeparator(executeQueryFunction));
            App.Instance.ToolBar.AddFunction(executeQueryFunction);
            App.Instance.Menu.AddFunction(executeQueryFunction, "DOCUMENT");

            SaveSnippetFunction saveSnippetFunction = new SaveSnippetFunction();

            App.Instance.ToolBar.AddFunction(new FunctionSeparator(saveSnippetFunction));
            App.Instance.ToolBar.AddFunction(saveSnippetFunction);
            App.Instance.Menu.AddFunction(saveSnippetFunction, "DOCUMENT");

            RefreshSnippetFunction refreshSnippetFunction = new RefreshSnippetFunction();

            App.Instance.ToolBar.AddFunction(refreshSnippetFunction);
            App.Instance.Menu.AddFunction(refreshSnippetFunction, "DOCUMENT");

            ExecuteSnippetFunction executeSnippetFunction = new ExecuteSnippetFunction();

            App.Instance.ToolBar.AddFunction(executeSnippetFunction);
            App.Instance.Menu.AddFunction(executeSnippetFunction, "DOCUMENT");
            App.Instance.RegisterFunction(executeSnippetFunction);

            CommitDataChangesFunction commitDataFunction = new CommitDataChangesFunction();

            App.Instance.ToolBar.AddFunction(commitDataFunction);
            App.Instance.Menu.AddFunction(commitDataFunction, "DOCUMENT");

            ExportDataResultFunction exportData = new ExportDataResultFunction();

            App.Instance.ToolBar.AddFunction(exportData);
            App.Instance.Menu.AddFunction(exportData, "DOCUMENT");

            NewManifestFromReportFunction manifestReport = new NewManifestFromReportFunction();

            App.Instance.ToolBar.AddFunction(new FunctionSeparator(manifestReport));
            App.Instance.ToolBar.AddFunction(manifestReport);
            App.Instance.Menu.AddFunction(manifestReport, "DOCUMENT");

            MergeManifestFromReportFunction manifestMergeReport = new MergeManifestFromReportFunction();

            App.Instance.ToolBar.AddFunction(manifestMergeReport);
            App.Instance.Menu.AddFunction(manifestMergeReport, "DOCUMENT");

            SelectReportItemsNoneFunction selectNoneReportFunction = new SelectReportItemsNoneFunction();

            App.Instance.ToolBar.AddFunction(selectNoneReportFunction);
            App.Instance.Menu.AddFunction(selectNoneReportFunction, "DOCUMENT");

            SelectReportItemsAllFunction selectAllReportFunction = new SelectReportItemsAllFunction();

            App.Instance.ToolBar.AddFunction(selectAllReportFunction);
            App.Instance.Menu.AddFunction(selectAllReportFunction, "DOCUMENT");

            SaveSourceFileFunction saveSourceFileFunction = new SaveSourceFileFunction();

            App.Instance.ToolBar.AddFunction(new FunctionSeparator(saveSourceFileFunction));
            App.Instance.ToolBar.AddFunction(saveSourceFileFunction);
            App.Instance.Menu.AddFunction(saveSourceFileFunction, "DOCUMENT");

            SaveManifestFunction saveManifestFunction = new SaveManifestFunction();

            App.Instance.ToolBar.AddFunction(new FunctionSeparator(saveManifestFunction));
            App.Instance.ToolBar.AddFunction(saveManifestFunction);
            App.Instance.Menu.AddFunction(saveManifestFunction, "DOCUMENT");
            App.Instance.RegisterFunction(saveManifestFunction);

            AddFileToManifestFunction addFileManifestFunction = new AddFileToManifestFunction();

            App.Instance.ToolBar.AddFunction(addFileManifestFunction);
            App.Instance.Menu.AddFunction(addFileManifestFunction, "DOCUMENT");
            App.Instance.RegisterFunction(addFileManifestFunction);

            NewPackageFunction newPackageFunction = new NewPackageFunction();

            App.Instance.ToolBar.AddFunction(newPackageFunction);
            App.Instance.Menu.AddFunction(newPackageFunction, "DOCUMENT");

            DeployPackageFunction deployPackageFunction = new DeployPackageFunction();

            App.Instance.ToolBar.AddFunction(new FunctionSeparator(deployPackageFunction));
            App.Instance.ToolBar.AddFunction(deployPackageFunction);
            App.Instance.Menu.AddFunction(deployPackageFunction, "DOCUMENT");

            CopyPackageDeployResultsFunction copyPackageResultsFunction = new CopyPackageDeployResultsFunction();

            App.Instance.Menu.AddFunction(copyPackageResultsFunction, "DOCUMENT");

            CancelDeployPackageFunction cancelDeployFunction = new CancelDeployPackageFunction();

            App.Instance.Menu.AddFunction(cancelDeployFunction, "DOCUMENT");

            RefreshSourceFileFunction refreshDocumentFunction = new RefreshSourceFileFunction();

            App.Instance.ToolBar.AddFunction(refreshDocumentFunction);
            App.Instance.Menu.AddFunction(refreshDocumentFunction, "DOCUMENT");

            ExportSourceFileDataFunction exportDataFunction = new ExportSourceFileDataFunction();

            App.Instance.Menu.AddFunction(exportDataFunction, "DOCUMENT");

            ImportSourceFileDataFunction importDataFunction = new ImportSourceFileDataFunction();

            App.Instance.Menu.AddFunction(importDataFunction, "DOCUMENT");

            App.Instance.Menu.AddFunction(new FunctionGrouping("COMPARESALESFORCE", "Compare", true), "DOCUMENT");

            CompareSourceControlContentFunction compareSourceControlContentFunction = new CompareSourceControlContentFunction();

            App.Instance.Menu.AddFunction(compareSourceControlContentFunction, "COMPARESALESFORCE");

            CompareServerContentFunction compareServerContentFunction = new CompareServerContentFunction();

            App.Instance.Menu.AddFunction(compareServerContentFunction, "COMPARESALESFORCE");

            CompareOtherServerContentFunction compareOtherServerContentFunction = new CompareOtherServerContentFunction();

            App.Instance.Menu.AddFunction(compareOtherServerContentFunction, "COMPARESALESFORCE");

            CompareLocalContentFunction compareLocalContentFunction = new CompareLocalContentFunction();

            App.Instance.Menu.AddFunction(compareLocalContentFunction, "COMPARESALESFORCE");

            TextUndoFunction undoTextFunction = new TextUndoFunction();

            App.Instance.Menu.AddFunction(new FunctionSeparator(undoTextFunction), "DOCUMENT");
            App.Instance.Menu.AddFunction(undoTextFunction, "DOCUMENT");

            TextRedoFunction redoTextFunction = new TextRedoFunction();

            App.Instance.Menu.AddFunction(redoTextFunction, "DOCUMENT");
            App.Instance.Menu.AddFunction(new FunctionSeparator(redoTextFunction), "DOCUMENT");

            TextSelectAllFunction selectAllTextFunction = new TextSelectAllFunction();

            App.Instance.Menu.AddFunction(selectAllTextFunction, "DOCUMENT");

            TextCutFunction cutTextFunction = new TextCutFunction();

            App.Instance.Menu.AddFunction(cutTextFunction, "DOCUMENT");

            TextCopyFunction copyTextFunction = new TextCopyFunction();

            App.Instance.Menu.AddFunction(copyTextFunction, "DOCUMENT");

            TextPasteFunction pasteTextFunction = new TextPasteFunction();

            App.Instance.Menu.AddFunction(pasteTextFunction, "DOCUMENT");

            InsertSnippetContainerFunction insertSnippetContainerFunction = new InsertSnippetContainerFunction();

            App.Instance.Menu.AddFunction(new FunctionSeparator(insertSnippetContainerFunction), "DOCUMENT");
            App.Instance.Menu.AddFunction(insertSnippetContainerFunction, "DOCUMENT");
            App.Instance.RegisterFunction(insertSnippetContainerFunction);

            AddCommentFunction addCommentFunction = new AddCommentFunction();

            App.Instance.Menu.AddFunction(addCommentFunction, "DOCUMENT");
            App.Instance.ToolBar.AddFunction(addCommentFunction);

            RemoveCommentFunction removeCommentFunction = new RemoveCommentFunction();

            App.Instance.Menu.AddFunction(removeCommentFunction, "DOCUMENT");
            App.Instance.ToolBar.AddFunction(removeCommentFunction);

            TextGoToLineFunction goToLineFunction = new TextGoToLineFunction();

            App.Instance.RegisterFunction(goToLineFunction);
            App.Instance.Menu.AddFunction(goToLineFunction, "DOCUMENT");

            TextSearchFunction searchTextFunction = new TextSearchFunction();

            App.Instance.Menu.AddFunction(searchTextFunction, "DOCUMENT");

            FoldAllToggleFunction foldAllFunction = new FoldAllToggleFunction();

            App.Instance.Menu.AddFunction(foldAllFunction, "DOCUMENT");

            NewCheckpointFunction newCheckpointFunction = new NewCheckpointFunction();

            //App.Instance.Menu.AddFunction(newCheckpointFunction, "DOCUMENT");
            //App.Instance.ToolBar.AddFunction(newCheckpointFunction);
            App.Instance.RegisterFunction(newCheckpointFunction);

            RunTestsFunction runTestsFunction = new RunTestsFunction();

            App.Instance.Menu.AddFunction(runTestsFunction, "DOCUMENT");
            App.Instance.ToolBar.AddFunction(runTestsFunction);

            RefreshLogsFunction refreshLogsFunction = new RefreshLogsFunction();

            App.Instance.ToolBar.AddFunction(new FunctionSeparator(refreshLogsFunction));
            App.Instance.ToolBar.AddFunction(refreshLogsFunction);
            App.Instance.Menu.AddFunction(refreshLogsFunction, "DOCUMENT");

            LogTextSearchFunction logSearchFunction = new LogTextSearchFunction();

            App.Instance.Menu.AddFunction(logSearchFunction, "DOCUMENT");
            App.Instance.ToolBar.AddFunction(logSearchFunction);

            DeleteLogFunction deleteLogFunction = new DeleteLogFunction();

            App.Instance.ToolBar.AddFunction(deleteLogFunction);
            App.Instance.Menu.AddFunction(deleteLogFunction, "DOCUMENT");

            DeleteAllLogsFunction deleteAllLogsFunction = new DeleteAllLogsFunction();

            App.Instance.ToolBar.AddFunction(deleteAllLogsFunction);
            App.Instance.Menu.AddFunction(deleteAllLogsFunction, "DOCUMENT");

            SelectLogUnitLineFunction selectLogUnitTextFunction = new SelectLogUnitLineFunction();

            App.Instance.RegisterFunction(selectLogUnitTextFunction);

            CommitFileOpenFunction commitOpenFunction = new CommitFileOpenFunction();

            App.Instance.Menu.AddFunction(commitOpenFunction, "DOCUMENT");
            App.Instance.RegisterFunction(commitOpenFunction);

            CommitDetailOpenFunction commitDetailOpenFunction = new CommitDetailOpenFunction();

            App.Instance.Menu.AddFunction(commitDetailOpenFunction, "DOCUMENT");
            App.Instance.RegisterFunction(commitDetailOpenFunction);

            CommitFileCompareFunction commitCompareFunction = new CommitFileCompareFunction();

            App.Instance.Menu.AddFunction(commitCompareFunction, "DOCUMENT");
            App.Instance.RegisterFunction(commitCompareFunction);

            CommitFileShaCopyFunction commitCopyShaFunction = new CommitFileShaCopyFunction();

            App.Instance.Menu.AddFunction(commitCopyShaFunction, "DOCUMENT");
            App.Instance.RegisterFunction(commitCopyShaFunction);

            DiffPreviousFunction diffPreviousFunction = new DiffPreviousFunction();

            App.Instance.Menu.AddFunction(diffPreviousFunction, "DOCUMENT");
            App.Instance.ToolBar.AddFunction(diffPreviousFunction);

            DiffNextFunction diffNextFunction = new DiffNextFunction();

            App.Instance.Menu.AddFunction(diffNextFunction, "DOCUMENT");
            App.Instance.ToolBar.AddFunction(diffNextFunction);

            RefreshCodeCoverageFunction refreshCodeCoverageFunction = new RefreshCodeCoverageFunction();

            App.Instance.Menu.AddFunction(refreshCodeCoverageFunction, "DOCUMENT");
            App.Instance.ToolBar.AddFunction(new FunctionSeparator(refreshCodeCoverageFunction));
            App.Instance.ToolBar.AddFunction(refreshCodeCoverageFunction);

            CloseDocumentFunction closeDocumentFunction = new CloseDocumentFunction();

            App.Instance.Menu.AddFunction(new FunctionSeparator(closeDocumentFunction), "DOCUMENT");
            App.Instance.Menu.AddFunction(closeDocumentFunction, "DOCUMENT");

            CloseAllDocumentsFunction closeAllDocumentsFunction = new CloseAllDocumentsFunction();

            App.Instance.Menu.AddFunction(closeAllDocumentsFunction, "DOCUMENT");

            //
            // HELP
            //

            ApexDocumentationFunction apexDocFunction = new ApexDocumentationFunction();

            App.Instance.Menu.AddFunction(apexDocFunction, "HELP", 0);
        }
        //  Assertion with three validation
        public static void GetApplicationSnapShot(IWebDriver webdriver, ClientOperatingSystem OperatingSystem, ClientBrowser browser, string uniqueRowIdentifier = null)
        {
            int left, top, width, height;

            // Allow time for all elements on the map to be fully displayed.
            Thread.Sleep(5000);

            // Use calling method to form a unique file name for the baseline data.
            StackTrace stackTrace       = new StackTrace();
            string     uniqueIdentifier = uniqueRowIdentifier + OperatingSystem.ToString() + browser.ToString();
            string     uniqueFileName   = AppCommonUtility.GetUniqueFileName(uniqueIdentifier, stackTrace);


            CreateAppSnap(webdriver, out left, out top, out width, out height);

            // Crop the screenshot and convert it to a snapshot type.
            Rectangle rectangle = new Rectangle(left, top, width, height);
            Snapshot  snapshot  = GetSnapshotOfMap(webdriver);

            CreateSnapShot.AppCreateSnapShot(snapshot, uniqueFileName, rectangle);
        }
Exemple #9
0
 private static string GetBrowserExe(ClientBrowser browserType)
 {
     string browserPath = "";
     switch (browserType)
     {
         case ClientBrowser.IE5:
         case ClientBrowser.IE6:
         case ClientBrowser.IE7:
         case ClientBrowser.IE8:
             browserPath = "iexplore";
             break;
         case ClientBrowser.FF2:
         case ClientBrowser.FF3:
         case ClientBrowser.FF15:
             browserPath = "Firefox";
             break;
         case ClientBrowser.SF2:
         case ClientBrowser.SF3:
             browserPath = "Safari";
             break;
         case ClientBrowser.Chrome:
             browserPath = "chrome";
             break;
     }
     return browserPath;
 }