public void WrapMultipleDeclarations(WrapStyle wrapStyle, string expected)
 {
     Test(
         expected,
         Syntax.LocalDeclarationStatement(
             Syntax.VariableDeclaration(
                 Syntax.ParseName("var"),
                 new[]
     {
         Syntax.VariableDeclarator(
             "i",
             null,
             Syntax.EqualsValueClause(Syntax.LiteralExpression(0))
             ),
         Syntax.VariableDeclarator(
             "j",
             null,
             Syntax.EqualsValueClause(Syntax.LiteralExpression(0))
             )
     }
                 )
             ),
         p => p.LineBreaksAndWrapping.LineWrapping.WrapMultipleDeclarations = wrapStyle
         );
 }
 public void WrapChainedMethodCalls(WrapStyle wrapStyle, bool afterDot, string expected)
 {
     Test(
         expected,
         Syntax.ExpressionStatement(
             Syntax.InvocationExpression(
                 Syntax.MemberAccessExpression(
                     Syntax.InvocationExpression(
                         Syntax.MemberAccessExpression(
                             Syntax.InvocationExpression(
                                 Syntax.MemberAccessExpression(
                                     Syntax.InvocationExpression(
                                         Syntax.MemberAccessExpression(
                                             Syntax.InvocationExpression(
                                                 Syntax.MemberAccessExpression(
                                                     Syntax.InvocationExpression(
                                                         Syntax.MemberAccessExpression(
                                                             Syntax.InvocationExpression(
                                                                 Syntax.MemberAccessExpression(
                                                                     Syntax.InvocationExpression(
                                                                         Syntax.ParseName("Method"),
                                                                         Syntax.ArgumentList()
                                                                         ),
                                                                     (SimpleNameSyntax)Syntax.ParseName("Method")
                                                                     ),
                                                                 Syntax.ArgumentList()
                                                                 ),
                                                             (SimpleNameSyntax)Syntax.ParseName("Method")
                                                             ),
                                                         Syntax.ArgumentList()
                                                         ),
                                                     (SimpleNameSyntax)Syntax.ParseName("Method")
                                                     ),
                                                 Syntax.ArgumentList()
                                                 ),
                                             (SimpleNameSyntax)Syntax.ParseName("Method")
                                             ),
                                         Syntax.ArgumentList()
                                         ),
                                     (SimpleNameSyntax)Syntax.ParseName("Method")
                                     ),
                                 Syntax.ArgumentList()
                                 ),
                             (SimpleNameSyntax)Syntax.ParseName("Method")
                             ),
                         Syntax.ArgumentList()
                         ),
                     (SimpleNameSyntax)Syntax.ParseName("Method")
                     ),
                 Syntax.ArgumentList()
                 )
             ),
         p =>
     {
         p.LineBreaksAndWrapping.LineWrapping.WrapChainedMethodCalls          = wrapStyle;
         p.LineBreaksAndWrapping.LineWrapping.PreferWrapAfterDotInMethodCalls = afterDot;
         p.LineBreaksAndWrapping.LineWrapping.RightMargin = 40;
     }
         );
 }
 public void WrapInvocationArguments(WrapStyle wrapStyle, string expected)
 {
     Test(
         expected,
         Syntax.ExpressionStatement(
             Syntax.InvocationExpression(
                 Syntax.ParseName("Method"),
                 Syntax.ArgumentList(
                     Syntax.Argument(Syntax.LiteralExpression("parameter")),
                     Syntax.Argument(
                         Syntax.BinaryExpression(
                             BinaryOperator.Plus,
                             Syntax.LiteralExpression("parameter"),
                             Syntax.LiteralExpression("parameter")
                             )
                         ),
                     Syntax.Argument(Syntax.LiteralExpression("parameter")),
                     Syntax.Argument(Syntax.LiteralExpression("parameter"))
                     )
                 )
             ),
         p =>
     {
         p.LineBreaksAndWrapping.LineWrapping.WrapInvocationArguments = wrapStyle;
         p.LineBreaksAndWrapping.LineWrapping.RightMargin             = 40;
     }
         );
 }
示例#4
0
 protected void AddButton_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         WrapStyle style = new WrapStyle();
         style.WrapGroupId  = WrapGroupId;
         style.Name         = Name.Text;
         style.ThumbnailUrl = ThumbnailUrl.Text;
         style.ImageUrl     = ImageUrl.Text;
         style.Price        = AlwaysConvert.ToDecimal(Price.Text);
         style.TaxCodeId    = AlwaysConvert.ToInt(TaxCode.SelectedValue);
         style.Save();
         Name.Text             = string.Empty;
         ThumbnailUrl.Text     = string.Empty;
         ImageUrl.Text         = string.Empty;
         Price.Text            = string.Empty;
         TaxCode.SelectedIndex = -1;
         AddedMessage.Text     = string.Format(AddedMessage.Text, style.Name);
         AddedMessage.Visible  = true;
         UpdatePanel panel = AbleCommerce.Code.PageHelper.RecursiveFindControl(this.Page, "WrapStylesAjax") as UpdatePanel;
         if (panel != null)
         {
             GridView wrapStyleGrid = AbleCommerce.Code.PageHelper.RecursiveFindControl(panel, "WrapStylesGrid") as GridView;
             if (wrapStyleGrid != null)
             {
                 wrapStyleGrid.DataBind();
                 panel.Update();
             }
         }
     }
 }
