コード例 #1
0
ファイル: TipViewModel.cs プロジェクト: lnsane/ProjectEye
        public TipViewModel(RestService reset,
                            SoundService sound,
                            ConfigService config,
                            StatisticService statistic,
                            MainService main,
                            App app,
                            KeyboardShortcutsService keyboardShortcuts,
                            PreAlertService preAlert,
                            ThemeService theme)
        {
            this.reset                = reset;
            this.reset.TimeChanged   += new RestEventHandler(timeChanged);
            this.reset.RestCompleted += new RestEventHandler(resetCompleted);

            this.sound           = sound;
            this.config          = config;
            this.config.Changed += config_Changed;


            resetCommand = new Command(new Action <object>(resetCommand_action));
            busyCommand  = new Command(new Action <object>(busyCommand_action));

            this.statistic = statistic;

            this.main = main;
            this.keyboardShortcuts = keyboardShortcuts;
            this.preAlert          = preAlert;
            this.theme             = theme;
            theme.OnChangedTheme  += Theme_OnChangedTheme;
            ChangedEvent          += TipViewModel_ChangedEvent;
            LoadConfig();
        }
コード例 #2
0
        public void ApplyThemeToScript_SingleBlockDifferentComponentName_DoesNotReplaceColour()
        {
            // Arrange

            var testInputBlockItem = new TextColorBlockItem();
            var testInputBlock     = new ItemFilterBlock();

            testInputBlock.BlockItems.Add(testInputBlockItem);
            var testInputScript = new ItemFilterScript();

            testInputScript.ItemFilterBlocks.Add(testInputBlock);

            var testInputTheme = new Theme();
            var testInputThemeComponentColor = new Color {
                R = 255, G = 0, B = 1
            };
            var testInputThemeComponent          = new ThemeComponent(ThemeComponentType.TextColor, "Test Component 1", testInputThemeComponentColor);
            var testInputBlockItemThemeComponent = new ThemeComponent(ThemeComponentType.TextColor, "Different Component", testInputThemeComponentColor);

            testInputTheme.Components.Add(testInputThemeComponent);
            testInputBlockItem.ThemeComponent = testInputBlockItemThemeComponent;

            var mockMessageBoxService = new Mock <IMessageBoxService>();

            var service = new ThemeService(mockMessageBoxService.Object);

            // Act
            service.ApplyThemeToScript(testInputTheme, testInputScript);

            // Assert
            Assert.AreNotEqual(testInputThemeComponentColor, testInputBlockItem.Color);
        }
コード例 #3
0
ファイル: OptionsViewModel.cs プロジェクト: weond/ProjectEye
        public OptionsViewModel(ConfigService config,
                                MainService mainService,
                                SystemResourcesService systemResources,
                                SoundService sound,
                                ThemeService theme)
        {
            this.config          = config;
            this.mainService     = mainService;
            this.systemResources = systemResources;
            this.sound           = sound;
            this.theme           = theme;
            Model                 = new OptionsModel();
            Model.Data            = config.options;
            Model.Themes          = systemResources.Themes;
            Model.PreAlertActions = systemResources.PreAlertActions;
            string[] version = Assembly.GetExecutingAssembly().GetName().Version.ToString().Split('.');
            Model.Version = version[0] + "." + version[1] + "." + version[2];


            applyCommand               = new Command(new Action <object>(applyCommand_action));
            openurlCommand             = new Command(new Action <object>(openurlCommand_action));
            inkCommand                 = new Command(new Action <object>(inkCommand_action));
            soundTestCommand           = new Command(new Action <object>(soundTestCommand_actionAsync));
            updateCommand              = new Command(new Action <object>(updateCommand_action));
            showWindowCommand          = new Command(new Action <object>(showWindowCommand_action));
            addBreackProcessCommand    = new Command(new Action <object>(addBreackProcessCommand_action));
            removeBreackProcessCommand = new Command(new Action <object>(removeBreackProcessCommand_action));
        }
コード例 #4
0
        public void Should_not_set_selected_theme()
        {
            var storageProvider    = new Mock <IStorageProvider>();
            var preferencesService = new Mock <IPreferencesService>();

            SetupMockCase(preferencesService, storageProvider);

            var service = new ThemeService(storageProvider.Object, preferencesService.Object, new Mock <IMapper>().Object);
            var themes  = new List <ITheme>
            {
                new Theme()
                {
                    IsSelected = true,
                    Type       = "MaterialDeepPurple"
                },
                new Theme()
                {
                    IsSelected = false,
                    Type       = "Light"
                }
            };
            var result = service.SetSelected(themes, new Theme()
            {
                IsSelected = true,
                Type       = "MaterialDeepPurple"
            });

            result.Should().Be(false);
        }
