void HighlightLineNumberingArea(LayoutColumn column, int leftBoundary)
        {
            LayoutPage page         = column.GetParentByType <LayoutPage>();
            Rectangle  marginBounds = new Rectangle(new Point(leftBoundary, 0), new Size(column.Bounds.X - leftBoundary, page.Bounds.Height));

            Canvas.FillRectangle(new RichEditBrush(NumberingHighlightColor), marginBounds);
        }
コード例 #2
0
        void richEditControl1_SelectionChanged(object sender, EventArgs e)
        {
            RichEditControl richEdit = sender as RichEditControl;

            if (richEdit.DocumentLayout.IsDocumentFormattingCompleted)
            {
                int currentPageIndex = richEdit.Views.PrintLayoutView.CurrentPageIndex;
                barStaticItem3.Caption = string.Format("Current page: {0}", currentPageIndex + 1);

                CustomLayoutVisitor visitor = new CustomLayoutVisitor(richEdit.Document);

                for (int i = 0; i < richEdit.DocumentLayout.GetPageCount(); i++)
                {
                    visitor.Reset();
                    LayoutPage page = richEdit.DocumentLayout.GetPage(i);
                    visitor.Visit(page);

                    if (visitor.IsFound)
                    {
                        break;
                    }
                }

                if (visitor.IsFound)
                {
                    barStaticItem4.Caption = string.Format("Current line: {0}", visitor.RowIndex);
                    barStaticItem5.Caption = string.Format("Current column: {0}", visitor.ColIndex);
                }
            }
        }
コード例 #3
0
        public void Register()
        {
            Handle.GET("/website", () => {
                LayoutPage master = GetLayoutPage();

                master.TemplateHtml = null;
                master.TemplateModel = null;
                master.TemplateName = null;

                return master;
            });

            Handle.GET("/website/partial/layout", () => {
                LayoutPage page = null;

                if (Session.Current != null) {
                    page = Session.Current.Data as LayoutPage;

                    return Session.Current.Data;
                }

                Session.Current = new Session(SessionOptions.PatchVersioning);

                page = new LayoutPage();
                page.Session = Session.Current;

                return page;
            });

            RegisterFilter();
        }
コード例 #4
0
 public override void Execute()
 {
     WriteEmptyLine();
     Layout = new LayoutPage(Title);
     WriteLiteralLine(PageHtml);
     WriteEmptyLine();
 }
コード例 #5
0
 public object GetValue(PageVariableFragment var)
 {
     return(Args.TryGetValue(var.NameString, out object value)
         ? value
         : Page.GetValue(var) ??
            (LayoutPage != null && LayoutPage != Page.LayoutPage ? LayoutPage.GetValue(var) : null));
 }
コード例 #6
0
        private void richEditControl1_MouseClick(object sender, MouseEventArgs e)
        {
            PageLayoutPosition pageLayoutPosition = richEditControl1.ActiveView.GetDocumentLayoutPosition(e.Location);

            if (pageLayoutPosition == null)
            {
                return;
            }
            int                   pageIndex  = pageLayoutPosition.PageIndex;
            Point                 point      = pageLayoutPosition.Position;
            LayoutPage            layoutPage = richEditControl1.DocumentLayout.GetPage(pageIndex);
            HitTestManager        hitTest    = new HitTestManager(richEditControl1.DocumentLayout);
            RichEditHitTestResult result     = hitTest.HitTest(layoutPage, point);

            if (result.LayoutElement is CharacterBox && richEditControl1.Document.Selection.Length == 0)
            {
                CharacterBox     character     = (CharacterBox)result.LayoutElement;
                DocumentPosition caretPosition = richEditControl1.Document.CaretPosition;
                SubDocument      document      = caretPosition.BeginUpdateDocument();
                if (document.GetSubDocumentType() == GetLocation(character.Parent))
                {
                    DocumentRange characterRange = document.CreateRange(character.Range.Start, 1);
                    UpdateCheckState(document, characterRange, character.Text);
                }
                caretPosition.EndUpdateDocument(document);
            }
        }