示例#5
0
        public OptionsNumericDropDown(string label, int start, int end, WrapStyle wrap, int wrapLimit, int x = -1, int y = -1) :
            base(label, 0, x, y)
        {
            _clickedField = ReflectionHelper.TryGetField <OptionsDropDown>("clicked", BindingFlags.Instance | BindingFlags.NonPublic);
            Wrap          = wrap;
            WrapLimit     = wrapLimit;

            FillOptions(start, end);
        }
示例#6
0
        private void SaveWrapStyle()
        {
            WrapStyle style = WrapStyleDataSource.Load(WrapStyleId);

            style.Name         = Name.Text;
            style.ThumbnailUrl = ThumbnailUrl.Text;
            style.ImageUrl     = ImageUrl.Text;
            style.Price        = AlwaysConvert.ToDecimal(Price.Text);
            style.TaxCodeId    = AlwaysConvert.ToInt(TaxCode.SelectedValue);
            style.Save();
        }
 public void WrapTernaryExpression(WrapStyle wrapStyle, string expected)
 {
     Test(
         expected,
         Syntax.ConditionalExpression(
             Syntax.LiteralExpression(1),
             Syntax.LiteralExpression(1),
             Syntax.LiteralExpression(1)
             ),
         p => p.LineBreaksAndWrapping.LineWrapping.WrapTernaryExpression = wrapStyle
         );
 }
 public void WrapForStatementHeader(WrapStyle wrapStyle, string expected)
 {
     Test(
         expected,
         Syntax.ForStatement(
             initializers: new[] { Syntax.LiteralExpression(1) },
             condition: Syntax.LiteralExpression(1),
             incrementors: new[] { Syntax.LiteralExpression(1) },
             statement: Syntax.Block()
             ),
         p => p.LineBreaksAndWrapping.LineWrapping.WrapForStatementHeader = wrapStyle
         );
 }
 public void WrapExtendsImplementsList(WrapStyle wrapStyle, string expected)
 {
     Test(
         expected,
         Syntax.ClassDeclaration(
             identifier: "Class",
             baseList: Syntax.BaseList(
                 Syntax.ParseName("Interface"),
                 Syntax.ParseName("Interface")
                 )
             ),
         p => p.LineBreaksAndWrapping.LineWrapping.WrapExtendsImplementsList = wrapStyle
         );
 }
        protected string GetStyleName(Object dataItem)
        {
            WrapStyle style = (WrapStyle)dataItem;

            if (style.Price > 0)
            {
                //NAME WITH PRICE
                decimal shopPrice = TaxHelper.GetShopPrice(style.Price, (style.TaxCode != null) ? style.TaxCode.Id : 0, null, this.ShipTaxAddress);
                return(string.Format(_CostFormat, style.Name, shopPrice.LSCurrencyFormat("ulc")));
            }
            else
            {
                //JUST NAME
                return(string.Format(_FreeFormat, style.Name));
            }
        }
        protected void WrapStylesGrid_RowEditing(object sender, GridViewEditEventArgs e)
        {
            int       wrapStyleId = (int)WrapStylesGrid.DataKeys[e.NewEditIndex].Value;
            WrapStyle style       = WrapStyleDataSource.Load(wrapStyleId);

            if (style != null)
            {
                AddPanel.Visible  = false;
                EditPanel.Visible = true;
                EditCaption.Text  = string.Format(EditCaption.Text, style.Name);
                EditWrapStyleDialog editDialog = EditPanel.FindControl("EditWrapStyleDialog1") as EditWrapStyleDialog;
                if (editDialog != null)
                {
                    editDialog.WrapStyleId = wrapStyleId;
                }
            }
        }
示例#12
0
        public static string WrapStyleToString(WrapStyle style)
        {
            switch (style)
            {
            case WrapStyle.SmartWrappingTopLineWidder:
                return("Smart");

            case WrapStyle.EndLineWordWrapping:
                return("");

            case WrapStyle.NoWordWrapping:
                return("");

            default:
                return("");
            }
        }
示例#13
0
        public static string cleanPath(this string path, WrapStyle wrap = WrapStyle.None)
        {
            switch (wrap)
            {
            case WrapStyle.None:
                return(cleanPathFromBackFolder(path));

            case WrapStyle.SingleQuotes:
                return("'" + cleanPathFromBackFolder(path) + "'");

            case WrapStyle.DoubleQuotes:
                return("\"" + cleanPathFromBackFolder(path) + "\"");

            default:
                throw new ArgumentOutOfRangeException(nameof(wrap), wrap, "wrap style exception");
            }
        }