コード例 #5
0
        public async Task InitializeAsync()
        {
            var themeService = new ThemeService(Utils.MyShopifyUrl, Utils.AccessToken);
            var themes       = await themeService.ListAsync();

            ThemeId = themes.First().Id.Value;
        }
コード例 #6
0
        protected override async Task OnInitializedAsync()
        {
            try
            {
                _themeName = WebUtility.UrlDecode(PageState.QueryString["name"]);
                var themes = await ThemeService.GetThemesAsync();

                var theme = themes.FirstOrDefault(item => item.ThemeName == _themeName);
                if (theme != null)
                {
                    _name    = theme.Name;
                    _version = theme.Version;
                    _owner   = theme.Owner;
                    _url     = theme.Url;
                    _contact = theme.Contact;
                    _license = theme.License;
                }
            }
            catch (Exception ex)
            {
                await logger.LogError(ex, "Error Loading Theme {ThemeName} {Error}", _themeName, ex.Message);

                AddModuleMessage("Error Loading Theme", MessageType.Error);
            }
        }
コード例 #7
0
        /// <summary>
        /// 获取用户当前选中的皮肤
        /// </summary>
        /// <param name="ownerId">拥有者Id(如:用户Id、群组Id)</param>
        /// <returns></returns>
        public string GetThemeAppearance(long ownerId)
        {
            var         groupService = new GroupService();
            GroupEntity group        = groupService.Get(ownerId);

            if (group == null)
            {
                return(string.Empty);
            }
            PresentArea pa = new PresentAreaService().Get(PresentAreaKeysOfBuiltIn.GroupSpace);

            if (pa != null && !pa.EnableThemes)
            {
                return(pa.DefaultThemeKey + "," + pa.DefaultAppearanceKey);
            }

            if (group.IsUseCustomStyle)
            {
                return("Default,Default");
            }
            else if (!string.IsNullOrEmpty(group.ThemeAppearance))
            {
                var appearance = new ThemeService().GetThemeAppearance(PresentAreaKeysOfBuiltIn.GroupSpace, group.ThemeAppearance);
                if (appearance != null)
                {
                    return(group.ThemeAppearance);
                }
            }

            if (pa != null)
            {
                return(pa.DefaultThemeKey + "," + pa.DefaultAppearanceKey);
            }
            return(string.Empty);
        }
コード例 #8
0
        public static ThemeController Create(Context context)
        {
            var themeRepository = new ThemeRepository(context);
            var themeService    = new ThemeService(themeRepository);
            var themeController = new ThemeController(themeService);

            return(themeController);
        }
コード例 #9
0
 private void Billing_Load(object sender, EventArgs e)
 {
     BindComUser();
     BindProduct();
     a = 0;
     ThemeService.ActiveTheme(this);
     dataListProducts.BackgroundColor = this.BackColor;
 }
コード例 #10
0
        public PaginationHelper(ThemeService themeService, IServiceProvider services) : base("pagination", HelperType.HandlebarsHelper)
        {
            _themeService = themeService;
            _viewEngine   = new Lazy <IHandlebarsViewEngine>(services.GetService <IHandlebarsViewEngine>);
            _themeService.ThemeChanged += async(_, __) => await SetTemplateAsync();

            SetTemplateAsync();
        }
コード例 #11
0
        public int?DonnerParNom(ChercherPar cp)
        {
            ThemeService rs = new ThemeService();

            return(rs.DonnerParNom(cp.chercheString));

            throw new NotImplementedException();
        }
コード例 #12
0
 private void About_Load(object sender, EventArgs e)
 {
     ThemeService.ActiveTheme(this);
     lblPassword.BackColor = pnlReset.BackColor;
     txtPassword.BackColor = pnlReset.BackColor;
     pnlReset.Left         = this.Width / 2 - pnlReset.Width / 2;
     pnlReset.Top          = this.Height / 2 - pnlReset.Height / 2;
 }
コード例 #13
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            SetupExceptionHandling();

            ThemeService.SetThemeToUserSettings();
        }
コード例 #14
0
        public async Task <IActionResult> Themes(Guid subjectId, int page = 0, int pageSize = 10)
        {
            var themes = await ThemeService.GetThemesForSubjectAsync(subjectId);

            var model = Mapper.Map <ICollection <ThemeModel>, ICollection <ThemeViewModel> >(themes);

            return(Ok(model));
        }
