/// <summary> /// Устаревший метод для добавления новых объектов в набор EntitySet TestAnswers. Взамен можно использовать метод .Add связанного свойства ObjectSet<T>. /// </summary> public void AddToTestAnswers(TestAnswer testAnswer) { base.AddObject("TestAnswers", testAnswer); }
/// <summary> /// Создание нового объекта TestAnswer. /// </summary> /// <param name="id">Исходное значение свойства id.</param> public static TestAnswer CreateTestAnswer(global::System.Int32 id) { TestAnswer testAnswer = new TestAnswer(); testAnswer.id = id; return testAnswer; }
private StackPanel ParsingAnswersForRow(Grid g, int rowCount, TestAnswer ans) { string[] ansParts = ans.answer.Split(' '); StackPanel sp = new StackPanel(); sp.Width = 500; sp.Orientation = Orientation.Vertical; WrapPanel wp = new WrapPanel(); wp.Width = 500; wp.Orientation = Orientation.Horizontal; wp.Margin = new Thickness(0, 10, 0, 0); bool IsCreateNewWrapPanel = false; foreach (string s in ansParts) { if (IsCreateNewWrapPanel) { wp = new WrapPanel(); wp.Width = 500; wp.Orientation = Orientation.Horizontal; IsCreateNewWrapPanel = false; } if (s.Contains("imageID")) { int imgID = Convert.ToInt32(getImageIDfromStr(s)); bool NewLine = false; if (s.Contains("position")) { int posIndex = s.LastIndexOf('='); posIndex++; string position = s.Substring(posIndex, s.Length - 1 - posIndex); if (position.Equals("NewLine")) NewLine = true; } string ImgPath = LoadData.TestingImageTable.Where(n => n.id == imgID).Single().imgPath; Image im = new Image(); BitmapImage bIm = new BitmapImage(new Uri("/MRZS;Component/Assets/Testing/" + ImgPath, UriKind.Relative)); im.Source = bIm; im.ImageOpened += im_ImageOpened; im.Visibility = Visibility.Collapsed; //adding image in stackpanel if (NewLine) { sp.Children.Add(wp); sp.Children.Add(im); IsCreateNewWrapPanel = true; } else //adding image to wrappanel { wp.Children.Add(im); } } else { TextBlock tb = createTextBlock(s); wp.Children.Add(tb); } } if(sp.Children.Contains(wp)==false) sp.Children.Add(wp); return sp; }