示例#14
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            WrapStyle style = WrapStyleDataSource.Load(WrapStyleId);

            if (style != null)
            {
                Name.Text             = style.Name;
                ThumbnailUrl.Text     = style.ThumbnailUrl;
                ImageUrl.Text         = style.ImageUrl;
                Price.Text            = string.Format("{0:F2}", style.Price);
                TaxCode.SelectedIndex = -1;
                ListItem item = TaxCode.Items.FindByValue(style.TaxCodeId.ToString());
                if (item != null)
                {
                    item.Selected = true;
                }
            }
        }
        protected void WrapStyleRepeater_ItemCreated(Object sender, RepeaterItemEventArgs e)
        {
            WrapStyle style = (WrapStyle)e.Item.DataItem;

            if (!string.IsNullOrEmpty(style.ThumbnailUrl))
            {
                Image wrapStyleImage = (Image)e.Item.FindControl("WrapStyleImage");
                wrapStyleImage.Width  = new Unit(AbleContext.Current.Store.Settings.ThumbnailImageWidth);
                wrapStyleImage.Height = new Unit(AbleContext.Current.Store.Settings.ThumbnailImageHeight);

                HyperLink wrapStyleImageLink = (HyperLink)e.Item.FindControl("WrapStyleImageLink");
                if (!string.IsNullOrEmpty(style.ImageUrl))
                {
                    string popup = AbleCommerce.Code.PageHelper.GetPopUpScript(this.Page.ResolveUrl(style.ImageUrl), "giftwrapimage", 300, 300);
                    wrapStyleImageLink.Attributes.Add("onclick", popup);
                }
                wrapStyleImageLink.Attributes.Add("href", "#");
            }
        }
示例#16
0
        internal void WriteStatementSeparator(WrapStyle wrapStyle)
        {
            if (Configuration.Spaces.Other.BeforeForSemicolon)
            {
                WriteSpace();
            }

            WriteSyntax(Syntax.Semicolon);

            if (Configuration.Spaces.Other.AfterForSemicolon)
            {
                WriteSpace();
            }

            if (wrapStyle != WrapStyle.SimpleWrap)
            {
                Break(wrapStyle == WrapStyle.ChopAlways);
            }
        }
 protected void WrapStylesGrid_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "MoveUp")
     {
         IList <WrapStyle> wrapStyles = _WrapGroup.WrapStyles;
         int itemIndex = AlwaysConvert.ToInt(e.CommandArgument);
         if ((itemIndex < 1) || (itemIndex > wrapStyles.Count - 1))
         {
             return;
         }
         WrapStyle selectedItem = wrapStyles[itemIndex];
         WrapStyle swapItem     = wrapStyles[itemIndex - 1];
         wrapStyles.RemoveAt(itemIndex - 1);
         wrapStyles.Insert(itemIndex, swapItem);
         for (int i = 0; i < wrapStyles.Count; i++)
         {
             wrapStyles[i].OrderBy = (short)i;
         }
         wrapStyles.Save();
     }
     else if (e.CommandName == "MoveDown")
     {
         IList <WrapStyle> wrapStyles = _WrapGroup.WrapStyles;
         int itemIndex = AlwaysConvert.ToInt(e.CommandArgument);
         if ((itemIndex > wrapStyles.Count - 2) || (itemIndex < 0))
         {
             return;
         }
         WrapStyle selectedItem = wrapStyles[itemIndex];
         WrapStyle swapItem     = wrapStyles[itemIndex + 1];
         wrapStyles.RemoveAt(itemIndex + 1);
         wrapStyles.Insert(itemIndex, swapItem);
         for (int i = 0; i < wrapStyles.Count; i++)
         {
             wrapStyles[i].OrderBy = (short)i;
         }
         wrapStyles.Save();
     }
     WrapStylesGrid.DataBind();
 }
 public void WrapFormalParameters(WrapStyle wrapStyle, string expected)
 {
     Test(
         expected,
         Syntax.MethodDeclaration(
             Syntax.ParseName("void"),
             "Method",
             Syntax.ParameterList(
                 Syntax.Parameter(type: Syntax.ParseName("string"), identifier: "parameter"),
                 Syntax.Parameter(type: Syntax.ParseName("string"), identifier: "parameter"),
                 Syntax.Parameter(type: Syntax.ParseName("string"), identifier: "parameter"),
                 Syntax.Parameter(type: Syntax.ParseName("string"), identifier: "parameter")
                 ),
             Syntax.Block()
             ),
         p =>
     {
         p.LineBreaksAndWrapping.LineWrapping.WrapFormalParameters = wrapStyle;
         p.LineBreaksAndWrapping.LineWrapping.RightMargin          = 60;
     }
         );
 }