コード例 #15
0
        public IEnumerable <Theme> Donner(ObjetDonnerListe odl)
        {
            ThemeService rs = new ThemeService();

            return(rs.Donner(odl.ienum, odl.options).Select(j => j.VersAPI()));

            throw new NotImplementedException();
        }
コード例 #16
0
        static int Run(string[] args)
        {
            var themePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, THEMES);
            var themeDir  = new DirectoryInfo(themePath);

            if (!themeDir.Exists ||
                themeDir.GetFiles(DNTHEME).Length == 0)
            {
                WriteMessage("请将{0}文件放到{1}文件夹下", DNTHEME, themePath);
                return(-1);
            }

            var outputPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, OUTPUTDIR);

            Directory.CreateDirectory(outputPath);

            var service = new ThemeService();
            var xml     = new XDocument();

            foreach (var theme in service.AllThemes)
            {
                var rd   = new ResourceDictionary();
                var root = CreateRootElement(xml);
                var name = theme.Name ?? theme.Guid.ToString();
                WriteMessage("正在处理{0}", name);
                foreach (var kv in theme.EnumerateResourceKeyValues())
                {
                    if (kv.Item2 is MediaColor color)
                    {
                        CreateColorElement(root, kv.Item1.ToString(), color);
                    }
                    else if (kv.Item2 is Brush brush)
                    {
                        CreateBrushElement(root, kv.Item1.ToString(), brush);
                    }
                    else if (kv.Item2 is LinearGradientBrush linearGradientBrush)
                    {
                        CreateLinearGradientBrushElement(root, kv.Item1.ToString(), linearGradientBrush);
                    }
                    else if (kv.Item2 is DrawingBrush drawingBrush)
                    {
                        CreateDrawingBrushElement(root, kv.Item1.ToString(), drawingBrush);
                    }
                    else
                    {
                        continue;
                    }
                }
                var outFile = Path.Combine(outputPath, name) + ".xaml";
                WriteMessage("输出资源字典文件{0}", outFile);
                xml.Save(outFile, SaveOptions.None);
            }

            WriteMessage("完成,按任意键退出...");
            Console.ReadKey();

            return(0);
        }
