Exemplo n.º 1
0
        internal void ProcessRequest(PageRequest request)
        {
            var domainSelector = request.ParentDomain == null ? null : new DomainSelector(request.ParentDomain, request.SiteId);

            AddOrUpdateCounter(_siteCounter, new Site {
                Id = request.SiteId
            }, request);
            if (domainSelector != null)
            {
                AddOrUpdateCounter(_domainCounter, domainSelector, request);
            }

            if (request.PageId != null)
            {
                var page = new Page {
                    Id = request.PageId.Value
                };
                var totalDomainSelector = new DomainSelector(DomainSelector.TotalDomain, request.SiteId);
                var totalPageSelector   = new PageSelector(page, totalDomainSelector);

                AddOrUpdateCounter(_pageCounter, totalPageSelector, request);
                if (domainSelector != null)
                {
                    var pageSelector = new PageSelector(page, domainSelector);
                    AddOrUpdateCounter(_pagePerDomainCounter, pageSelector, request);
                }
            }
        }
Exemplo n.º 2
0
        public void btnHighlightBookmark_Click(Office.IRibbonControl control)
        {
            try
            {
                TemplateInfo templateInfo = Wkl.MainCtrl.CommonCtrl.CommonProfile.CurrentTemplateInfo;
                if (templateInfo != null && templateInfo.InternalBookmark != null &&
                    templateInfo.DomainNames != null &&
                    templateInfo.DomainNames.Count > 0)
                {
                    DomainSelector domainSelector = new DomainSelector();
                    domainSelector.ShowDialog();
                    Dictionary <string, string> selectedDomains = domainSelector.DataTagColor;
                    bool   isHighlight = domainSelector.IsHighlight;
                    string colorNameDS = domainSelector.DocumentSpecificConditionColor;
                    DefineColors.DefineColor colorDS = DefineColors.GetColor(colorNameDS, false);
                    foreach (KeyValuePair <string, string> selectedDomain in selectedDomains)
                    {
                        InternalBookmarkDomain ibmDomain = templateInfo.InternalBookmark.GetInternalBookmarkDomain(selectedDomain.Key);
                        if (ibmDomain != null && ibmDomain.InternalBookmarkItems != null)
                        {
                            string colorNameDT = selectedDomain.Value;
                            DefineColors.DefineColor colorDT = DefineColors.GetColor(colorNameDT, false);

                            foreach (InternalBookmarkItem ibmItem in ibmDomain.InternalBookmarkItems)
                            {
                                string key = string.Empty;
                                Pdw.WKL.Profiler.Manager.ManagerProfile profile = Wkl.MainCtrl.ManagerCtrl.CreateProfile(out key);
                                profile.HighlightBookmarkName = ibmItem.Key;
                                Managers.DataIntegration.DataIntegrationManager bmMgr = new Managers.DataIntegration.DataIntegrationManager();
                                bool isDocumentSpecific = MarkupUtilities.IsProntoDocDocumentSpecificBookmark(ibmItem.Key);
                                if (isDocumentSpecific)
                                {
                                    if (colorDS != null)
                                    {
                                        profile.WdColorIndex = colorDS.Color;
                                    }
                                }
                                else
                                {
                                    if (colorDT != null)
                                    {
                                        profile.WdColorIndex = colorDT.Color;
                                    }
                                }

                                if (isHighlight)
                                {
                                    bmMgr.HighLightBookmark(key);
                                }
                                else
                                {
                                    bmMgr.UnHighLightBookmark(key);
                                }
                            }
                            ibmDomain.Color = isHighlight ? colorNameDT : string.Empty;
                            templateInfo.InternalBookmark.DocumentSpecificColor = isHighlight ? colorNameDS : string.Empty;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogUtils.Log("chkHighlightBookmark_Click", ex);
            }
        }
Exemplo n.º 3
0
        public void OpenDomainAndCreateCompositionOfIt(bool IsForOpenDomain, Uri Location = null, bool CanEditPropertiesOfNewCompo = true)
        {
            bool OpenCompositionStoredWithDomain = true;

            if (IsForOpenDomain)
            {
                Console.WriteLine("Opening Domain (and creating its Composition)...");
            }
            else
            {
                Console.WriteLine("Creating new Composition of Domain...");
            }

            if (Location == null)
            {
                var Selection = DomainSelector.SelectDomain(AppExec.ApplicationSpecificDefinitionsDirectory,
                                                            (IsForOpenDomain ? null :
                                                             "Select Domain file to create Composition..."),
                                                            !IsForOpenDomain);
                if (Selection == null)
                {
                    return;
                }

                Location = Selection.Item1;
                OpenCompositionStoredWithDomain = (IsForOpenDomain || Selection.Item2);

                // If 'Basic Domain' was selected...
                if (Location == null)
                {
                    this.CreateComposition();
                    return;
                }

                /* Previously...
                 * Location = Display.DialogGetOpenFile("Select Domain",
                 *                                   FileDataType.FileTypeDomain.Extension,
                 *                                   FileDataType.FileTypeDomain.FilterForOpen); */
            }
            if (Location == null)
            {
                return;
            }

            /* NOT APPLICABLE FOR DOMAINS
             * // Switch to document if already opened
             * var CurrentlyOpenedDoc = this.WorkspaceDirector.Documents
             *  .FirstOrDefault(doc => doc.DocumentEditEngine.Location != null && !doc.DocumentEditEngine.Location.LocalPath.IsAbsent()
             *                         && doc.DocumentEditEngine.Location.LocalPath == Location.LocalPath);
             *
             * if (CurrentlyOpenedDoc != null)
             * {
             *  this.WorkspaceDirector.ActivateDocument(CurrentlyOpenedDoc);
             *  return;
             * }
             */

            /* unnecessary
             * if (IsForOpenDomain)
             *  Application.Current.MainWindow.PostCall(mainwin =>
             *      Display.DialogMessage("Attention!",
             *                            "Domains must are created with a base Composition.\n" +
             *                            "So, later it can be saved as the Domain's template."); */

            var CurrentWindow = Display.GetCurrentWindow();

            CurrentWindow.Cursor = Cursors.Wait;

            var PreviousActiveDoc = this.WorkspaceDirector.ActiveDocument;

            this.WorkspaceDirector.ActiveDocument = null;   // Must deactive previous to create+activate the opening Composition.

            CompositionEngine.CreateActiveCompositionEngine(this, this.Visualizer, IsForOpenDomain);
            var DomainLoad = CompositionEngine.MaterializeDomain(Location);

            if (DomainLoad.Item1 == null)
            {
                CurrentWindow.Cursor = Cursors.Arrow;
                Display.DialogMessage("Error!", "Cannot open Domain.\n\nProblem: " + DomainLoad.Item2, EMessageType.Warning);
                this.WorkspaceDirector.ActiveDocument = PreviousActiveDoc;
                return;
            }

            var Result = CompositionEngine.Materialize(null, DomainLoad.Item1, OpenCompositionStoredWithDomain);

            if (Result.Item1 == null)
            {
                CurrentWindow.Cursor = Cursors.Arrow;
                Display.DialogMessage("Error!", "Cannot create Composition of Domain.\n\nProblem: " + Result.Item2, EMessageType.Warning);
                this.WorkspaceDirector.ActiveDocument = PreviousActiveDoc;
                return;
            }

            // Start visual interactive editing and show document view.
            Result.Item1.DomainLocation = Location;
            this.WorkspaceDirector.LoadDocument(Result.Item1.TargetDocument);

            Result.Item1.Start();

            if (IsForOpenDomain)
            {
                DomainServices.DomainEdit(Result.Item1.TargetComposition.CompositeContentDomain);
            }
            else
            if (CanEditPropertiesOfNewCompo)
            {
                var EditOnNewComposition = AppExec.GetConfiguration <bool>("Composition", "EditOnNewComposition", true);
                if (EditOnNewComposition)
                {
                    Result.Item1.EditCompositionProperties();
                }
            }

            CurrentWindow.Cursor = Cursors.Arrow;
        }
Exemplo n.º 4
0
        public void RegisterCounting()
        {
            int timeout = config.CoreDelay;


            var domainStats =
                from e in _pingInputStream
                group e by new { e.ParentDomain, e.SiteId } into domainGroups
            from win in domainGroups.HoppingWindow(
                TimeSpan.FromSeconds(timeout),
                TimeSpan.FromSeconds(timeout / 5),
                HoppingWindowOutputPolicy.ClipToWindowEnd)
            select new DomainStatistics
            {
                ParentId     = domainGroups.Key.SiteId,
                Id           = DomainSelector.GetDomainId(domainGroups.Key.ParentDomain, domainGroups.Key.SiteId),
                SelectorType = (int)PageSelectorType.DomainString,
                Count        = (int)win.Count(),
                Pattern      = domainGroups.Key.ParentDomain
            };

            var domainPatternStats =
                from e in _pingInputStream
                group e by new { e.SiteId } into domainGroups
            from win in domainGroups.HoppingWindow(
                TimeSpan.FromSeconds(timeout),
                TimeSpan.FromSeconds(timeout / 5),
                HoppingWindowOutputPolicy.ClipToWindowEnd)
            select new DomainStatistics
            {
                Id           = domainGroups.Key.SiteId,
                ParentId     = null,
                SelectorType = (int)PageSelectorType.DomainPattern,
                Pattern      = null,
                Count        = (int)win.Count()
            };

            var domainStatsTotal =
                from e in domainPatternStats
                select new DomainStatistics
            {
                ParentId = e.Id,
                Id       = DomainSelector.GetDomainId(DomainSelector.TotalDomain, e.Id),
                //Domain = string.Empty,
                SelectorType = (int)PageSelectorType.DomainString,
                //UserId = Guid.Empty,
                Pattern = DomainSelector.TotalDomain,
                Count   = e.Count
                          //PageId = null
            };

            var pageStats =
                from e in _pingInputStream
                where e.PageId != null
                group e by new { e.PageId, e.ParentDomain, e.SiteId } into domainGroups
            from win in domainGroups.HoppingWindow(
                TimeSpan.FromSeconds(timeout),
                TimeSpan.FromSeconds(timeout / 5),
                HoppingWindowOutputPolicy.ClipToWindowEnd)
            select new DomainStatistics
            {
                ParentId     = DomainSelector.GetDomainId(domainGroups.Key.ParentDomain, domainGroups.Key.SiteId),
                Id           = PageSelector.GetPageId(domainGroups.Key.PageId.Value, domainGroups.Key.ParentDomain, domainGroups.Key.SiteId),
                Pattern      = null,
                SelectorType = (int)PageSelectorType.PagePattern,
                Count        = (int)win.Count()
            };

            var totalPageStats =
                from e in _pingInputStream
                where e.PageId != null
                group e by new { e.PageId, e.SiteId } into domainGroups
            from win in domainGroups.HoppingWindow(
                TimeSpan.FromSeconds(timeout),
                TimeSpan.FromSeconds(timeout / 5),
                HoppingWindowOutputPolicy.ClipToWindowEnd)
            select new DomainStatistics
            {
                ParentId     = DomainSelector.GetDomainId(DomainSelector.TotalDomain, domainGroups.Key.SiteId),
                Id           = PageSelector.GetPageId(domainGroups.Key.PageId.Value, DomainSelector.TotalDomain, domainGroups.Key.SiteId),
                Pattern      = null,
                SelectorType = (int)PageSelectorType.PagePattern,
                Count        = (int)win.Count()
            };

            var totalStats = domainPatternStats.Union(domainStats).Union(domainStatsTotal).Union(totalPageStats).Union(pageStats);

            _domainStatSource = totalStats.ToObservable();

            _statsOutputService  = new CepObserver <DomainStatistics>();
            _eventsOutputService = new CepDataCollector <PageRequest>();

            _subscription = _domainStatSource.Subscribe(_statsOutputService);
        }