Beispiel #1
0
        public MainWindowViewModel(IDialogService dialogService, int inputScheme, string typeOfChallenge = null, string agent = null)
        {
            if (Instance == null)
            {
                Instance = this;
            }

            if (methParamsInstance == null)
            {
                methParamsInstance = new MethParams();
            }

            if (dataServiceInstance == null)
            {
                dataServiceInstance = new DataService();
            }

            MethParamsWorkspace = new MethParamsViewModel();
            Workspace           = MethParamsWorkspace;

            this.typeOfChallenge = typeOfChallenge;
            this.agent           = agent;

            this.inputScheme   = inputScheme;
            this.dialogService = dialogService;
            base.DisplayName   = "MainWindow";
            iconRepository     = new IconRepository();
        }
        public void Setup()
        {
            mockIconDownloader     = new Mock <IIconDownloader>();
            mockFileHandler        = new Mock <IFileHandler>();
            mockGravatarUrlBuilder = new Mock <IGravatarUrlBuilder>();

            classUnderTest = new IconRepository(mockIconDownloader.Object, mockFileHandler.Object, mockGravatarUrlBuilder.Object);
        }
        public IconListViewModel(IconRepository newIconRepository)
        {
            IconsList = new ObservableCollection <Icon>();

            this.iconRepository = newIconRepository;
            base.DisplayName    = "List";

            // Subscribe for notifications of when a new icon is saved.
            iconRepository.IconAdded += this.OnIconAddedToRepository;

            //iconRepository.IconRemoved += this.OnIconRemovedFromRepository;
        }
        public CreateIconInput1ViewModel(Icon newIcon, IconRepository newIconRepository,
                                         IDialogService dialogService)
        {
            icon               = newIcon ?? throw new ArgumentNullException("icon");
            iconRepository     = newIconRepository ?? throw new ArgumentNullException("iconrepository");
            this.dialogService = dialogService;

            this.DisplayName = "New icon";

            ChallengeTypes = new ObservableCollection <ChallengeTypeClass>(MethParamsDisplay.GetChTypesList());

            CreateBreathingRateValues();
            CreateIpeClasses();
            CreateUniformList();
        }
Beispiel #5
0
        /// <summary>
        /// 删除图标
        /// </summary>
        /// <param name="ids">图标编号集合</param>
        /// <param name="cssPath">图标Css的路径</param>
        public List <Icon> Delete(List <Guid> ids, string cssPath)
        {
            ids.CheckNull("ids");
            var result = new List <Icon>();

            if (ids.Count == 0)
            {
                return(result);
            }
            result = IconRepository.Find(ids);
            RemoveFromRepository(result);
            DeleteFiles(result);
            RemoveCss(result, cssPath);
            return(result);
        }
        public CreateIconInput2ViewModel(Icon newIcon, IconRepository newIconRepository, string _AgentSelected)
        {
            icon           = newIcon ?? throw new ArgumentNullException("icon");
            iconRepository = newIconRepository ?? throw new ArgumentNullException("iconrepository");

            this.AgentSelected = _AgentSelected;

            methParamsDisplay         = new MethParamsDisplay();
            methParamsDisplay.ChTypes = new List <string>();
            methParamsDisplay.Values  = new List <double>();

            ChallengeTypes   = new ObservableCollection <ChallengeTypeClass>(MethParamsDisplay.GetChTypesList());
            AgentsList       = new ObservableCollection <string>(methParamsDisplay.Agents);
            this.DisplayName = "New icon";
        }
Beispiel #7
0
        public static FileExplorerNode CreateNode(string path, NodeViewType nvt, FileExplorer parent, bool IsFile = false)
        {
            var fen = new FileExplorerNode()
            {
                IsFile = IsFile, nodeViewType = nvt
            };

            fen.parent    = parent;
            fen.Name      = Path.GetFileName(path);
            fen.Directory = Path.GetDirectoryName(path);
            fen.FullPath  = path;
            fen.Icon      = IconRepository.GetIconByFileName(fen.Name);

            fen.CreateHtmlNode();

            return(fen);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // Check to see if we need to delete any messages
            // Remember to delete them from the ones displayed in the table too, or the user will still see them
            // load active messages in the table and provide button links to delete them
            ShopMessageRepository messageRepo = new ShopMessageRepository();

            if (Request.QueryString["remove"] != null)
            {
                int removeID = Parsers.ParseInt(Request.QueryString["remove"].ToString().Trim());
                if (removeID > 0)
                {
                    messageRepo.Delete(removeID);
                }
            }


            List <ShopMessage> activeMessages = messageRepo.GetActive();

            tblActiveMessages.Rows.Clear();
            tblActiveMessages.Rows.Add(addMessageTableHeaderRow());
            foreach (ShopMessage msg in activeMessages)
            {
                tblActiveMessages.Rows.Add(addMessageTableRow(msg));
            }

            if (!IsPostBack)
            {
                chkIsHighPriority.Checked = true;

                IconRepository iconRepo = new IconRepository();
                drpIcon.Items.Clear();
                drpIcon.Items.Add(new ListItem()
                {
                    Text = "default.png", Value = "default.png"
                });
                foreach (string icon in iconRepo.GetAll())
                {
                    drpIcon.Items.Add(new ListItem()
                    {
                        Text = icon, Value = icon
                    });
                }
            }
        }
Beispiel #9
0
 /// <summary>
 /// 从仓储移除图标集合
 /// </summary>
 private void RemoveFromRepository(IEnumerable <Icon> icons)
 {
     IconRepository.Remove(icons);
 }
Beispiel #10
0
 /// <summary>
 /// 添加到仓储
 /// </summary>
 private void AddToRepository(Icon icon)
 {
     icon.Init();
     icon.Validate();
     IconRepository.Add(icon);
 }
Beispiel #11
0
 public ReadableLibrary(List list, IReadItemMapper <TEntityType> mapper) : base(list, mapper)
 {
     iconRepository = new IconRepository(list.ParentWeb);
 }