示例#19
0
        internal void WriteSyntax(Syntax syntax, WrapStyle wrapStyle)
        {
            bool writeSpace = false;

            if (syntax == Syntax.Dot)
            {
                writeSpace = Configuration.Spaces.Other.AroundDot;
            }

            if (writeSpace)
            {
                WriteSpace();
            }

            if (
                wrapStyle != WrapStyle.SimpleWrap &&
                !Configuration.LineBreaksAndWrapping.LineWrapping.PreferWrapAfterDotInMethodCalls
                )
            {
                Break(wrapStyle == WrapStyle.ChopAlways);
            }

            _writer.Write(FragmentType.Text, _syntaxes[syntax]);

            if (
                wrapStyle != WrapStyle.SimpleWrap &&
                Configuration.LineBreaksAndWrapping.LineWrapping.PreferWrapAfterDotInMethodCalls
                )
            {
                Break(wrapStyle == WrapStyle.ChopAlways);
            }

            if (writeSpace)
            {
                WriteSpace();
            }
        }
示例#20
0
        private void DoneEditing()
        {
            UpdatePanel stylesAjax = AbleCommerce.Code.PageHelper.RecursiveFindControl(this.Page, "WrapStylesAjax") as UpdatePanel;

            if (stylesAjax != null)
            {
                GridView stylesGrid = AbleCommerce.Code.PageHelper.RecursiveFindControl(stylesAjax, "WrapStylesGrid") as GridView;
                if (stylesGrid != null)
                {
                    stylesGrid.EditIndex = -1;
                    stylesGrid.DataBind();
                }
                Panel addPanel = AbleCommerce.Code.PageHelper.RecursiveFindControl(stylesAjax, "AddPanel") as Panel;
                if (addPanel != null)
                {
                    addPanel.Visible = true;
                }
                Panel editPanel = AbleCommerce.Code.PageHelper.RecursiveFindControl(stylesAjax, "EditPanel") as Panel;
                if (editPanel != null)
                {
                    editPanel.Visible = false;
                }
                Notification savedMessage = AbleCommerce.Code.PageHelper.RecursiveFindControl(stylesAjax, "SavedWrapStyleMessage") as Notification;
                if (savedMessage != null)
                {
                    savedMessage.Visible = false;
                    string    name  = string.Empty;
                    WrapStyle style = WrapStyleDataSource.Load(WrapStyleId);
                    if (style != null)
                    {
                        name = style.Name;
                    }
                    savedMessage.Text = string.Format(savedMessage.Text, name);
                }
            }
        }
 public void WrapObjectAndCollectionInitializers(WrapStyle wrapStyle, string expected)
 {
     Test(
         expected,
         Syntax.Block(
             Syntax.LocalDeclarationStatement(
                 Syntax.VariableDeclaration(
                     Syntax.ParseName("var"),
                     new[]
     {
         Syntax.VariableDeclarator(
             "i",
             null,
             Syntax.EqualsValueClause(
                 Syntax.ArrayCreationExpression(
                     (ArrayTypeSyntax)Syntax.ParseName("int[]"),
                     Syntax.InitializerExpression(
                         Syntax.LiteralExpression(1),
                         Syntax.LiteralExpression(2)
                         )
                     )
                 )
             )
     }
                     )
                 ),
             Syntax.LocalDeclarationStatement(
                 Syntax.VariableDeclaration(
                     Syntax.ParseName("var"),
                     new[]
     {
         Syntax.VariableDeclarator(
             "i",
             null,
             Syntax.EqualsValueClause(
                 Syntax.ImplicitArrayCreationExpression(
                     0,
                     Syntax.InitializerExpression(
                         Syntax.LiteralExpression(1),
                         Syntax.LiteralExpression(2)
                         )
                     )
                 )
             )
     }
                     )
                 ),
             Syntax.LocalDeclarationStatement(
                 Syntax.VariableDeclaration(
                     Syntax.ParseName("var"),
                     new[]
     {
         Syntax.VariableDeclarator(
             "i",
             initializer: Syntax.EqualsValueClause(
                 Syntax.ObjectCreationExpression(
                     Syntax.ParseName("Class"),
                     initializer: Syntax.InitializerExpression(
                         Syntax.BinaryExpression(
                             BinaryOperator.Equals,
                             Syntax.ParseName("Name"),
                             Syntax.LiteralExpression(1)
                             ),
                         Syntax.BinaryExpression(
                             BinaryOperator.Equals,
                             Syntax.ParseName("Name"),
                             Syntax.LiteralExpression(1)
                             )
                         )
                     )
                 )
             )
     }
                     )
                 ),
             Syntax.LocalDeclarationStatement(
                 Syntax.VariableDeclaration(
                     Syntax.ParseName("var"),
                     new[]
     {
         Syntax.VariableDeclarator(
             "i",
             initializer: Syntax.EqualsValueClause(
                 Syntax.AnonymousObjectCreationExpression(
                     Syntax.AnonymousObjectMemberDeclarator(
                         Syntax.NameEquals("Name"),
                         Syntax.LiteralExpression(1)
                         ),
                     Syntax.AnonymousObjectMemberDeclarator(
                         Syntax.NameEquals("Name"),
                         Syntax.LiteralExpression(1)
                         )
                     )
                 )
             )
     }
                     )
                 )
             ),
         p => p.LineBreaksAndWrapping.LineWrapping.WrapObjectAndCollectionInitializers = wrapStyle
         );
 }
 public void WrapObjectAndCollectionInitializers(WrapStyle wrapStyle, string expected)
 {
     Test(
         expected,
         Syntax.Block(
             Syntax.LocalDeclarationStatement(
                 Syntax.VariableDeclaration(
                     Syntax.ParseName("var"),
                     new[]
                     {
                         Syntax.VariableDeclarator(
                             "i",
                             null,
                             Syntax.EqualsValueClause(
                                 Syntax.ArrayCreationExpression(
                                     (ArrayTypeSyntax)Syntax.ParseName("int[]"),
                                     Syntax.InitializerExpression(
                                         Syntax.LiteralExpression(1),
                                         Syntax.LiteralExpression(2)
                                     )
                                 )
                             )
                         )
                     }
                 )
             ),
             Syntax.LocalDeclarationStatement(
                 Syntax.VariableDeclaration(
                     Syntax.ParseName("var"),
                     new[]
                     {
                         Syntax.VariableDeclarator(
                             "i",
                             null,
                             Syntax.EqualsValueClause(
                                 Syntax.ImplicitArrayCreationExpression(
                                     0,
                                     Syntax.InitializerExpression(
                                         Syntax.LiteralExpression(1),
                                         Syntax.LiteralExpression(2)
                                     )
                                 )
                             )
                         )
                     }
                 )
             ),
             Syntax.LocalDeclarationStatement(
                 Syntax.VariableDeclaration(
                     Syntax.ParseName("var"),
                     new[]
                     {
                         Syntax.VariableDeclarator(
                             "i",
                             initializer: Syntax.EqualsValueClause(
                                 Syntax.ObjectCreationExpression(
                                     Syntax.ParseName("Class"),
                                     initializer: Syntax.InitializerExpression(
                                         Syntax.BinaryExpression(
                                             BinaryOperator.Equals,
                                             Syntax.ParseName("Name"),
                                             Syntax.LiteralExpression(1)
                                         ),
                                         Syntax.BinaryExpression(
                                             BinaryOperator.Equals,
                                             Syntax.ParseName("Name"),
                                             Syntax.LiteralExpression(1)
                                         )
                                     )
                                 )
                             )
                         )
                     }
                 )
             ),
             Syntax.LocalDeclarationStatement(
                 Syntax.VariableDeclaration(
                     Syntax.ParseName("var"),
                     new[]
                     {
                         Syntax.VariableDeclarator(
                             "i",
                             initializer: Syntax.EqualsValueClause(
                                 Syntax.AnonymousObjectCreationExpression(
                                     Syntax.AnonymousObjectMemberDeclarator(
                                         Syntax.NameEquals("Name"),
                                         Syntax.LiteralExpression(1)
                                     ),
                                     Syntax.AnonymousObjectMemberDeclarator(
                                         Syntax.NameEquals("Name"),
                                         Syntax.LiteralExpression(1)
                                     )
                                 )
                             )
                         )
                     }
                 )
             )
         ),
         p => p.LineBreaksAndWrapping.LineWrapping.WrapObjectAndCollectionInitializers = wrapStyle
     );
 }
