Exemple #1
0
 private static void BindDataSource(DropDownList list, Property id, object dataSource)
 {
     list.DataSource = dataSource;
     list.DataValueField = id.ToString();
     list.DataTextField = Property.Type.ToString();
     list.DataBind();
     list.Items.Insert(0, "-");
 }
        public Card getBiggest(List<Card> cards, Property selectedProp)
        {
            FieldInfo field = typeof(Card).GetField(selectedProp.ToString().ToLower());

            int card1Value = 0;
            int card2Value = 0;

            Func<Card, Card, Card> testBigger = (card1, card2) => {
                return card1Value > card2Value ? card1 : card2;
            };

            return cards.Aggregate((card1, card2) => {

                if(card1 == null || card2 == null){
                    return card1 == null ? card2 : card1;
                }

                card1Value = (int) field.GetValue(card1);
                card2Value = (int) field.GetValue(card2);

                if (isTrumph(card1) && isHead(card2) || isTrumph(card2) && isHead(card1)
                    || !isTrumph(card1) && !isTrumph(card2) && card1Value != card2Value) {
                        return testBigger(card1, card2);
                }

                return card1Value == card2Value ? null : isTrumph(card1) ? card1 : isTrumph(card2) ? card2 : null;
            });
        }
		private void ScheduleRemoval (Property prop, Scheduler.Priority priority)
		{
			if (queryable.ThisScheduler.ContainsByTag (prop.ToString ())) {
				Logger.Log.Debug ("Not adding a Task for already running: {0}", prop.ToString ());
				return;
			}
			
			Scheduler.Task task = queryable.NewRemoveByPropertyTask (prop);
			task.Priority = priority;
			task.SubPriority = 0;
			queryable.ThisScheduler.Add (task);
		}
        public void ShowImageDetailView(string detailViewName, int heightOffSet, int widthOffSet, Property property, bool loadFromShape = false)
        {
            Logger.Instance.Log(LogPriority.MIDDLE, this, "[SHAPE EDIT DIALOG] open title + description dialog");
            string speak = "";
            gui_Menu = new GUI_Menu(); //init GUI MENU  
            //create entry for dic
            createDetailView(detailViewName, 0, 48, 120, 12, true);
            detailViewDic[detailViewName].SetVisibility(true);
            //load data from selected Shape     
            if (loadFromShape)
            {
                loadImageData();
            }
            //as default title is selected and show
            activeProperty = property;
            selectedPropertyMenuItem = property;
            setContent(detailViewName, property);
            switch (property)
            {
                case Property.Title:
                    speak = LL.GetTrans("tangram.lector.image_data.title");
                    break;
                case Property.Description:
                    speak = LL.GetTrans("tangram.lector.image_data.desc");
                    break;
            }

            audioRenderer.PlaySoundImmediately(LL.GetTrans("tangram.lector.image_data.generic_property_value", speak, propertiesDic[activeProperty.ToString().ToLower()]));
        }
 /// <summary>
 /// Save and Set content of detailView depending on property
 /// </summary>
 /// <param name="property">The property.</param>
 /// <param name="content">The content.</param>
 private void SaveBrailleInput(Property property, string content)
 {
     propertiesDic[property.ToString().ToLower()] = content;
 }
 private void comunicatePropertiesSwitch(Property property, Property previousProperty)
 {
     String command = getAudioForProperty(property);
     activeProperty = property;
     string previousContent = removeInputStr(property, previousProperty); // content of detailView contain inputField
     SaveBrailleInput(previousProperty, previousContent);
     setContent(TITLE_DESC_VIEW_NAME, property);
     // Test, whether property has content, if yes speak it
     string content = propertiesDic[property.ToString().ToLower()];
     if (content.Length != 0)
     {
         //command += " ist " + content;
         command = LL.GetTrans("tangram.lector.image_data.generic_property_value", command, content);
     }
     else
     {
         //command += " eingeben";
         command = LL.GetTrans("tangram.lector.image_data.enter_property", command);
     }
     AudioRenderer.Instance.PlaySoundImmediately(command);
     Logger.Instance.Log(LogPriority.MIDDLE, this, "[SHAPE EDIT DIALOG] show " + property.ToString() + ": " + content);
 }