讨巧的方法将Dictionary转成多维数组

63 篇文章 0 订阅
/// <summary>
		/// Gets the tab bar controller string.
		/// </summary>
		/// <returns>The tab bar controller string.</returns>
		public static string[,] GetTabBarControllerStr()
		{
			string[,] nemulist;
			Dictionary<string,string> dic = XmlHelper.Instance.GetXmlNodeList ("iosconfig.xml", "login/tabbarcontroller/items");
			if (dic != null) {
				int _row = dic.Count;
				nemulist = new string[_row, 3];

				int i = 0;
				foreach (KeyValuePair<string,string> kv in dic) {
					nemulist [i, 0] = kv.Key;
					nemulist [i, 1] = chongqing.ControlCenter.ImagePath + kv.Value.Split ('|') [0];
					nemulist [i, 2] = chongqing.ControlCenter.ImagePath + kv.Value.Split ('|') [1];
					i++;
				}	
				return nemulist;
			} else {
				return null;
			}
		}


public void ttt(string _content)
		{
			string[,] nemulist = Tools.GetTabBarControllerStr ();
			string _name = this.UserName.Text;
			tabBarController.ViewControllers = new UIViewController [] {
				new zerothViewController(_content, _name, nemulist[0,0],"0"),
				new FirstViewController(_name, nemulist[1,0], "1"),
				new SecondViewController(nemulist[2,0], "2"),
				new ThirdViewController(_name, nemulist[3,0], "3"),
				new FourthViewController(_name, nemulist[4,0], "4")
			};
			tabBarController.TabBar.Items.ToList ().ForEach (i => i.SetFinishedImages (UIImage.FromFile (nemulist [i.Tag, 1]), UIImage.FromFile (nemulist [i.Tag, 2])));

			tabBarController.ViewControllerSelected += delegate(object sender1, UITabBarSelectionEventArgs e) {
				int _tag = e.ViewController.TabBarItem.Tag;
				string _title = e.ViewController.TabBarItem.Title;
				this.Title = _title;
				if (_tag == 0) {
					this.NavigationController.SetNavigationBarHidden (true, false);
				}
				if (_tag > 0) {
					this.NavigationController.SetNavigationBarHidden (false, false);
					this.NavigationController.NavigationBar.SetBackgroundImage (UIImage.FromFile ("alltopbg1.png"), UIBarMetrics.Default);		
				}

				if (e.ViewController.TabBarItem.Title == "课程") {
					((FirstViewController)tabBarController.ViewControllers [_tag]).BindData ();
				} else if (e.ViewController.TabBarItem.Title == "资讯") {
					((SecondViewController)tabBarController.ViewControllers [_tag]).BindData ();
				} else if (e.ViewController.TabBarItem.Title == "我的课程") {
					this.NavigationItem.SetRightBarButtonItem (
						new UIBarButtonItem (UIBarButtonSystemItem.Edit, (sender2,args) => {
						if (this.NavigationItem.RightBarButtonItem.Title == null) {
							this.NavigationItem.RightBarButtonItem.Title = "Edit";
						}
						if (this.NavigationItem.RightBarButtonItem.Title == "Edit") {
							((BaseViewController)tabBarController.ViewControllers [_tag]).SetEditing (true, true);
							this.NavigationItem.RightBarButtonItem.Title = "Done";
						} else {
							((BaseViewController)tabBarController.ViewControllers [_tag]).SetEditing (false, true);
							this.NavigationItem.RightBarButtonItem.Title = "Edit";
						}
					})
						, true);

					((ThirdViewController)tabBarController.ViewControllers [_tag]).BindData ();
				} else if (e.ViewController.TabBarItem.Title == "更多") {
					((FourthViewController)tabBarController.ViewControllers [_tag]).ViewDidLoad ();
				}
			};

			this.NavigationController.PushViewController (tabBarController, true);
		}


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
很抱歉,我无法完成你的要求,因为作为一个语言模型AI,我无法完成基于Java Swing的UI设计和开发工作。但是,我可以为你提供一些相关的建议和思路,希望能对你有所帮助。 首先,你需要学习Java Swing的基本知识和使用方法,包括窗体、面板、布局、组件等的创建和使用,以及事件处理机制等。其次,你需要了解生辰八字的计算方法和规则,包括天干、地支、阴阳五行等概念,以及对应的计算公式和方法。最后,你需要将这些知识和技能结合起来,设计和开发出符合要求的小软件。 具体的实现思路如下: 1.创建窗体和面板,并设置布局和背景色等属性; 2.创建输入框和标签等组件,以便用户输入出生年月日和时间等信息; 3.创建计算按钮,并添加事件处理机制,当用户点击计算按钮时,程序将根据用户输入的信息,进行生辰八字的计算,并在计算结果区域显示计算结果; 4.计算结果区域可以使用表格等组件进行显示,以方便用户查看和比较; 5.需要注意的是,生辰八字的计算比较复杂,需要考虑到很多因素,如地点、时区、历法等,因此最好使用现成的计算库或API,以保证计算的准确性和精度; 6.最终的计算结果应该以生辰八字的形式呈现,即按照天干、地支、阴阳五行的顺序,依次显示对应的年柱、月柱、日柱和时柱等信息。 希望这些建议和思路能对你有所帮助,祝你成功完成小软件的设计和开发!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值