예제 #1
0
        public uint AddMenuItem(IDictionary <string, object> dict)
        {
            string uri = "";

            if (dict.ContainsKey("uri"))
            {
                uri = (string)dict ["uri"];
            }

            string title = "";

            if (dict.ContainsKey("container-title"))
            {
                title = (string)dict ["container-title"];
            }

            RemoteMenuEntry rem;

            if (uri.Length > 0)
            {
                rem = new RemoteFileMenuEntry(FileFactory.NewForUri(uri), title);

                AddToList(rem);
            }
            else
            {
                string label = "";
                if (dict.ContainsKey("label"))
                {
                    label = (string)dict ["label"];
                }

                string iconName = "";
                if (dict.ContainsKey("icon-name"))
                {
                    iconName = (string)dict ["icon-name"];
                }

                string iconFile = "";
                if (dict.ContainsKey("icon-file"))
                {
                    iconFile = (string)dict ["icon-file"];
                }

                if (iconFile.Length > 0)
                {
                    rem = new RemoteMenuEntry(label, iconFile, title);
                }
                else
                {
                    rem = new RemoteMenuEntry(label, iconName, title);
                }
                rem.Clicked += HandleActivated;

                AddToList(rem);
            }

            return(rem.ID);
        }
		public uint AddMenuItem (IDictionary<string, object> dict)
		{
			string uri = "";
			if (dict.ContainsKey ("uri"))
				uri = (string) dict ["uri"];
			
			string title = "";
			if (dict.ContainsKey ("container-title"))
				title = (string) dict ["container-title"];
			
			RemoteMenuEntry rem;
			
			if (uri.Length > 0) {
				 rem = new RemoteFileMenuEntry (FileFactory.NewForUri (uri), title);
				
				AddToList (rem);
			} else {
				string label = "";
				if (dict.ContainsKey ("label"))
					label = (string) dict ["label"];
				
				string iconName = "";
				if (dict.ContainsKey ("icon-name"))
					iconName = (string) dict ["icon-name"];
				
				string iconFile = "";
				if (dict.ContainsKey ("icon-file"))
					iconFile = (string) dict ["icon-file"];

				if (iconFile.Length > 0)
					rem = new RemoteMenuEntry (label, iconFile, title);
				else
					rem = new RemoteMenuEntry (label, iconName, title);
				rem.Clicked += HandleActivated;
				
				AddToList (rem);
			}
			
			return rem.ID;
		}