示例#23
0
        internal void WriteSyntax(Syntax syntax, WrapStyle wrapStyle)
        {
            bool writeSpace = false;

            if (syntax == Syntax.Dot)
                writeSpace = Configuration.Spaces.Other.AroundDot;

            if (writeSpace)
                WriteSpace();

            if (
                wrapStyle != WrapStyle.SimpleWrap &&
                !Configuration.LineBreaksAndWrapping.LineWrapping.PreferWrapAfterDotInMethodCalls
            )
                Break(wrapStyle == WrapStyle.ChopAlways);

            _writer.Write(FragmentType.Text, _syntaxes[syntax]);

            if (
                wrapStyle != WrapStyle.SimpleWrap &&
                Configuration.LineBreaksAndWrapping.LineWrapping.PreferWrapAfterDotInMethodCalls
            )
                Break(wrapStyle == WrapStyle.ChopAlways);

            if (writeSpace)
                WriteSpace();
        }
示例#24
0
 internal void PushWrapStyle(WrapStyle wrapStyle)
 {
     _wrapStyle.Push(wrapStyle);
 }
示例#25
0
 internal void PushWrapStyle(WrapStyle wrapStyle)
 {
     _wrapStyle.Push(wrapStyle);
 }
 public void WrapFormalParameters(WrapStyle wrapStyle, string expected)
 {
     Test(
         expected,
         Syntax.MethodDeclaration(
             Syntax.ParseName("void"),
             "Method",
             Syntax.ParameterList(
                 Syntax.Parameter(type: Syntax.ParseName("string"), identifier: "parameter"),
                 Syntax.Parameter(type: Syntax.ParseName("string"), identifier: "parameter"),
                 Syntax.Parameter(type: Syntax.ParseName("string"), identifier: "parameter"),
                 Syntax.Parameter(type: Syntax.ParseName("string"), identifier: "parameter")
             ),
             Syntax.Block()
         ),
         p =>
         {
             p.LineBreaksAndWrapping.LineWrapping.WrapFormalParameters = wrapStyle;
             p.LineBreaksAndWrapping.LineWrapping.RightMargin = 60;
         }
     );
 }
 public void WrapForStatementHeader(WrapStyle wrapStyle, string expected)
 {
     Test(
         expected,
         Syntax.ForStatement(
             initializers: new[] { Syntax.LiteralExpression(1) },
             condition: Syntax.LiteralExpression(1),
             incrementors: new[] { Syntax.LiteralExpression(1) },
             statement: Syntax.Block()
         ),
         p => p.LineBreaksAndWrapping.LineWrapping.WrapForStatementHeader = wrapStyle
     );
 }
        protected bool HasThumbnail(Object dataItem)
        {
            WrapStyle style = (WrapStyle)dataItem;

            return(!string.IsNullOrEmpty(style.ThumbnailUrl));
        }
 public void WrapInvocationArguments(WrapStyle wrapStyle, string expected)
 {
     Test(
         expected,
         Syntax.ExpressionStatement(
             Syntax.InvocationExpression(
                 Syntax.ParseName("Method"),
                 Syntax.ArgumentList(
                     Syntax.Argument(Syntax.LiteralExpression("parameter")),
                     Syntax.Argument(
                         Syntax.BinaryExpression(
                             BinaryOperator.Plus,
                             Syntax.LiteralExpression("parameter"),
                             Syntax.LiteralExpression("parameter")
                         )
                     ),
                     Syntax.Argument(Syntax.LiteralExpression("parameter")),
                     Syntax.Argument(Syntax.LiteralExpression("parameter"))
                 )
             )
         ),
         p =>
         {
             p.LineBreaksAndWrapping.LineWrapping.WrapInvocationArguments = wrapStyle;
             p.LineBreaksAndWrapping.LineWrapping.RightMargin = 40;
         }
     );
 }
 public void WrapMultipleDeclarations(WrapStyle wrapStyle, string expected)
 {
     Test(
         expected,
         Syntax.LocalDeclarationStatement(
             Syntax.VariableDeclaration(
                 Syntax.ParseName("var"),
                 new[]
                 {
                     Syntax.VariableDeclarator(
                         "i",
                         null,
                         Syntax.EqualsValueClause(Syntax.LiteralExpression(0))
                     ),
                     Syntax.VariableDeclarator(
                         "j",
                         null,
                         Syntax.EqualsValueClause(Syntax.LiteralExpression(0))
                     )
                 }
             )
         ),
         p => p.LineBreaksAndWrapping.LineWrapping.WrapMultipleDeclarations = wrapStyle
     );
 }
 public void WrapTernaryExpression(WrapStyle wrapStyle, string expected)
 {
     Test(
         expected,
         Syntax.ConditionalExpression(
             Syntax.LiteralExpression(1),
             Syntax.LiteralExpression(1),
             Syntax.LiteralExpression(1)
         ),
         p => p.LineBreaksAndWrapping.LineWrapping.WrapTernaryExpression = wrapStyle
     );
 }
 public void WrapExtendsImplementsList(WrapStyle wrapStyle, string expected)
 {
     Test(
         expected,
         Syntax.ClassDeclaration(
             identifier: "Class",
             baseList: Syntax.BaseList(
                 Syntax.ParseName("Interface"),
                 Syntax.ParseName("Interface")
             )
         ),
         p => p.LineBreaksAndWrapping.LineWrapping.WrapExtendsImplementsList = wrapStyle
     );
 }
 public void WrapChainedMethodCalls(WrapStyle wrapStyle, bool afterDot, string expected)
 {
     Test(
         expected,
         Syntax.ExpressionStatement(
             Syntax.InvocationExpression(
                 Syntax.MemberAccessExpression(
                     Syntax.InvocationExpression(
                         Syntax.MemberAccessExpression(
                             Syntax.InvocationExpression(
                                 Syntax.MemberAccessExpression(
                                     Syntax.InvocationExpression(
                                         Syntax.MemberAccessExpression(
                                             Syntax.InvocationExpression(
                                                 Syntax.MemberAccessExpression(
                                                     Syntax.InvocationExpression(
                                                         Syntax.MemberAccessExpression(
                                                             Syntax.InvocationExpression(
                                                                 Syntax.MemberAccessExpression(
                                                                     Syntax.InvocationExpression(
                                                                         Syntax.ParseName("Method"),
                                                                         Syntax.ArgumentList()
                                                                     ),
                                                                     (SimpleNameSyntax)Syntax.ParseName("Method")
                                                                 ),
                                                                 Syntax.ArgumentList()
                                                             ),
                                                             (SimpleNameSyntax)Syntax.ParseName("Method")
                                                         ),
                                                         Syntax.ArgumentList()
                                                     ),
                                                     (SimpleNameSyntax)Syntax.ParseName("Method")
                                                 ),
                                                 Syntax.ArgumentList()
                                             ),
                                             (SimpleNameSyntax)Syntax.ParseName("Method")
                                         ),
                                         Syntax.ArgumentList()
                                     ),
                                     (SimpleNameSyntax)Syntax.ParseName("Method")
                                 ),
                                 Syntax.ArgumentList()
                             ),
                             (SimpleNameSyntax)Syntax.ParseName("Method")
                         ),
                         Syntax.ArgumentList()
                     ),
                     (SimpleNameSyntax)Syntax.ParseName("Method")
                 ),
                 Syntax.ArgumentList()
             )
         ),
         p =>
         {
             p.LineBreaksAndWrapping.LineWrapping.WrapChainedMethodCalls = wrapStyle;
             p.LineBreaksAndWrapping.LineWrapping.PreferWrapAfterDotInMethodCalls = afterDot;
             p.LineBreaksAndWrapping.LineWrapping.RightMargin = 40;
         }
     );
 }
        protected void BuildWrapStyleList()
        {
            StoreSettingsManager settings = AbleContext.Current.Store.Settings;
            int thumbnailHeight           = settings.ThumbnailImageHeight;
            int thumbnailWidth            = settings.ThumbnailImageWidth;

            if (phWrapStyle != null)
            {
                StringBuilder table       = new StringBuilder();
                string        selected    = (_WrapStyleId == 0) ? " checked" : string.Empty;
                string        radioButton = string.Format("<input type=\"radio\" name=\"{0}_Wrap{1}\" value=\"{2}\"{3}>&nbsp;", this.UniqueID, this.BasketItemId, 0, selected);
                table.Append("<br /><div class='wrapStyle' style=\"padding:2px 4px;\">");
                table.Append("<table cellpadding='0' cellspacing='0'>");
                table.Append("<tr>");
                table.Append("<td>");
                table.Append(radioButton + "None");
                table.Append("</td>");
                table.Append("</tr>");
                table.Append("</table></div>");

                //GET WRAP STYLE
                for (int i = 0; i < _wrapStyles.Count; i++)
                {
                    WrapStyle style = _wrapStyles[i];
                    table.Append("<div class='wrapStyle' style=\"padding:2px 4px;\">");
                    //ADD RADIO BUTTON
                    selected    = (_WrapStyleId == style.Id) ? " checked" : string.Empty;
                    radioButton = string.Format("<input type=\"radio\" name=\"{0}_Wrap{1}\" value=\"{2}\"{3}>&nbsp;", this.UniqueID, this.BasketItemId, style.Id, selected);
                    table.Append("<table cellpadding='0' cellspacing='0'>");
                    table.Append("<tr>");
                    table.Append("<td>");
                    table.Append(radioButton);
                    //ADD NAME
                    if (style.Price > 0)
                    {
                        //NAME WITH PRICE
                        table.Append(string.Format("<span>{0}({1})</span>", style.Name, style.Price.LSCurrencyFormat("ulc")));
                    }
                    else
                    {
                        //JUST NAME
                        table.Append(string.Format("<span>{0}</span>", style.Name));
                    }
                    table.Append("</td>");
                    if (!string.IsNullOrEmpty(style.ThumbnailUrl))
                    {
                        table.Append("<td>");
                        //ADD CLICKABLE IMAGE
                        string thumbnailUrl = string.IsNullOrEmpty(style.ThumbnailUrl) ? "" : style.ThumbnailUrl;
                        string image        = string.Format("<img src=\"{0}\" border=\"0\" vspace=\"2\" height=\"" + thumbnailHeight + "\" width=\"" + thumbnailWidth + "\" alt=\"" + Server.HtmlEncode(style.Name) + "\" />", this.Page.ResolveUrl(thumbnailUrl));
                        if (!string.IsNullOrEmpty(style.ImageUrl))
                        {
                            //CLICKABLE THUMBNAIL
                            string link  = "<a href=\"#\" onclick=\"{0}\">{1}</a>";
                            string popup = PageHelper.GetPopUpScript(this.Page.ResolveUrl(style.ImageUrl), "giftwrapimage", 300, 300);
                            table.Append(string.Format(link, popup, image));
                        }
                        else
                        {
                            //STATIC THUMBNAIL ONLY
                            table.Append(image);
                        }
                        table.Append("</td>");
                    }
                    table.Append("</tr>");
                    table.Append("</table>");
                    table.Append("</div>");
                }
                phWrapStyle.Controls.Add(new LiteralControl(table.ToString()));
            }
        }