コード例 #17
0
        public void Should_throw_validation_errors_when_setting_selected_theme()
        {
            var storageProvider    = new Mock <IStorageProvider>();
            var preferencesService = new Mock <IPreferencesService>();

            SetupMockCase(preferencesService, storageProvider);

            var service = new ThemeService(storageProvider.Object, preferencesService.Object, new Mock <IMapper>().Object);
            var themes  = new List <ITheme>
            {
                new Theme()
                {
                    IsSelected = true,
                    Type       = "Dark"
                },
                new Theme()
                {
                    IsSelected = false,
                    Type       = "Light"
                }
            };

            Exception exception = null;

            try
            {
                service.SetSelected(themes, null);
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            exception.GetType().Should().Be(typeof(ArgumentNullException));
            exception = null;
            try
            {
                service.SetSelected(null, new Theme());
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            exception.GetType().Should().Be(typeof(ArgumentNullException));
            exception = null;

            try
            {
                service.SetSelected(new List <ITheme>(), new Theme());
            }
            catch (Exception ex)
            {
                exception = ex;
            }

            exception.GetType().Should().Be(typeof(ArgumentNullException));
        }
コード例 #18
0
        public void InsertThemeTest()
        {
            Theme theme = new Theme();

            theme.ThemeId = SnowFlake_Net.GenerateSnowFlakeID();
            // theme.FriendLinksArray =new FriendLinks[]{ new FriendLinks() {FriendLinksId= SnowFlake_Net.GenerateSnowFlakeID() ,Title="A",Url="A"} };
            ThemeService.InsertTheme(theme);
            Assert.Fail();
        }
コード例 #19
0
ファイル: Create.xaml.cs プロジェクト: mxzik/TestSystem
        public Create()
        {
            InitializeComponent();

            _testService  = new TestService();
            _themeService = new ThemeService();

            txbTheme.ItemsSource = _themeService.GetAll().Select(x => x.Name).ToArray();
        }
コード例 #20
0
ファイル: ForumController.cs プロジェクト: AmoonRAA/ForumApp
        public async Task <ActionResult> CreateTheme(ThemeModel model)
        {
            ThemeDTO themeDto = new ThemeDTO {
                ThemeDesc = model.ThemeDesc, ThemeTitle = model.ThemeTitle, Id = RandomStringIdGenerator.GetUniqueId()
            };
            await ThemeService.CreateNew(themeDto);

            return(RedirectToAction("Index", "Home"));
        }
コード例 #21
0
        /// <summary>
        /// CTR
        /// </summary>
        public ThemesController(ThemeService themes)
        {
            if (themes == null)
            {
                throw new ArgumentNullException("themes");
            }

            _ThemeService = themes;
        }
コード例 #22
0
        public void GetThemesFromStringResource()
        {
            var fixture = new ThemeService();
            var themes = fixture.GetThemes(WallpaperResource.Feeds);

            Assert.AreEqual("Wallpaper of the Day", themes.WallPaperOfTheDay.Name);
            Assert.AreEqual("Top 4 Wallpapers Today", themes.All.ToList()[1].Name);
            Assert.AreEqual(37, themes.All.Count());
        }
コード例 #23
0
    public UserThemeService(UserConfigService configService, ThemeService themeService)
    {
        _configService = configService;
        _themeService  = themeService;

        var userTheme = _configService.Get(ConfigSettings.Theme, "green");

        _currentTheme = _themeService.GetThemeConfig(userTheme);
    }
コード例 #24
0
 public ProfileSelectViewModel(
     AccountService accountService,
     SkinService skinService,
     ThemeService themeService)
 {
     _accountService = accountService;
     _skinService    = skinService;
     _themeService   = themeService;
 }
コード例 #25
0
        protected override async Task OnInitializedAsync()
        {
            _tenants = await TenantService.GetTenantsAsync();

            _urls      = PageState.Alias.Name;
            _themeList = await ThemeService.GetThemesAsync();

            _themes        = ThemeService.GetThemeControls(_themeList);
            _siteTemplates = await SiteTemplateService.GetSiteTemplatesAsync();
        }
コード例 #26
0
 public Startup(ThemeService themeService, WindowManager windowManager, TerminalHandler terminalHandler,
                GlobalHotkeys globalHotkeys, IConfig config, UpdateChecker updateChecker)
 {
     _themeService    = themeService;
     _windowManager   = windowManager;
     _terminalHandler = terminalHandler;
     _globalHotkeys   = globalHotkeys;
     _config          = config;
     _updateChecker   = updateChecker;
 }
コード例 #27
0
ファイル: UpdateViewModel.cs プロジェクト: lotsmon/GBCLV3
        public UpdateViewModel(
            ThemeService themeService,
            UpdateService updateService,
            IWindowManager windowManager)
        {
            _updateService = updateService;
            _windowManager = windowManager;

            ThemeService = themeService;
        }
コード例 #28
0
ファイル: ForumController.cs プロジェクト: AmoonRAA/ForumApp
        public async Task <ActionResult> EditTheme(string id)
        {
            ThemeDTO theme = await ThemeService.FindThemeDtoById(id);

            if (theme != null)
            {
                return(View(theme));
            }
            return(HttpNotFound());
        }
コード例 #29
0
        public async Task <ActionResult> Themes(Guid subjectId)
        {
            ViewBag.SubjectId = subjectId;

            var themes = await ThemeService.GetThemesForSubjectAsync(subjectId);

            var model = Mapper.Map <ICollection <ThemeModel>, ICollection <ThemeViewModel> >(themes);

            return(View(model));
        }
コード例 #30
0
        private void InitTheme()
        {
            var themeService = new ThemeService();

            Theme         = themeService.Get();
            StylesContent = themeService.GenerateStylesContent();
            StylesHash    = GetStringHash(StylesContent, new SHA256CryptoServiceProvider());
            //StyleFrameworkContent = themeService.GenerateStyleFrameworkContent();
            //StyleFrameworkHash = GetStringHash(StyleFrameworkContent, new SHA256CryptoServiceProvider());
        }
コード例 #31
0
 private void LogIn_Load(object sender, EventArgs e)
 {
     ThemeService.ActiveTheme(this);
     lblTitle.Text = MyShopConfigration.ProjectName;
     this.Top      = this.Top + 100;
     notifyIcon1.BalloonTipTitle = MyShopConfigration.ProjectName;
     lblTime.Text = DateTime.Now.ToString("t");
     Functions.Notification(notifyIcon1, "Active theme : " + this.BackColor.Name.ToString() + " | System name: " + Environment.MachineName
                            + " | Username: "******" | Developers: Nithin R Nair, Maheesh M - MCA 2013 - 16 KVVS IT - Adoor", 100);
 }
コード例 #32
0
        public async Task GetImageInformation()
        {
              var themeService = new ThemeService();
              var themes = themeService.GetThemes(WallpaperResource.Feeds);

            var fixture = new RssReader();

            var rssForFeed = await fixture.GetFeed(themes.WallPaperOfTheDay.FeedUrl);
            var images = fixture.GetImageMetaData(rssForFeed);
            Assert.IsNotNull(images.First().imageUrl);

        }