Exemplo n.º 1
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void init(string[] func_list)
        {
            for (int i = 0; i < func_list.Length; i++)
            {
                // 分割线
                Image img = new Image();
                BitmapImage bi = new BitmapImage();
                bi.BeginInit();
                bi.UriSource = new Uri(AppConfig.IconPath, UriKind.Relative);
                bi.EndInit();
                img.Margin = new Thickness(5, (i + 1) * 72 - 20, 0, 0);
                img.Width = 150;
                img.Height = 10;
                img.HorizontalAlignment = HorizontalAlignment.Left;
                img.VerticalAlignment = VerticalAlignment.Top;
                img.Source = bi;

                // 按钮
                MainNavButton mnb = new MainNavButton();
                mnb.Tag = func_list[i];
                mnb.id = i;
                mnb.init();
                mnb.HorizontalAlignment = HorizontalAlignment.Left;
                mnb.VerticalAlignment = VerticalAlignment.Top;
                mnb.Margin = new Thickness(0, (i + 1) * 72 - 20 + 3, 0, 0);
                if (i == 0)
                {
                    mnb.change_state();
                }
                mnbs.Add(mnb);
                this.main.Children.Add(img);
                this.main.Children.Add(mnb);
            }

        }
Exemplo n.º 2
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void init(string[] func_list)
        {
            for (int i = 0; i < func_list.Length; i++)
            {
                // 分割线
                Image       img = new Image();
                BitmapImage bi  = new BitmapImage();
                bi.BeginInit();
                bi.UriSource = new Uri(AppConfig.IconPath, UriKind.Relative);
                bi.EndInit();
                img.Margin = new Thickness(5, (i + 1) * 72 - 20, 0, 0);
                img.Width  = 150;
                img.Height = 10;
                img.HorizontalAlignment = HorizontalAlignment.Left;
                img.VerticalAlignment   = VerticalAlignment.Top;
                img.Source = bi;

                // 按钮
                MainNavButton mnb = new MainNavButton();
                mnb.Tag = func_list[i];
                mnb.id  = i;
                mnb.init();
                mnb.HorizontalAlignment = HorizontalAlignment.Left;
                mnb.VerticalAlignment   = VerticalAlignment.Top;
                mnb.Margin = new Thickness(0, (i + 1) * 72 - 20 + 3, 0, 0);
                if (i == 0)
                {
                    mnb.change_state();
                }
                mnbs.Add(mnb);
                this.main.Children.Add(img);
                this.main.Children.Add(mnb);
            }
        }
 /// <summary>
 /// 点击事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Grid_MouseUp_1(object sender, MouseButtonEventArgs e)
 {
     if (!check)
     {
         check = true;
         change_state();
         checked_button.check = false;
         checked_button.change_state();
         checked_button = this;
     }
 }
        /// <summary>
        /// 初始化
        /// </summary>
        public void init()
        {
            // 默认第一个为选择对象
            if (id == 0)
            {
                checked_button = this;
                check          = true;
            }

            string[] content = this.Tag.ToString().Split(',');

            n_icon.BeginInit();
            n_icon.UriSource = new Uri(AppConfig.IconPath + content[0] + ".png", UriKind.Relative);
            n_icon.EndInit();

            s_icon.BeginInit();
            s_icon.UriSource = new Uri(AppConfig.IconPath + content[1] + ".png", UriKind.Relative);
            s_icon.EndInit();

            this.content.Content = content[2];
            change_state();
        }
Exemplo n.º 5
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void init()
        {
            // 默认第一个为选择对象
            if (id == 0)
            {
                checked_button = this;
                check = true;
            }

            string[] content = this.Tag.ToString().Split(',');

            n_icon.BeginInit();
            n_icon.UriSource = new Uri(AppConfig.IconPath + content[0] + ".png", UriKind.Relative);
            n_icon.EndInit();

            s_icon.BeginInit();
            s_icon.UriSource = new Uri(AppConfig.IconPath + content[1] + ".png", UriKind.Relative);
            s_icon.EndInit();

            this.content.Content = content[2];
            change_state();
        }
Exemplo n.º 6
0
 /// <summary>
 /// 点击事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Grid_MouseUp_1(object sender, MouseButtonEventArgs e)
 {
     if (!check)
     {
         check = true;
         change_state();
         checked_button.check = false;
         checked_button.change_state();
         checked_button = this;
     }
 }