示例#35
0
 public MezImage WrapFormatStyle(WrapStyle style)
 {
     Image.WrapFormat.Style = style;
     return(this);
 }
示例#36
0
        internal void WriteStatementSeparator(WrapStyle wrapStyle)
        {
            if (Configuration.Spaces.Other.BeforeForSemicolon)
                WriteSpace();

            WriteSyntax(Syntax.Semicolon);

            if (Configuration.Spaces.Other.AfterForSemicolon)
                WriteSpace();

            if (wrapStyle != WrapStyle.SimpleWrap)
                Break(wrapStyle == WrapStyle.ChopAlways);
        }
 public void WrapMultipleTypeParameterConstraints(WrapStyle wrapStyle, bool sameLine, string expected)
 {
     Test(
         expected,
         Syntax.ClassDeclaration(
             identifier: "Class",
             constraintClauses: new[]
     {
         Syntax.TypeParameterConstraintClause(
             (IdentifierNameSyntax)Syntax.ParseName("T"),
             new[] { Syntax.ClassOrStructConstraint() }
             ),
         Syntax.TypeParameterConstraintClause(
             (IdentifierNameSyntax)Syntax.ParseName("T"),
             new[] { Syntax.ClassOrStructConstraint() }
             )
     },
             members: new MemberDeclarationSyntax[]
     {
         Syntax.MethodDeclaration(
             returnType: Syntax.ParseName("void"),
             identifier: "Method",
             parameterList: Syntax.ParameterList(),
             body: Syntax.Block(),
             constraintClauses: new[]
         {
             Syntax.TypeParameterConstraintClause(
                 (IdentifierNameSyntax)Syntax.ParseName("T"),
                 new[] { Syntax.ClassOrStructConstraint() }
                 ),
             Syntax.TypeParameterConstraintClause(
                 (IdentifierNameSyntax)Syntax.ParseName("T"),
                 new[] { Syntax.ClassOrStructConstraint() }
                 )
         }
             ),
         Syntax.DelegateDeclaration(
             returnType: Syntax.ParseName("void"),
             identifier: "Delegate",
             parameterList: Syntax.ParameterList(),
             constraintClauses: new[]
         {
             Syntax.TypeParameterConstraintClause(
                 (IdentifierNameSyntax)Syntax.ParseName("T"),
                 new[] { Syntax.ClassOrStructConstraint() }
                 ),
             Syntax.TypeParameterConstraintClause(
                 (IdentifierNameSyntax)Syntax.ParseName("T"),
                 new[] { Syntax.ClassOrStructConstraint() }
                 )
         }
             )
     }
             ),
         p =>
     {
         p.LineBreaksAndWrapping.LineWrapping.WrapMultipleTypeParameterConstraints = wrapStyle;
         p.LineBreaksAndWrapping.Other.PlaceTypeConstraintsOnSameLine = sameLine;
     }
         );
 }
