Пример #1
0
		private void setLayout()
		{
		//	setPosition(button, 0, 0, WIDTH, HEIGHT);
			button.Padding = new Thickness(0, 0, 0, 0);
			setPosition(canvas, 0, 0, WIDTH, HEIGHT);
			button.HorizontalAlignment = HorizontalAlignment.Left;

			mName = new Label();
			setPosition(mName, NAME_X, NAME_Y, NAME_W, NAME_H);
			mName.FontSize = 14;
			mName.Foreground = MetrialColor.getBrush(MetrialColor.Name.Grey, 8);
			mName.Content = mItem.getName();
			mName.VerticalContentAlignment = VerticalAlignment.Center;
			mName.HorizontalContentAlignment = HorizontalAlignment.Left;
			canvas.Children.Add(mName);

			mCategory = new Label();
			setPosition(mCategory, CATEGORY_X, CATEGORY_Y, CATEGORY_W, CATEGORY_H);
			mCategory.FontSize = 14;
			mCategory.Foreground = MetrialColor.getBrush(MetrialColor.Name.Grey, 8);

			List<wsr_pos.Category> category_list = DBManager.getInstance().getCategoryList();

			foreach(wsr_pos.Category category in category_list)
			{
				if(category.getId() == mItem.getCategoryId())
				{
					mCategory.Content = category.getName();
				}
			}

			mCategory.HorizontalContentAlignment = HorizontalAlignment.Center;
			mCategory.VerticalContentAlignment = VerticalAlignment.Center;
			canvas.Children.Add(mCategory);

			mComment = new Label();
			setPosition(mComment, COMMENT_X, COMMENT_Y, COMMENT_W, COMMENT_H);
			mComment.FontSize = 14;
			mComment.Foreground = MetrialColor.getBrush(MetrialColor.Name.Grey, 8);
			mComment.Content = mItem.getComment();
			mComment.HorizontalContentAlignment = HorizontalAlignment.Center;
			mComment.VerticalContentAlignment = VerticalAlignment.Center;
			canvas.Children.Add(mComment);

			mPrice = new Label();
			setPosition(mPrice, PRICE_X, PRICE_Y, PRICE_W, PRICE_H);
			mPrice.FontSize = 16;
			mPrice.Foreground = MetrialColor.getBrush(MetrialColor.Name.Grey, 8);
			mPrice.Content = string.Format("{0:N0}", mItem.getPrice());
			mPrice.VerticalContentAlignment = VerticalAlignment.Center;
			mPrice.HorizontalContentAlignment = HorizontalAlignment.Right;
			canvas.Children.Add(mPrice);

			mDiscount = new Label();
			setPosition(mDiscount, DISCOUNT_X, DISCOUNT_Y, DISCOUNT_W, DISCOUNT_H);
			mDiscount.FontSize = 16;
			mDiscount.Foreground = MetrialColor.getBrush(MetrialColor.Name.Grey, 8);
			mDiscount.Content = (mItem.getDiscount() ? "O" : "X");
			mDiscount.HorizontalContentAlignment = HorizontalAlignment.Center;
			mDiscount.VerticalContentAlignment = VerticalAlignment.Center;
			canvas.Children.Add(mDiscount);

			mPrintTogether = new Label();
			setPosition(mPrintTogether, PRINT_TOGETHER_X, PRINT_TOGETHER_Y, PRINT_TOGETHER_W, PRINT_TOGETHER_H);
			mPrintTogether.FontSize = 16;
			mPrintTogether.Foreground = MetrialColor.getBrush(MetrialColor.Name.Grey, 8);
			mPrintTogether.Content = (mItem.getPrintTogether() ? "O" : "X");
			mPrintTogether.HorizontalContentAlignment = HorizontalAlignment.Center;
			mPrintTogether.VerticalContentAlignment = VerticalAlignment.Center;
			canvas.Children.Add(mPrintTogether);

			mPrintDot = new Label();
			setPosition(mPrintDot, PRINT_DOT_X, PRINT_DOT_Y, PRINT_DOT_W, PRINT_DOT_H);
			mPrintDot.FontSize = 16;
			mPrintDot.Foreground = MetrialColor.getBrush(MetrialColor.Name.Grey, 8);
			mPrintDot.Content = (mItem.getPrintDot() ? "O" : "X");
			mPrintDot.HorizontalContentAlignment = HorizontalAlignment.Center;
			mPrintDot.VerticalContentAlignment = VerticalAlignment.Center;
			canvas.Children.Add(mPrintDot);

			mDelete = new RectButton(DELETE_W, DELETE_H);
			setPosition(mDelete, DELETE_X, DELETE_Y, DELETE_W, DELETE_H);
			mDelete.setBackgroundImage("delete.png", "delete.png");
			canvas.Children.Add(mDelete);

			mLine = new Canvas();
			setPosition(mLine, LINE_X, LINE_Y, LINE_W, LINE_H);
			mLine.Background = MetrialColor.getBrush(MetrialColor.Name.Grey, 4);
			canvas.Children.Add(mLine);
		}