Exemplo n.º 1
0
 public void bt_Click(object sender, RoutedEventArgs e)
 {
     //MessageBox.Show("bt_Click " + CurrentLvl.ToString() + " " + currentIndex.ToString());
     if (this.Parent == null)
     {
         BookLoader.Instance().OnClickedTile(CurrentLvl, -1, currentIndex);
     }
     else
     {
         BookLoader.Instance().OnClickedTile(CurrentLvl, this.Parent.currentIndex, currentIndex);
     }
 }
Exemplo n.º 2
0
 public void bt_Click(object sender, RoutedEventArgs e)
 {
     BookLoader.Instance().OnClickToArticle(ArticleID);
 }
Exemplo n.º 3
0
 public void bt_Click_LoadNewArticle(object sender, RoutedEventArgs e)
 {
     BookLoader.Instance().OnClickToArticle((sender as Button).Tag.ToString());
 }
Exemplo n.º 4
0
 public void bt_Click(object sender, RoutedEventArgs e)
 {
     //BookLoader.Instance().OnClickToArticle(ArticleID);
     //goi 1 ham ben masterpage
     BookLoader.Instance().OnClickedImage(_img);
 }
Exemplo n.º 5
0
        public virtual UIElement generatePage()
        {
            string xamlColumns = string.Empty;

            for (int i = 0; i < NGridColumns; i++)
            {
                xamlColumns += "<ColumnDefinition Width='*'></ColumnDefinition>\r\n";
            }

            string xamlRows = string.Empty;

            for (int i = 0; i < NGridRows; i++)
            {
                xamlRows += "<RowDefinition Height='*'></RowDefinition>\r\n";
            }

            //<!--<ImageBrush AlignmentX='Left' AlignmentY='Top' Stretch='None' ImageSource='/PageFlip;component/Images/Demo1/lifestyle_01_01.jpg'></ImageBrush>-->
            //<SolidColorBrush Color='Orange'></SolidColorBrush>
            string strBackgroundColor;

            if (this.ImageBrush != string.Empty)
            {
                strBackgroundColor = "<ImageBrush AlignmentX='Left' AlignmentY='Top' Stretch='None' ImageSource='"
                                     + this.ImageBrush + "'></ImageBrush>";
            }
            else
            {
                if (this.currentIndex % 2 == 0)
                {
                    strBackgroundColor = "<SolidColorBrush Color='White'></SolidColorBrush>";
                }
                else
                {
                    strBackgroundColor = "<SolidColorBrush Color='White'></SolidColorBrush>";
                }
            }

            string xaml = string.Format(@"
<Grid
    xmlns='http://schemas.microsoft.com/client/2007'
    xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
>
            <Grid.Background>
                {3}
            </Grid.Background>

<Grid.ColumnDefinitions>
    <ColumnDefinition Width='*'></ColumnDefinition>
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
    <RowDefinition Height='*'></RowDefinition>
</Grid.RowDefinitions>

    <Grid ShowGridLines='False' Margin='{2}'>
            <Grid.ColumnDefinitions>
                {0}
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                {1}
            </Grid.RowDefinitions>
    </Grid>
</Grid>
", xamlColumns, xamlRows, this.Margin, strBackgroundColor);

            int  iCounter = 0;
            Grid grdRoot  = (Grid)Ultis.LoadXamlFromString(xaml);
            Grid grd      = (Grid)grdRoot.Children[0];

            //load item
            foreach (Tile item in ListSubMenu)
            {
                grd.Children.Add(item.generate());
                iCounter++;
            }

            //add stack-back button
            if (this.currentIndex % 2 == 0)
            {
                List <string> listBackImg = BookLoader.Instance().listMenuBackImageSource;
                //string strlistMenuBackImageSource = string.Empty;
                //foreach (string item in listBackImg)
                //{
                //    strlistMenuBackImageSource += item;
                //}
                //MessageBox.Show(strlistMenuBackImageSource + " " + listBackImg);

                //dang o dung cap cua no, nen chi can lay n-1 cap truoc no la dc
                if (listBackImg.Count >= 1)
                {
                    StackPanel StPnl = new StackPanel();
                    StPnl.Orientation         = Orientation.Horizontal;
                    StPnl.VerticalAlignment   = VerticalAlignment.Top;
                    StPnl.HorizontalAlignment = HorizontalAlignment.Left;

                    for (int i = 0; i < listBackImg.Count; i++)
                    {
                        string xamlBt = @"
<Button 
xmlns='http://schemas.microsoft.com/client/2007'
xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
>
            <Image Source='{0}' Stretch='None'></Image>
        </Button>
";
                        xamlBt = string.Format(xamlBt, listBackImg[i]);
                        Button bt = (Button)Ultis.LoadXamlFromString(xamlBt);
                        bt.Click += new RoutedEventHandler(bt_Click);
                        bt.Style  = App.Current.Resources["customButtonNoStyle"] as Style;
                        StPnl.Children.Add(bt);
                    }
                    grdRoot.Children.Add(StPnl);
                }
            }

            if (iCounter > 0)
            {
                return(grdRoot);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 6
0
 void bt_Click(object sender, RoutedEventArgs e)
 {
     BookLoader.Instance().OnBack();
 }