示例#38
0
 public static void DefineImage(Section section, string strPath, Unit strWidth, ShapePosition shapePosition, WrapStyle wrapStyle)
 {
     Image image = section.AddImage(strPath);
     image.Width = strWidth;
     image.Left = shapePosition;
     image.WrapFormat.Style = wrapStyle;
 }
 public void WrapMultipleTypeParameterConstraints(WrapStyle wrapStyle, bool sameLine, string expected)
 {
     Test(
         expected,
         Syntax.ClassDeclaration(
             identifier: "Class",
             constraintClauses: new[]
             {
                 Syntax.TypeParameterConstraintClause(
                     (IdentifierNameSyntax)Syntax.ParseName("T"),
                     new[] { Syntax.ClassOrStructConstraint() }
                 ),
                 Syntax.TypeParameterConstraintClause(
                     (IdentifierNameSyntax)Syntax.ParseName("T"),
                     new[] { Syntax.ClassOrStructConstraint() }
                 )
             },
             members: new MemberDeclarationSyntax[]
             {
                 Syntax.MethodDeclaration(
                     returnType: Syntax.ParseName("void"),
                     identifier: "Method",
                     parameterList: Syntax.ParameterList(),
                     body: Syntax.Block(),
                     constraintClauses: new[]
                     {
                         Syntax.TypeParameterConstraintClause(
                             (IdentifierNameSyntax)Syntax.ParseName("T"),
                             new[] { Syntax.ClassOrStructConstraint() }
                         ),
                         Syntax.TypeParameterConstraintClause(
                             (IdentifierNameSyntax)Syntax.ParseName("T"),
                             new[] { Syntax.ClassOrStructConstraint() }
                         )
                     }
                 ),
                 Syntax.DelegateDeclaration(
                     returnType: Syntax.ParseName("void"),
                     identifier: "Delegate",
                     parameterList: Syntax.ParameterList(),
                     constraintClauses: new[]
                     {
                         Syntax.TypeParameterConstraintClause(
                             (IdentifierNameSyntax)Syntax.ParseName("T"),
                             new[] { Syntax.ClassOrStructConstraint() }
                         ),
                         Syntax.TypeParameterConstraintClause(
                             (IdentifierNameSyntax)Syntax.ParseName("T"),
                             new[] { Syntax.ClassOrStructConstraint() }
                         )
                     }
                 )
             }
         ),
         p =>
         {
             p.LineBreaksAndWrapping.LineWrapping.WrapMultipleTypeParameterConstraints = wrapStyle;
             p.LineBreaksAndWrapping.Other.PlaceTypeConstraintsOnSameLine = sameLine;
         }
     );
 }