private void ViewThemeAdded(IEditThemesView sender)
        {
            ThemeBuilder builder = Argument.ExamBuilder.AddTheme("Новая тема");

            Argument.EditTreeView.RefreshThemes();
            Argument.EditTreeView.SelectObject(builder);
        }
Пример #2
0
        public void ThemeBuilder_SetParent_ThrowsArgumentExceptionIfParentIsTheSame()
        {
            Theme temp = new ThemeBuilder().SetId(1).SetName("Theme").SetDictionary(mockDictionary).Build();

            Assert.Throws <ArgumentException>(
                () => builder.SetParent(temp)
                );
        }
Пример #3
0
 public void Setup()
 {
     mockDictionary = new DictionaryBuilder()
                      .SetId(1)
                      .SetName("Mock dictionary")
                      .SetDescription("")
                      .Build();
     builder = new ThemeBuilder();
 }
Пример #4
0
 public FrontHtmlHelper(HtmlHelper htmlHelper, FrontContext frontContext)
 {
     _htmlHelper   = htmlHelper;
     _frontContext = frontContext;
     Script        = new ScriptBuilder(_frontContext, _htmlHelper);
     Theme         = new ThemeBuilder(_frontContext, _htmlHelper);
     Metadata      = new MetadataBuilder(_frontContext);
     Favicon       = new FaviconBuilder(_frontContext, _htmlHelper);
     HtmlTitle     = new HtmlTitleBuilder(_frontContext);
 }
Пример #5
0
 private void ViewThemeDeleted(IEditThemeView sender)
 {
     isSaved = true;
     if (currentThemeBuilder != null)
     {
         currentThemeBuilder.ParentExamBuilder.RemoveTheme(currentThemeBuilder);
         Argument.EditTreeView.RefreshThemes();
         Argument.EditTreeView.SelectObject(Section.Themes);
     }
     currentThemeBuilder = null;
     sender.Hide();
 }
Пример #6
0
 private void ViewShown(IEditThemeView sender)
 {
     if (!isHiding)
     {
         currentThemeBuilder = Argument.EditTreeView.CurrentObject as ThemeBuilder;
         if (currentThemeBuilder != null)
         {
             sender.ThemeName      = currentThemeBuilder.ThemeName;
             sender.QuestionsCount = currentThemeBuilder.ParentExamBuilder.GetQuestionBuilders().Where(a => ReferenceEquals(a.ThemeBuilder, currentThemeBuilder)).Count();
         }
         isSaved = true;
     }
 }
Пример #7
0
 private void ViewHiden(IEditThemeView sender)
 {
     if (!isHiding)
     {
         if (!isSaved)
         {
             isHiding = true;
             View.Show();
             sender.AskForSaving();
             View.Hide();
             isHiding = false;
         }
         currentThemeBuilder = null;
         isSaved             = true;
     }
 }
Пример #8
0
        public RoomData(PlayerDataHolder playerDataHolder, NetworkConnection connection, ConstArg constArg,
                        VariableArg variableArg)
        {
            this.playerDataHolder = playerDataHolder;

            this.DateTime         = DateTime.UtcNow;
            this.HostConnectionId = connection.connectionId;
            this.State            = RoomState.ReadyGame;
            this.ConstArg         = constArg;
            this.VariableArg      = variableArg;

            themeBuilder     = new ThemeBuilder(constArg.ThemeUnitList);
            memberDictionary = new Dictionary <int, DateTime>();
            wolfMemberList   = new List <int>();
            voteDictionary   = new Dictionary <int, int>();

            JoinRoom(connection);
        }
Пример #9
0
        public override void Handle(CreateThemeCommand command)
        {
            Dictionary dict   = _dbContext.Dictionaries.Find(command.DictionaryId);
            Theme      parent = _dbContext.Themes.Find(command.ParentId);

            if (dict == null)
            {
                _result = new InvalidResult()
                          .WithError("No dictionary of this id has been found.");
            }

            Theme newTheme = new ThemeBuilder()
                             .SetName(command.Name)
                             .SetDictionary(dict)
                             .SetParent(parent)
                             .Build();

            _dbContext.Themes.Add(newTheme);
            _dbContext.SaveChanges();
            _result = new SuccessResult();

            command.Id = newTheme.Id;
        }