コード例 #7
0
        public override void Execute()
        {
            Layout = new LayoutPage(Title);

            WriteLiteral($@"
	<link rel=""stylesheet"" type=""text/css"" href=""{Url.To($"{UrlRoute}/jsmcss")}"" />
	<div class=""row"">
		<div class=""col-md-3"">
");
            Write(Html.RenderPartial(new CustomSidebarMenu(ManagementSidebarMenu.Items)));

            WriteLiteral($@"
		</div>
		<div class=""col-md-9"">
			<h1 class=""page-header mgmt-title"">{Title}</h1>
			<div class=""visible-md-block visible-lg-block"">
				Select a page from the menu on the left to see the jobs available.
			</div>
			<div class=""hidden-md hidden-lg"">
				Select a page from the tabs at the top to see the jobs available.
			</div>
		</div>
	</div>
");
        }
コード例 #8
0
        public override void Execute()
        {
            WriteLiteral("\r\n");
            WriteLiteral("<style>.btn-default.btn-on.active{background-color: #5BB75B;color: white;}.btn-default.btn-off.active{ background-color: #DA4F49;color: white;}</style>");
            Layout = new LayoutPage(_displayName);

            WriteLiteral("<div class=\"row\">\r\n");
            WriteLiteral("<div class=\"col-md-3\">\r\n");

            Write(Html.RenderPartial(new SideMenu()));

            WriteLiteral("</div>\r\n");
            WriteLiteral("<div class=\"col-md-9\">\r\n");
            WriteLiteral("<div class=\"row\">\r\n");
            WriteLiteral("<h1 class=\"page-header\">\r\n");
            Write(_displayName);
            WriteLiteral("</h1>\r\n");

            Content();

            WriteLiteral("\r\n</div>\r\n");
            WriteLiteral("\r\n</div>\r\n");
            WriteLiteral("\r\n</div>\r\n");
            WriteLiteral("\r\n</div>\r\n");
        }
コード例 #9
0
        private void AddLayouts(Section section)
        {
            AddHeader(true);
            AddHeader(false);
            AddFooter(true);
            AddFooter(false);

            void AddHeader(bool isOddPage)
            {
                string     SentOrReceived       = isOddPage ? "SENT" : "RECEIVED";
                string     DescriptionOrReceipt = isOddPage ? "Receipt" : "Description of Model";
                string     HeaderText           = isOddPage ? _options.HeaderOdd : _options.HeaderEven;
                LayoutPage LayoutPage           = isOddPage ? section.Layout.AddOddPage() : section.Layout.AddEvenPage();

                LayoutPage.AddRepeatingArea(section.Page, 50, areaConfig: area =>
                {
                    area.AddTable(table =>
                    {
                        table.SetBorderStyle(Stroke.None);
                        table.Border.SetWidth(0.0f);

                        table.Width = 0;
                        table.AddRow(row =>
                        {
                            row.CellsStyle.Border = new Border();
                            row.CellsStyle.Border.SetWidth(0.0f);
                            row.SetBorderStyle(Stroke.None);
                            row.AddCell(SentOrReceived)
                            .SetHorizontalAlignment(HorizontalAlignment.Left).SetFont(Font.Exo(24));
                            row.AddCell(HeaderText).SetPadding(0, 0, 10, 0).SetHorizontalAlignment(HorizontalAlignment.Right)
                            .SetFont(Font.Exo(10));
                        });
                    });
                });
            }

            void AddFooter(bool isOddPage)
            {
                LayoutPage LayoutPage = isOddPage ? section.Layout.AddOddPage() : section.Layout.AddEvenPage();

                LayoutPage.AddRepeatingArea(section.Page, 30, true, areaConfig: area =>
                {
                    area.AddItem <Table>(table =>
                    {
                        table.SetBorderStyle(Stroke.None);
                        table.Border.SetWidth(0.0f);
                        table.ContentRowStyle.SetBorderStyle(Stroke.None).Border.SetWidth(0.0f);
                        table.AddRow(row =>
                        {
                            row.CellsStyle.Border = new Border();
                            row.CellsStyle.Border.SetWidth(0.0f);
                            row.SetBorderStyle(Stroke.None);
                            row.AddCell().SetFont(default)
                            .AddParagraph().SetFont(new Font {
                                Name = FontNames.Exo, Size = 10
                            })
                            .AddTextToParagraph("Page ").AddPageNumber().AddTextToParagraph(" | ").AddText(_options.BookName).SetBold();

                            var parDate = row.AddCell().SetFont(default).SetHorizontalAlignment(HorizontalAlignment.Right).AddParagraph().SetFont(new Font {
コード例 #10
0
 public override void DrawPage(LayoutPage page)
 {
     if (control.Document.IsEmpty && !control.Focused)
     {
         this.Canvas.DrawString("NullText", new Font("Calibri", 11), new RichEditBrush(Color.Gray), page.Bounds.Location);
     }
     base.DrawPage(page);
 }
コード例 #11
0
        protected override void VisitPage(LayoutPage page)
        {
            TreeNode item = new TreeNode();

            item.Text = String.Format("{0} #{1}", "Page", page.Index + 1);;
            Dictionary.Add(page, item);
            base.VisitPage(page);
            View.Nodes.Add(item);
        }
 public override void DrawPage(LayoutPage page)
 {
     if (Form1.customDrawPage == true)
     {
         Rectangle inlineRect = new Rectangle(100, 100, 150, 200);
         Canvas.DrawRectangle(new RichEditPen(Color.Aquamarine, Canvas.ConvertToDrawingLayoutUnits(4, DocumentLayoutUnit.Pixel)), Canvas.ConvertToDrawingLayoutUnits(inlineRect, DocumentLayoutUnit.Pixel));
     }
     base.DrawPage(page);
 }
 public override void DrawPage(LayoutPage page)
 {
     if (MainWindow.customDrawPage == true)
     {
         Rectangle inlineRect = new Rectangle(100, 100, 150, 200);
         Canvas.DrawRectangle(new RichEditPen(System.Windows.Media.Color.FromRgb(127, 255, 212), Canvas.ConvertToDrawingLayoutUnits(4, DocumentLayoutUnit.Pixel)),
                              Canvas.ConvertToDrawingLayoutUnits(inlineRect, DocumentLayoutUnit.Pixel));
     }
     base.DrawPage(page);
 }
        void ToolTipController_GetActiveObjectInfo(object sender, ToolTipControllerGetActiveObjectInfoEventArgs e)
        {
            #region #HitTest
            if (!e.SelectedControl.Equals(richEditControl1))
            {
                return;
            }

            //Obtain the mouse cursor's layout position on the page and the current page index:
            PageLayoutPosition pageLayoutPosition = richEditControl1.ActiveView.GetDocumentLayoutPosition(e.ControlMousePosition);
            if (pageLayoutPosition == null)
            {
                return;
            }

            Point      point      = pageLayoutPosition.Position;
            int        pageIndex  = pageLayoutPosition.PageIndex;
            LayoutPage layoutPage = richEditControl1.DocumentLayout.GetPage(pageIndex);

            //Create a HitTestManager instance:
            HitTestManager hitTest = new HitTestManager(richEditControl1.DocumentLayout);

            //Perform the hit test and pass the result to the RichEditHitTestResult object:
            RichEditHitTestResult result = hitTest.HitTest(layoutPage, point);
            if (result != null)
            {
                //Retrieve the current layout element type:
                LayoutElement element = result.LayoutElement;
                string        text    = element.Type.ToString();

                //Obtain the the text character and its bounds under the mouse position
                if (element.Type == LayoutType.CharacterBox)
                {
                    text += String.Format(" : \"{0}\"", (element as CharacterBox).Text);
                    text += GetBounds(element);
                    if (element.Parent.Type == LayoutType.PlainTextBox)
                    {
                        text += String.Format("\r\nPlainTextBox : \"{0}\"", (element.Parent as PlainTextBox).Text);
                        text += GetBounds(element.Parent);
                    }
                }
                else
                {
                    //Get the hovered element's bounds:
                    text += GetBounds(element);
                }

                //Get the element's location:
                string title = GetLocation(element);

                //Display all retrieved information in the tooltip:
                e.Info = new ToolTipControlInfo(element.Bounds, text, title, ToolTipIconType.Information);
            }
            #endregion #HitTest
        }
        private void RichEditControl_MouseMove(object sender, MouseEventArgs e)
        {
            #region #HitTest
            //Obtain the mouse cursor's layout position on the page and the current page index:
            Point wPoint = e.GetPosition(richEditControl1);

            PageLayoutPosition pageLayoutPosition = richEditControl1.ActiveView.GetDocumentLayoutPosition
                                                        (new System.Drawing.Point((int)wPoint.X, (int)wPoint.Y));
            if (pageLayoutPosition == null)
            {
                return;
            }

            System.Drawing.Point point = pageLayoutPosition.Position;
            int        pageIndex       = pageLayoutPosition.PageIndex;
            LayoutPage layoutPage      = richEditControl1.DocumentLayout.GetPage(pageIndex);

            //Create a HitTestManager instance:
            HitTestManager hitTest = new HitTestManager(richEditControl1.DocumentLayout);

            //Perform the hit test and pass the result to the RichEditHitTestResult object:
            RichEditHitTestResult result = hitTest.HitTest(layoutPage, point);
            if (result != null)
            {
                //Retrieve the current layout element type:
                LayoutElement element = result.LayoutElement;
                string        text    = element.Type.ToString();

                //Obtain the the text character and its bounds under the mouse position
                if (element.Type == LayoutType.CharacterBox)
                {
                    text += String.Format(" : \"{0}\"", (element as CharacterBox).Text);
                    text += GetBounds(element);
                    if (element.Parent.Type == LayoutType.PlainTextBox)
                    {
                        text += String.Format("\r\nPlainTextBox : \"{0}\"", (element.Parent as PlainTextBox).Text);
                        text += GetBounds(element.Parent);
                    }
                }
                else
                {
                    //Get the hovered element's bounds:
                    text += GetBounds(element);
                }

                //Get the element's location:
                string title = GetLocation(element);

                //Display all retrieved information in the tooltip:
                toolTip.IsOpen  = true;
                toolTip.Content = text + "\r\n" + title;
            }
            #endregion #HitTest
        }
コード例 #16
0
        public override void Execute()
        {
            Layout = new LayoutPage(_options.Title);

            // write static html content
            WriteLiteral(PageHtml);
            WriteEmptyLine();

            // write configuration element
            WriteLiteral("<div id=\"heartbeatConfig\" data-pollinterval=\"");
            Write(_options.StatsPollingInterval);
            WriteLiteral("\" data-pollurl=\"");
            Write(Url.To(StatsRoute));
            WriteLiteral("\"></div>");
        }
コード例 #17
0
        public async Task WriteToAsync(Stream responseStream, CancellationToken token = new CancellationToken())
        {
            if (LayoutPage != null)
            {
                await Task.WhenAll(LayoutPage.Init(), Page.Init());
            }
            else
            {
                await Page.Init();

                if (Page.LayoutPage != null)
                {
                    LayoutPage = Page.LayoutPage;
                    await LayoutPage.Init();
                }
            }

            token.ThrowIfCancellationRequested();

            if (LayoutPage != null)
            {
                foreach (var fragment in LayoutPage.PageFragments)
                {
                    if (fragment is PageStringFragment str)
                    {
                        await responseStream.WriteAsync(str.ValueBytes, token);
                    }
                    else if (fragment is PageVariableFragment var)
                    {
                        if (var.Name.Equals("body"))
                        {
                            await WritePage(responseStream, token);
                        }
                        else
                        {
                            var bytes = Page.Context.EncodeValue(GetValue(var));
                            await responseStream.WriteAsync(bytes, token);
                        }
                    }
                }
            }
            else
            {
                await WritePage(responseStream, token);
            }
        }
        // get information about a current text box layout
        public static string GetInformationAboutCurrentTextBox(SubDocument subDocument, DocumentLayout currentLayout, DocumentPosition docPosition)
        {
            string returnedInformation = "!A TEXTBOX CONTENT IS SELECTED!\r\n";

            LayoutIterator layoutIterator     = new LayoutIterator(currentLayout, subDocument.Range);
            LayoutPage     currentTextBoxPage = null;
            LayoutTextBox  currentTextBox     = null;

            while (layoutIterator.MoveNext())
            {
                LayoutElement element = layoutIterator.Current;
                if (element is LayoutTextBox)
                {
                    currentTextBox = (element as LayoutTextBox);
                    if (currentTextBox.Parent is LayoutPage)
                    {
                        currentTextBoxPage = currentTextBox.Parent as LayoutPage;
                    }
                }
                if (element is PlainTextBox)
                {
                    PlainTextBox currentPlaintTextBox = element as PlainTextBox;
                    if (currentPlaintTextBox.Range.Contains(docPosition.ToInt()))
                    {
                        returnedInformation += String.Format("Selected content: {0}\r\n", currentPlaintTextBox.Text);

                        LayoutRow currentRow       = currentPlaintTextBox.Parent as LayoutRow;
                        int       currentLineIndex = currentTextBox.Rows.ToList().IndexOf(currentRow);
                        returnedInformation += String.Format("Line index: {0}\r\n", currentLineIndex + 1);
                        returnedInformation += String.Format("Selected block bounds: {0}\r\n", currentPlaintTextBox.Bounds);
                        break;
                    }
                }
            }

            returnedInformation += String.Format("TEXTBOX bounds: {0}\r\n", currentTextBox.Bounds);
            returnedInformation += String.Format("\r\n!!Content information:\r\n");
            returnedInformation += GetInformationAboutCurrentTextBoxContent(currentTextBox, currentLayout);

            if (currentTextBoxPage != null)
            {
                returnedInformation += PageLayoutHelper.GetInformationAboutCurrentPage(currentLayout, currentTextBoxPage, docPosition);
            }
            return(returnedInformation);
        }
コード例 #19
0
 private void btnPositionInfo_Click(object sender, EventArgs e)
 {
     #region #GetPageForPosition
     SubDocument      subDoc   = richEditControl1.Document.CaretPosition.BeginUpdateDocument();
     DocumentPosition pos      = subDoc.CreatePosition(richEditControl1.Document.CaretPosition.ToInt() == 0 ? 0 : richEditControl1.Document.CaretPosition.ToInt() - 1);
     LayoutPageArea   pageArea = richEditControl1.DocumentLayout.GetElement(pos, LayoutType.PageArea) as LayoutPageArea;
     LayoutPage       page     = pageArea.GetParentByType <LayoutPage>();
     if (page != null)
     {
         string s = String.Format("The caret is on the page with index={0}\r\n" +
                                  "The page starts at document position {1},\r\n" +
                                  "the range length of the page content is {2}.\r\n",
                                  page.Index, page.MainContentRange.Start, page.MainContentRange.Length);
         lblPageInfo.Text = s;
     }
     richEditControl1.Document.CaretPosition.EndUpdateDocument(subDoc);
     #endregion #GetPageForPosition
 }
コード例 #20
0
        public override void Execute()
        {
            WriteLiteral("\r\n");
            Layout = new LayoutPage(Title);

            WriteLiteral("<div class=\"row\">\r\n");
            WriteLiteral("<div class=\"col-md-3\">\r\n");

            Write(Html.RenderPartial(new CustomSidebarMenu(ManagementSidebarMenu.Items)));

            WriteLiteral("</div>\r\n");
            WriteLiteral("<div class=\"col-md-9\">\r\n");
            WriteLiteral("<h1 class=\"page-header\">\r\n");
            Write(Title);
            WriteLiteral("</h1>\r\n");

            Write("Select the job type you would like enqueue from the menu.");

            WriteLiteral("\r\n</div>\r\n");
            WriteLiteral("\r\n</div>\r\n");
        }
コード例 #21
0
        public override void Execute()
        {
            WriteLiteral("\r\n");
            Layout = new LayoutPage(pageTitle);

            WriteLiteral("<div class=\"row\">\r\n");
            WriteLiteral("<div class=\"col-md-3\">\r\n");

            Write(Html.RenderPartial(new CustomSidebarMenu(ManagementSidebarMenu.Items)));

            WriteLiteral("</div>\r\n");
            WriteLiteral("<div class=\"col-md-9\">\r\n");
            WriteLiteral("<h1 class=\"page-header\">\r\n");
            Write(pageHeader);
            WriteLiteral("</h1>\r\n");

            Content();

            WriteLiteral("\r\n</div>\r\n");
            WriteLiteral("\r\n</div>\r\n");
        }
コード例 #22
0
        public virtual bool Output()
        {
            var pageTitle = Page.FetchTitle();
            var layout    = new LayoutPage(pageTitle);

            Page.SetLayout(layout);

            var pageHeader = Page.FetchHeader();

            Page.HtmlWrite("<div class=\"row\">\r\n");
            Page.HtmlWrite("<div class=\"col-md-3\">\r\n");

            var sideMenu = Page.Sidebar == null ? new List <Func <RazorPage, MenuItem> >() : Page.Sidebar();

            Page.HtmlWrite(new SidebarPartial(sideMenu));

            Page.HtmlWrite("</div>\r\n");
            Page.HtmlWrite("<div class=\"col-md-9\">\r\n");
            Page.HtmlWrite("<h1 class=\"page-header\">\r\n");
            Page.HtmlWrite(pageHeader);
            Page.HtmlWrite("</h1>\r\n");

            TryRender();

            Page.HtmlWrite("\r\n</div>\r\n");
            Page.HtmlWrite("\r\n</div>\r\n");

            WriteStyleFile(Page.Url.To("/cssex/jobdomain"));

            var loadingMessage = "加载中...";
            var loading        = Tag.CreateLoadingWall(loadingMessage);

            Page.HtmlWrite(loading);
            var Script = Tag.ScriptPlug(ScriptFileBuilder.ToString(), Cssbulider.ToString(), ScriptBuilder.ToString());

            Page.HtmlWrite(Script);
            return(false);
        }
コード例 #23
0
        public async Task <TemplatePage> Load()
        {
            string serverHtml;

            using (var stream = File.OpenRead())
                using (var reader = new StreamReader(stream, Encoding.UTF8))
                {
                    serverHtml = await reader.ReadToEndAsync();
                }

            lock (semaphore)
            {
                LastModified = File.LastModified;

                ServerHtml = serverHtml.ToStringSegment();
                PageVars   = new Dictionary <string, string>();

                var pos = 0;
                while (char.IsWhiteSpace(ServerHtml.GetChar(pos)))
                {
                    pos++;
                }

                ServerHtml.TryReadLine(out StringSegment line, ref pos);
                if (line.StartsWith("<!--"))
                {
                    while (ServerHtml.TryReadLine(out line, ref pos))
                    {
                        if (line.Trim().Length == 0)
                        {
                            continue;
                        }


                        if (line.StartsWith("-->"))
                        {
                            break;
                        }

                        var kvp = line.SplitOnFirst(':');
                        PageVars[kvp[0].Trim().ToString()] = kvp.Length > 1 ? kvp[1].Trim().ToString() : "";
                    }
                }
                else
                {
                    pos = 0;
                }

                PageHtml       = ServerHtml.Subsegment(pos).TrimStart();
                PageFragments  = TemplatePageUtils.ParseTemplatePage(PageHtml);
                IsCompletePage = Context.IsCompletePage(PageHtml);

                HasInit = true;

                if (!IsCompletePage)
                {
                    if (PageVars.TryGetValue(TemplatePages.Layout, out string layout))
                    {
                        Layout = layout;
                    }

                    LayoutPage = Context.TemplatePages.ResolveLayoutPage(this);
                }
            }

            if (LayoutPage != null)
            {
                if (!LayoutPage.HasInit)
                {
                    await LayoutPage.Load();
                }
                else if (Context.CheckModifiedPages || Context.DebugMode)
                {
                    LayoutPage.File.Refresh();
                    if (LayoutPage.File.LastModified > LayoutPage.LastModified)
                    {
                        await LayoutPage.Load();
                    }
                }
            }

            return(this);
        }
コード例 #24
0
        public override void Execute()
        {
            WriteLiteral("\r\n");



            WriteLiteral("\r\n");



            #line 11 "..\..\Dashboard\StandbyPage.cshtml"

            string        selectedCategory = this.SelectedCategory;
            StandbyMap    jobMap           = this.Map;
            JobKitOptions options          = this.Options;
            Layout = new LayoutPage(Strings.Standby_Title);
            var availableJobs = jobMap.JobCollection.Where(x => x.Value.CategoryName == selectedCategory).Select(x => x.Value).ToArray();



            #line default
            #line hidden
            WriteLiteral("\r\n<link rel=\"stylesheet\" type=\"text/css\" href=\"");



            #line 19 "..\..\Dashboard\StandbyPage.cshtml"
            Write(Url.To(JobKitRoute.Standby.CssUrl));


            #line default
            #line hidden
            WriteLiteral("\" />\r\n<script type=\"text/javascript\">\r\n    var launchUrl = \'");



            #line 21 "..\..\Dashboard\StandbyPage.cshtml"
            Write(Url.To(JobKitRoute.Standby.LaunchUrl));


            #line default
            #line hidden
            WriteLiteral("\';\r\n    var recurringUrl = \'");



            #line 22 "..\..\Dashboard\StandbyPage.cshtml"
            Write(Url.To(JobKitRoute.Standby.LaunchRecurringUrl));


            #line default
            #line hidden
            WriteLiteral("\';\r\n    var idFieldName = \'");



            #line 23 "..\..\Dashboard\StandbyPage.cshtml"
            Write(StandbyKey.IdField);


            #line default
            #line hidden
            WriteLiteral("\';\r\n    var jobLinkBaseUrl = \'");



            #line 24 "..\..\Dashboard\StandbyPage.cshtml"
            Write(Url.JobDetails(""));


            #line default
            #line hidden
            WriteLiteral("\';\r\n    var requireConfirmation = ");



            #line 25 "..\..\Dashboard\StandbyPage.cshtml"
            Write(options.RequireConfirmation.ToString().ToLowerInvariant());


            #line default
            #line hidden
            WriteLiteral(";\r\n    var messageLaunch = {\r\n        confirm: \'");



            #line 27 "..\..\Dashboard\StandbyPage.cshtml"
            Write(Strings.Standby_Launch);


            #line default
            #line hidden
            WriteLiteral("\',\r\n        confirmRecurring: \'");



            #line 28 "..\..\Dashboard\StandbyPage.cshtml"
            Write(Strings.Standby_LaunchRecurring);


            #line default
            #line hidden
            WriteLiteral("\',\r\n        success: \'");



            #line 29 "..\..\Dashboard\StandbyPage.cshtml"
            Write(Strings.Standby_Success);


            #line default
            #line hidden
            WriteLiteral("\',\r\n        successRecurring: \'");



            #line 30 "..\..\Dashboard\StandbyPage.cshtml"
            Write(Strings.Standby_SuccessRecurring);


            #line default
            #line hidden
            WriteLiteral("\',\r\n        failure: \'");



            #line 31 "..\..\Dashboard\StandbyPage.cshtml"
            Write(Strings.Standby_Failure);


            #line default
            #line hidden
            WriteLiteral("\'\r\n    };\r\n</script>\r\n<script type=\"text/javascript\" src=\"");



            #line 34 "..\..\Dashboard\StandbyPage.cshtml"
            Write(Url.To(JobKitRoute.Standby.JsUrl));


            #line default
            #line hidden
            WriteLiteral("\"></script>\r\n\r\n    <div class=\"row\">\r\n        <div class=\"col-md-3\">\r\n           " +
                         " ");



            #line 38 "..\..\Dashboard\StandbyPage.cshtml"
            Write(SidebarControl.Render(Html, selectedCategory, jobMap));


            #line default
            #line hidden
            WriteLiteral("\r\n        </div>\r\n        <div class=\"col-md-9\">\r\n            <h1 class=\"page-hea" +
                         "der\">");



            #line 41 "..\..\Dashboard\StandbyPage.cshtml"
            Write(selectedCategory);


            #line default
            #line hidden
            WriteLiteral("</h1>\r\n");



            #line 42 "..\..\Dashboard\StandbyPage.cshtml"
            foreach (var job in availableJobs)
            {
            #line default
            #line hidden
                WriteLiteral("                <div class=\"panel panel-default\">\r\n                    <div class" +
                             "=\"panel-heading\">\r\n                        <div class=\"row\" onclick=\"onCollapse(" +
                             "this, \'");



            #line 46 "..\..\Dashboard\StandbyPage.cshtml"
                Write(job.Id);


            #line default
            #line hidden
                WriteLiteral("\');\">\r\n                            <div class=\"col-sm-10\">\r\n                     " +
                             "           <h4>\r\n                                    ");



            #line 49 "..\..\Dashboard\StandbyPage.cshtml"
                Write(job.ActionName);


            #line default
            #line hidden
                WriteLiteral("\r\n");



            #line 50 "..\..\Dashboard\StandbyPage.cshtml"
                if (!string.IsNullOrEmpty(job.Name))
                {
            #line default
            #line hidden
                    WriteLiteral("                                        <span class=\"subtitle\">");



            #line 52 "..\..\Dashboard\StandbyPage.cshtml"
                    Write(job.Name);


            #line default
            #line hidden
                    WriteLiteral("</span>\r\n");



            #line 53 "..\..\Dashboard\StandbyPage.cshtml"
                }


            #line default
            #line hidden
                WriteLiteral("                                </h4>\r\n                            </div>\r\n      " +
                             "                      <div class=\"col-sm-2 text-right\">\r\n                       " +
                             "         <span class=\"btn glyphicon ");



            #line 57 "..\..\Dashboard\StandbyPage.cshtml"
                Write(options.AlwaysCollapsed ? "glyphicon-chevron-up" : "glyphicon-chevron-down");


            #line default
            #line hidden
                WriteLiteral("\" aria-hidden=\"true\"></span>\r\n                            </div>\r\n               " +
                             "         </div>\r\n                        \r\n                    </div>\r\n         " +
                             "           <div class=\"panel-body ");



            #line 62 "..\..\Dashboard\StandbyPage.cshtml"
                Write(options.AlwaysCollapsed ? "" : "hide");


            #line default
            #line hidden
                WriteLiteral("\" id=\"");



            #line 62 "..\..\Dashboard\StandbyPage.cshtml"
                Write(job.Id);


            #line default
            #line hidden
                WriteLiteral("-body\">\r\n");



            #line 63 "..\..\Dashboard\StandbyPage.cshtml"
                if (!string.IsNullOrWhiteSpace(job.Description))
                {
            #line default
            #line hidden
                    WriteLiteral("                            <div class=\"alert alert-info\" role=\"alert\">\r\n        " +
                                 "                        ");



            #line 66 "..\..\Dashboard\StandbyPage.cshtml"
                    Write(job.Description);


            #line default
            #line hidden
                    WriteLiteral("\r\n                            </div>\r\n");



            #line 68 "..\..\Dashboard\StandbyPage.cshtml"
                }


            #line default
            #line hidden
                WriteLiteral("                        <form id=\"");



            #line 69 "..\..\Dashboard\StandbyPage.cshtml"
                Write(job.Id);


            #line default
            #line hidden
                WriteLiteral("\">\r\n");



            #line 70 "..\..\Dashboard\StandbyPage.cshtml"
                foreach (var parameter in job.Method.GetParameters())
                {
                    var control = InputControl.CreateControl(parameter, job);
                    if (control is NullControl)
                    {
                        continue;
                    }



            #line default
            #line hidden
                    WriteLiteral("                                <div class=\"form-group\">\r\n                       " +
                                 "             ");



            #line 76 "..\..\Dashboard\StandbyPage.cshtml"
                    Write(Html.RenderPartial(control));


            #line default
            #line hidden
                    WriteLiteral("\r\n                                </div>\r\n");



            #line 78 "..\..\Dashboard\StandbyPage.cshtml"
                }


            #line default
            #line hidden
                WriteLiteral("                            <button type=\"button\" class=\"btn btn-primary\" onclick" +
                             "=\"onEnqueue(this, \'");



            #line 79 "..\..\Dashboard\StandbyPage.cshtml"
                Write(job.Id);


            #line default
            #line hidden
                WriteLiteral("\');return false;\">");



            #line 79 "..\..\Dashboard\StandbyPage.cshtml"
                Write(Strings.Button_Created);


            #line default
            #line hidden
                WriteLiteral("</button>\r\n");



            #line 80 "..\..\Dashboard\StandbyPage.cshtml"
                if (job.UseQueue)
                {
            #line default
            #line hidden
                    WriteLiteral(@"                                <div class=""queue-input"">
                                    <div class="" input-group"">
                                        <div class=""input-group-addon"">Queue</div>
                                        <input type=""text"" name=""equeued_state"" class=""form-control"" />
                                    </div>
                                </div>
");



            #line 88 "..\..\Dashboard\StandbyPage.cshtml"
                }


            #line default
            #line hidden


            #line 89 "..\..\Dashboard\StandbyPage.cshtml"
                if (!string.IsNullOrEmpty(job.RecurringJobId))
                {
            #line default
            #line hidden
                    WriteLiteral("                                <span class=\"cron-input\">\r\n                      " +
                                 "              <input type=\"text\" name=\"recurring_cron\" class=\"form-control\" plac" +
                                 "eholder=\"Cron\" value=\"");



            #line 92 "..\..\Dashboard\StandbyPage.cshtml"
                    Write(job.RecurringJobCron);


            #line default
            #line hidden
                    WriteLiteral("\">\r\n                                    <button class=\"btn btn-success\" type=\"but" +
                                 "ton\" onclick=\"onRecurring(this, \'");



            #line 93 "..\..\Dashboard\StandbyPage.cshtml"
                    Write(job.Id);


            #line default
            #line hidden
                    WriteLiteral("\');return false;\">");



            #line 93 "..\..\Dashboard\StandbyPage.cshtml"
                    Write(Strings.Button_Recurring);


            #line default
            #line hidden
                    WriteLiteral("</button>\r\n\r\n                                </span>\r\n");



            #line 96 "..\..\Dashboard\StandbyPage.cshtml"
                }


            #line default
            #line hidden
                WriteLiteral("                        </form>\r\n                        <div id=\"");



            #line 98 "..\..\Dashboard\StandbyPage.cshtml"
                Write(job.Id);


            #line default
            #line hidden
                WriteLiteral("-alerts\" class=\"panel-alerts\"></div>\r\n                    </div>\r\n               " +
                             " </div>\r\n");



            #line 101 "..\..\Dashboard\StandbyPage.cshtml"
            }


            #line default
            #line hidden
            WriteLiteral("        </div>\r\n    </div>\r\n");
        }
コード例 #25
0
        public override void Execute()
        {
            WriteLiteral("\r\n");



            #line 8 "..\..\Dashboard\Pages\CornJobsPage.cshtml"

            Layout = new LayoutPage("Corn表达式在线生成");



            #line default
            #line hidden
            WriteLiteral(@"
<style>
    body {
        width: 50%;
        margin: 0 auto;
        padding-bottom: 20px;
    }

    input[type=number] {
        height: 25px;
        width: 52px;
    }

    .search-field input[type=text] {
        width: 152px !important;
    }
</style>
<div>
    <div style=""text-align: center;"">
        <h3>Corn表达式在线生成</h3>
        <br>
    </div>
    <div>
        <!-- Nav tabs -->
        <ul class=""nav nav-tabs"" role=""tablist"">
            ");



            WriteLiteral(@"
            <li role=""presentation"">
                <a href=""#minute"" aria-controls=""minute"" role=""tab"" data-toggle=""tab"">分钟</a>
            </li>
            <li role=""presentation"">
                <a href=""#hour"" aria-controls=""hour"" role=""tab"" data-toggle=""tab"">小时</a>
            </li>
            <li role=""presentation"">
                <a href=""#day"" aria-controls=""day"" role=""tab"" data-toggle=""tab"">日</a>
            </li>
            <li role=""presentation"">
                <a href=""#month"" aria-controls=""month"" role=""tab"" data-toggle=""tab"">月</a>
            </li>
            <li role=""presentation"">
                <a href=""#week"" aria-controls=""week"" role=""tab"" data-toggle=""tab"">周</a>
            </li>
            ");



            WriteLiteral("\r\n        </ul>\r\n\r\n        <!-- Tab panes -->\r\n        <div class=\"tab-content\">\r" +
                         "\n\r\n            <!--秒-->\r\n            ");



            WriteLiteral("\r\n\r\n            <!--分钟-->\r\n            <div role=\"tabpanel\" class=\"tab-pane activ" +
                         "e\" id=\"minute\">\r\n                <div class=\"radio\">\r\n                    <label" +
                         ">\r\n                        <input type=\"radio\" name=\"minuteType\" value=\"All\" che" +
                         "cked=\"checked\">\r\n                        每分钟 允许的通配符[, - * /]\r\n                  " +
                         "  </label>\r\n                </div>\r\n                <div class=\"radio\">\r\n       " +
                         "             <label>\r\n                        <input type=\"radio\" name=\"minuteTy" +
                         "pe\" value=\"Cyclic\">\r\n                        周期从\r\n                        <input" +
                         " type=\"number\" id=\"minuteTypeCyclic_1\" value=\"\">\r\n                        -\r\n   " +
                         "                     <input type=\"number\" id=\"minuteTypeCyclic_2\" value=\"\">\r\n   " +
                         "                     分钟\r\n                    </label>\r\n                </div>\r\n\r" +
                         "\n                <div class=\"radio\">\r\n                    <label>\r\n             " +
                         "           <input type=\"radio\" name=\"minuteType\" value=\"Interval\">\r\n            " +
                         "            从\r\n                        <input type=\"number\" id=\"minuteTypeInterv" +
                         "al_1\" value=\"\">\r\n                        分钟开始,每\r\n                        <input " +
                         "type=\"number\" id=\"minuteTypeInterval_2\" value=\"\">\r\n                        分钟执行一" +
                         "次\r\n                    </label>\r\n                </div>\r\n\r\n                <div " +
                         "class=\"radio\">\r\n                    <label>\r\n                        <input type" +
                         "=\"radio\" name=\"minuteType\" value=\"Assigned\">\r\n                        指定\r\n      " +
                         "              </label>\r\n                </div>\r\n                <div style=\"marg" +
                         "in-left: 20px;\">\r\n                    <select id=\"minuteTypeAssigned_1\" data-pla" +
                         "ceholder=\"选择指定的分钟...\"\r\n                            style=\"width:350px;\" multiple" +
                         "></select>\r\n                </div>\r\n            </div>\r\n\r\n            <!--小时-->\r" +
                         "\n            <div role=\"tabpanel\" class=\"tab-pane\" id=\"hour\">\r\n\r\n               " +
                         " <div class=\"radio\">\r\n                    <label>\r\n                        <inpu" +
                         "t type=\"radio\" name=\"hourType\" value=\"All\" checked=\"checked\">\r\n                 " +
                         "       每小时 允许的通配符[, - * /]\r\n                    </label>\r\n                </div>" +
                         "\r\n                <div class=\"radio\">\r\n                    <label>\r\n            " +
                         "            <input type=\"radio\" name=\"hourType\" value=\"Cyclic\">\r\n               " +
                         "         周期从\r\n                        <input type=\"number\" id=\"hourTypeCyclic_1\"" +
                         " value=\"\">\r\n                        -\r\n                        <input type=\"numb" +
                         "er\" id=\"hourTypeCyclic_2\" value=\"\">\r\n                        小时\r\n               " +
                         "     </label>\r\n                </div>\r\n\r\n                <div class=\"radio\">\r\n  " +
                         "                  <label>\r\n                        <input type=\"radio\" name=\"hou" +
                         "rType\" value=\"Interval\">\r\n                        从\r\n                        <in" +
                         "put type=\"number\" id=\"hourTypeInterval_1\" value=\"\">\r\n                        时开始" +
                         ",每\r\n                        <input type=\"number\" id=\"hourTypeInterval_2\" value=\"" +
                         "\">\r\n                        小时执行一次\r\n                    </label>\r\n              " +
                         "  </div>\r\n\r\n                <div class=\"radio\">\r\n                    <label>\r\n  " +
                         "                      <input type=\"radio\" name=\"hourType\" value=\"Assigned\">\r\n   " +
                         "                     指定\r\n                    </label>\r\n                </div>\r\n " +
                         "               <div style=\"margin-left: 20px;\">\r\n                    <select id=" +
                         "\"hourTypeAssigned_1\" data-placeholder=\"选择指定的小时...\"\r\n                            " +
                         "style=\"width:350px;\" multiple></select>\r\n                </div>\r\n\r\n            <" +
                         "/div>\r\n\r\n\r\n            <!--日-->\r\n            <div role=\"tabpanel\" class=\"tab-pan" +
                         "e\" id=\"day\">\r\n\r\n                <div class=\"radio\">\r\n                    <label>" +
                         "\r\n                        <input type=\"radio\" name=\"dayType\" value=\"All\" checked" +
                         "=\"checked\">\r\n                        每日 允许的通配符[, - * / L W]\r\n                   " +
                         " </label>\r\n                </div>\r\n                <div class=\"radio\">\r\n        " +
                         "            <label>\r\n                        <input type=\"radio\" name=\"dayType\" " +
                         "value=\"Cyclic\">\r\n                        周期从\r\n                        <input typ" +
                         "e=\"number\" id=\"dayTypeCyclic_1\" value=\"\">\r\n                        -\r\n          " +
                         "              <input type=\"number\" id=\"dayTypeCyclic_2\" value=\"\">\r\n             " +
                         "           日\r\n                    </label>\r\n                </div>\r\n\r\n          " +
                         "      <div class=\"radio\">\r\n                    <label>\r\n                        " +
                         "<input type=\"radio\" name=\"dayType\" value=\"Interval\">\r\n                        从\r" +
                         "\n                        <input type=\"number\" id=\"dayTypeInterval_1\" value=\"\">\r\n" +
                         "                        日开始,每\r\n                        <input type=\"number\" id=\"" +
                         "dayTypeInterval_2\" value=\"\">\r\n                        日执行一次\r\n                   " +
                         " </label>\r\n                </div>\r\n\r\n                <div class=\"radio\">\r\n      " +
                         "              <label>\r\n                        <input type=\"radio\" name=\"dayType" +
                         "\" value=\"Assigned\">\r\n                        指定\r\n                    </label>\r\n " +
                         "               </div>\r\n                <div style=\"margin-left: 20px;\">\r\n       " +
                         "             <select id=\"dayTypeAssigned_1\" data-placeholder=\"选择指定的日...\"\r\n      " +
                         "                      style=\"width:350px;\" multiple></select>\r\n                <" +
                         "/div>\r\n\r\n                ");



            WriteLiteral("\r\n            </div>\r\n\r\n\r\n            <!--月-->\r\n            <div role=\"tabpanel\" " +
                         "class=\"tab-pane\" id=\"month\">\r\n                <div class=\"radio\">\r\n             " +
                         "       <label>\r\n                        <input type=\"radio\" name=\"monthType\" val" +
                         "ue=\"All\" checked=\"checked\">\r\n                        每月 允许的通配符[, - * /]\r\n       " +
                         "             </label>\r\n                </div>\r\n                <div class=\"radio" +
                         "\">\r\n                    <label>\r\n                        <input type=\"radio\" nam" +
                         "e=\"monthType\" value=\"Cyclic\">\r\n                        周期从\r\n                    " +
                         "    <input type=\"number\" id=\"monthTypeCyclic_1\" value=\"\">\r\n                     " +
                         "   -\r\n                        <input type=\"number\" id=\"monthTypeCyclic_2\" value=" +
                         "\"\">\r\n                        月\r\n                    </label>\r\n                </" +
                         "div>\r\n\r\n                <div class=\"radio\">\r\n                    <label>\r\n      " +
                         "                  <input type=\"radio\" name=\"monthType\" value=\"Interval\">\r\n      " +
                         "                  从\r\n                        <input type=\"number\" id=\"monthTypeI" +
                         "nterval_1\" value=\"\">\r\n                        月开始,每\r\n                        <in" +
                         "put type=\"number\" id=\"monthTypeInterval_2\" value=\"\">\r\n                        月执" +
                         "行一次\r\n                    </label>\r\n                </div>\r\n\r\n                <di" +
                         "v class=\"radio\">\r\n                    <label>\r\n                        <input ty" +
                         "pe=\"radio\" name=\"monthType\" value=\"Assigned\">\r\n                        指定\r\n     " +
                         "               </label>\r\n                </div>\r\n                <div style=\"mar" +
                         "gin-left: 20px;\">\r\n                    <select id=\"monthTypeAssigned_1\" data-pla" +
                         "ceholder=\"选择指定的月...\"\r\n                            style=\"width:350px;\" multiple>" +
                         "</select>\r\n                </div>\r\n\r\n                ");



            WriteLiteral("\r\n            </div>\r\n\r\n\r\n            <!--周-->\r\n            <div role=\"tabpanel\" " +
                         "class=\"tab-pane\" id=\"week\">\r\n                <div class=\"radio\">\r\n              " +
                         "      <label>\r\n                        <input type=\"radio\" name=\"weekType\" value" +
                         "=\"All\" checked=\"checked\">\r\n                        每周 允许的通配符[, - * / L #]\r\n     " +
                         "               </label>\r\n                </div>\r\n                <div class=\"rad" +
                         "io\">\r\n                    <label>\r\n                        <input type=\"radio\" n" +
                         "ame=\"weekType\" value=\"Cyclic\">\r\n                        周期从\r\n                   " +
                         "     <input type=\"number\" id=\"weekTypeCyclic_1\" value=\"\">\r\n                     " +
                         "   -\r\n                        <input type=\"number\" id=\"weekTypeCyclic_2\" value=\"" +
                         "\">\r\n                        周\r\n                    </label>\r\n                </d" +
                         "iv>\r\n\r\n                <div class=\"radio\">\r\n                    <label>\r\n       " +
                         "                 <input type=\"radio\" name=\"weekType\" value=\"WeeksOfWeek\">\r\n     " +
                         "                   第\r\n                        <input type=\"number\" id=\"weekTypeW" +
                         "eeksOfWeek_1\" value=\"\">\r\n                        周 的星期\r\n                        " +
                         "<input type=\"number\" id=\"weekTypeWeeksOfWeek_2\" value=\"\">\r\n\r\n                   " +
                         " </label>\r\n                </div>\r\n\r\n                <div class=\"radio\">\r\n      " +
                         "              <label>\r\n                        <input type=\"radio\" name=\"weekTyp" +
                         "e\" value=\"Assigned\">\r\n                        指定\r\n                    </label>\r\n" +
                         "                </div>\r\n                <div style=\"margin-left: 20px;\">\r\n      " +
                         "              <select id=\"weekTypeAssigned_1\" data-placeholder=\"选择指定的周...\"\r\n    " +
                         "                        style=\"width:350px;\" multiple></select>\r\n               " +
                         " </div>\r\n\r\n                ");



            WriteLiteral("\r\n            </div>\r\n\r\n\r\n            <!--年-->\r\n            ");



            WriteLiteral(@"

        </div>
    </div>
    <hr>

    <div class=""panel panel-info"">
        <div class=""panel-heading"">
            <h3 class=""panel-title"">结果</h3>
        </div>

        <div class=""panel-body"">

            <form class=""form-inline"">
                <!--<div class=""form-group"">
                    <label class=""sr-only"">结果</label>
                    <p class=""form-control-static"">结果</p>
                </div>-->
                <div class=""form-group"">
                    <label for=""result"" class=""sr-only"">Password</label>
                    <input type=""text"" class=""form-control"" style=""width: 500px;"" id=""result"" placeholder=""结果"">
                </div>
                <button type=""button"" id=""analysis"" class=""btn btn-default"">反解析</button>
            </form>
        </div>
    </div>
</div>");
        }
コード例 #26
0
        public override void Execute()
        {
            Layout = new LayoutPage(menuName);
            WriteLiteral($@"
<div class=""row"">
	<div class=""col-md-3"">
");
            Write(Html.RenderPartial(new CustomSidebarMenu(ManagementSidebarMenu.Items)));
            WriteLiteral($@"
	</div>
	<div class=""col-md-9 accordion job-panels"">
");

            var jobs         = JobsHelper.Metadata.Where(j => j.MenuName.Contains(menuName)).OrderBy(x => x.SectionTitle).ThenBy(x => x.Name);
            var taskSections = jobs.Select(j => j.SectionTitle).Distinct().ToDictionary(k => k, v => string.Empty);

            foreach (var section in taskSections.Keys)
            {
                var scrubbedSection = section.ScrubURL();
                var expanded        = taskSections.Keys.First() == section;

                if (taskSections.Count > 1)
                {
                    WriteLiteral($@"
		<div class=""panel panel-info card wrapper-panel"" data-id=""section_{scrubbedSection}"">
			<div id=""section_heading_{scrubbedSection}"" class=""panel-heading card-header {(expanded ? "" : "collapsed")}collapsed"" role=""button"" data-toggle=""collapse"" data-parent=""#accordion"" href=""#section_collapse_{scrubbedSection}"" aria-expanded=""{(expanded ? "true" : "false")}"" aria-controls=""section_collapse_{scrubbedSection}"">
				<h4 class=""panel-title"">
					{section}
				</h4>
			</div>
");
                }
                else
                {
                    WriteLiteral($@"
			<h1 class=""page-header single-section"">{section}</h1>
");
                }
                WriteLiteral($@"
			<div id=""section_collapse_{scrubbedSection}"" class=""panel-collapse {(expanded ? "collapse in" : "collapse")}"" aria-expanded=""{(expanded ? "true" : "false")}"" aria-labelledby=""section_heading_{scrubbedSection}"" data-parent=""#jobsAccordion"">
");
                PanelWriter(scrubbedSection, jobs.Where(j => j.SectionTitle == section).ToList());
                WriteLiteral($@"
			</div>
		</div>
");
            }

            if (taskSections.Count > 1)
            {
                WriteLiteral($@"
	</div>
");
            }

            CronModal();
            WriteLiteral($@"
</div>
<script>
	function LoadJSM() {{
		var link2 = document.createElement('script');
		link2.setAttribute('src', '{Url.To($"{ManagementPage.UrlRoute}/jsm")}');
		document.getElementsByTagName('body')[0].appendChild(link2);
	}}

	if (window.attachEvent) {{
		window.attachEvent('onload', LoadJSM);
	}}
	else {{
		if (window.onload) {{
			var curronload = window.onload;
			var newonload = function (evt) {{
				curronload(evt);
				LoadJSM(evt);
			}};
			window.onload = newonload;
		}} else {{
			window.onload = LoadJSM;
		}}
	}}
</script>
<link rel=""stylesheet"" type=""text/css"" href=""{Url.To($"{ManagementPage.UrlRoute}/jsmcss")}"" />
");
        }
コード例 #27
0
        public override void Execute()
        {
            WriteLiteral(@"<link rel=""stylesheet"" href=""https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"" integrity=""sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB"" crossorigin=""anonymous"">");
            Layout = new LayoutPage(Title);

            WriteLiteral("<div class=\"col-md-12\">\r\n");
            WriteLiteral("<h1 class=\"page-header\">\r\n");
            Write(Title);
            WriteLiteral("</h1>\r\n");
            WriteLiteral(@"<!-- Card -->
<div class=""card card-image"" style=""background-image: url(https://mdbootstrap.com/img/Photos/Horizontal/Work/4-col/img%20%2814%29.jpg);"">

    <!-- Content -->
    <div >
        <div class=""row d-flex justify-content-center "">
            <div class=""col-md-10 col-xl-8"">

                <!--Accordion wrapper-->
                <div class=""accordion"" id=""accordionE"" role=""tablist"" aria-multiselectable=""true"">");

            for (var i = 0; i < ActiveSubscriptions.ListSubscriptions().Count(); i++)
            {
                var currentSubscription = ActiveSubscriptions.ListSubscriptions()[i];
                WriteLiteral($@"<!--Accordion card -->
                    <div class =""card mb-4"" >

                    <!--Card header -->
                    <div class=""card-header p-0 z-depth-1"" role=""tab"" id=""header_{i}"" >
                    <a data-toggle=""collapse"" data-parent=""#accordion"" href=""#collapse_{i}"" aria-expanded=""true"" aria-controls=""collapse_{i}"">
                        <i class=""fa fa-cloud fa-2x p-3 mr-4 float-left black-text"" aria-hidden=""true"" ></i >
                    <h4 class =""text-uppercase white-text mb-0 py-3 mt-1"" >
                    {currentSubscription.MailBox} - {currentSubscription.SubscriptionName} last action {currentSubscription.LastActivity:g}
                    </h4 >
                    </a >
                    </div >

                    <!--Card body -->
                    <div id=""collapse_{i}"" class=""collapse"" role=""tabpanel"" aria-labelledby=""header_{i}"" data-parent=""#accordion"">
                        <div class =""card-body rgba-black-light white-text z-depth-1"" >
                    <p class=""p-md-4 mb-0"" >{string.Join(", ",currentSubscription.SubscriptionChangeCollectionData.Select(x=>x.FolderPath))}</p >
                    </div >
                    </div >
                    </div >
                    <!--Accordion card -->");
            }
            WriteLiteral(@" </div>
                <!--/.Accordion wrapper -->

            </div>
        </div>
    </div>
    <!-- Content -->
</div>
<!-- Card -->");

            /*    for (var i = 0; i < ActiveSubscriptions.Subscriptions.Count(); i++)
             *  {
             *      WriteLiteral($@"<div class=""card"">
             *          <div class=""card-header bg-danger"" id=""Subscription_{i}""><h5 class=""mb-0"">
             *              <button class=""btn btn-link"" data-toggle=""collapse"" data-target=""#collapse_{i}"" aria-expanded=""true"" aria-controls=""collapseOne"">");
             *      Write(ActiveSubscriptions.Subscriptions[i].SubscriptionName);
             *      WriteLiteral(" - ");
             *      Write(ActiveSubscriptions.Subscriptions[i].MailBox);
             *      WriteLiteral(@"</button><button class=""btn btn-success"">Reset</button>");
             *      WriteLiteral("                        </h5>\r\n");
             *      WriteLiteral("                    </div>\r\n");
             *      WriteLiteral($@"<div id=""collapse_{i}"" class=""collapse show"" aria-labelledby=""headingOne"" data-parent=""#accordion"">
             *              <div class=""card-body"">
             *                 <div class=""row"">
             *                      <div class="""">
             *                          <label>Last Refresh Time:</label>
             *                          <input type=""text"" class=""form-control form-control-readonly"" value=""{ActiveSubscriptions.Subscriptions[i].LastMisFileDate.Value:dd-mmm-yy}"" />
             *                      </div>
             *                 </div>
             *                  <div class=""row"">
             *                      <div class="""">
             *                          <label>Number of Folders:</label>
             *                          <input type=""text"" class=""form-control form-control-readonly"" value=""{ActiveSubscriptions.Subscriptions[i].SubscriptionData.Count}"" />
             *                      </div>
             *                 </div>
             *                  <div class=""row"">
             *                      <div class="""">
             *                          <label>Folders:</label>
             *                          <input type=""text"" class=""form-control form-control-readonly"" value=""{string.Join(",",ActiveSubscriptions.Subscriptions[i].SubscriptionData)}"" />
             *                      </div>
             *                 </div>
             *              </div>
             *          </div>
             *      </div>");
             */
            WriteLiteral("\r\n</div>\r\n");
            WriteLiteral("\r\n</div>\r\n");
        }
コード例 #28
0
        void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (!(e.Node.IsSelected) || e.Node.Tag == null)
            {
                return;
            }
            // Rebuild the tree if required.
            rebuild = true;

            richEditControl1.Document.ChangeActiveDocument(richEditControl1.Document);
            LayoutElement       element       = layoutTreeDictionary[e.Node];
            RangedLayoutElement rangedElement = element as RangedLayoutElement;

            // Select a range or scroll to a document position, according to the type of the layout element.
            if ((ContentDisplayAction)e.Node.Tag == ContentDisplayAction.ScrollTo)
            {
                LayoutPage     page            = element.GetParentByType <LayoutPage>();
                LayoutPageArea nearestPageArea = page.PageAreas[0];

                if ((element.Type == LayoutType.Header) || (element.GetParentByType <LayoutHeader>() != null))
                {
                    ScrollToPosition(nearestPageArea.Range.Start);
                }
                if ((element.Type == LayoutType.Footer) || (element.GetParentByType <LayoutFooter>() != null))
                {
                    ScrollToPosition(nearestPageArea.Range.Start + nearestPageArea.Range.Length);
                }
                LayoutFloatingObject layoutFloatingObject = element as LayoutFloatingObject;
                if (layoutFloatingObject != null)
                {
                    FloatingObjectAnchorBox anchor = layoutFloatingObject.AnchorBox;
                    ScrollToPosition(anchor.Range.Start);
                    richEditControl1.Document.Selection = richEditControl1.Document.CreateRange(anchor.Range.Start, anchor.Range.Length);
                }
                LayoutComment layoutComment = element as LayoutComment;
                if (layoutComment != null)
                {
                    Comment comment = layoutComment.GetDocumentComment();
                    ScrollToPosition(comment.Range.Start.ToInt());
                }

                LayoutTextBox textBox = element.GetParentByType <LayoutTextBox>();
                if (textBox != null)
                {
                    // Do not rebuild the tree.
                    rebuild = false;
                    ScrollToPosition(textBox.AnchorBox.Range.Start);
                    SubDocument doc = richEditControl1.DocumentLayout.BeginUpdateDocument(textBox);
                    richEditControl1.Document.ChangeActiveDocument(doc);
                    richEditControl1.Document.Selection = doc.CreateRange(rangedElement.Range.Start, rangedElement.Range.Length);
                    richEditControl1.DocumentLayout.EndUpdateDocument(doc);
                }
            }
            else
            {
                if (rangedElement == null)
                {
                    return;
                }
                ScrollToPosition(rangedElement.Range.Start);
                richEditControl1.Document.Selection = richEditControl1.Document.CreateRange(rangedElement.Range.Start, rangedElement.Range.Length);
            }
        }
コード例 #29
0
ファイル: TemplatePage.cs プロジェクト: 842549829/Redis
        public async Task <TemplatePage> Load()
        {
            string contents;

            using (var stream = File.OpenRead())
            {
                contents = await stream.ReadToEndAsync();
            }

            var lastModified = File.LastModified;
            var fileContents = contents.AsMemory();
            var pageVars     = new Dictionary <string, object>();

            var pos          = 0;
            var bodyContents = fileContents;

            fileContents.AdvancePastWhitespace().TryReadLine(out ReadOnlyMemory <char> line, ref pos);
            if (line.StartsWith(Format.ArgsPrefix))
            {
                while (fileContents.TryReadLine(out line, ref pos))
                {
                    if (line.Trim().Length == 0)
                    {
                        continue;
                    }


                    if (line.StartsWith(Format.ArgsSuffix))
                    {
                        break;
                    }

                    line.SplitOnFirst(':', out var first, out var last);
                    pageVars[first.Trim().ToString()] = !last.IsEmpty ? last.Trim().ToString() : "";
                }

                //When page has variables body starts from first non whitespace after variable's end
                var argsSuffixPos = line.LastIndexOf(Format.ArgsSuffix);
                if (argsSuffixPos >= 0)
                {
                    //Start back from the end of the ArgsSuffix
                    pos -= line.Length - argsSuffixPos - Format.ArgsSuffix.Length;
                }
                bodyContents = fileContents.SafeSlice(pos).AdvancePastWhitespace();
            }

            var pageFragments = pageVars.TryGetValue("ignore", out object ignore) &&
                                ("page".Equals(ignore.ToString()) || "template".Equals(ignore.ToString()))
                ? new List <PageFragment> {
                new PageStringFragment(bodyContents)
            }
                : TemplatePageUtils.ParseTemplatePage(bodyContents);

            foreach (var fragment in pageFragments)
            {
                if (fragment is PageVariableFragment var && var.Binding == TemplateConstants.Page)
                {
                    IsLayout = true;
                    break;
                }
            }

            lock (semaphore)
            {
                LastModified      = lastModified;
                LastModifiedCheck = DateTime.UtcNow;
                FileContents      = fileContents;
                Args          = pageVars;
                BodyContents  = bodyContents;
                PageFragments = pageFragments;

                HasInit    = true;
                LayoutPage = Format.ResolveLayout(this);
            }

            if (LayoutPage != null)
            {
                if (!LayoutPage.HasInit)
                {
                    await LayoutPage.Load();
                }
                else
                {
                    if (Context.DebugMode || Context.CheckForModifiedPagesAfter != null &&
                        DateTime.UtcNow - LayoutPage.LastModifiedCheck >= Context.CheckForModifiedPagesAfter.Value)
                    {
                        LayoutPage.File.Refresh();
                        LayoutPage.LastModifiedCheck = DateTime.UtcNow;
                        if (LayoutPage.File.LastModified != LayoutPage.LastModified)
                        {
                            await LayoutPage.Load();
                        }
                    }
                }
            }

            return(this);
        }
コード例 #30
0
 public override void DrawPage(LayoutPage page)
 {
     base.DrawPage(page);
     HighlightElement(page);
 }
コード例 #31
0
 protected override void VisitPage(LayoutPage page)
 {
     TryAddElementToCollection(page, ContentDisplayAction.Select, true);
     base.VisitPage(page);
 }