本文整理汇总了C#中Theme类的典型用法代码示例。如果您正苦于以下问题:C# Theme类的具体用法?C# Theme怎么用?C# Theme使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Theme类属于命名空间,在下文中一共展示了Theme类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTheme
internal void AddTheme(Theme theme, DateTime partyDate)
{
if (!this.Items.Any(o => o.Product.Guid == theme.Guid))
{
this.Items.Add(new CartItem(theme, partyDate));
}
}
示例2: ApplyTheme
public static void ApplyTheme(this Application application, Theme? theme, SolidColorBrush accentBrush, SolidColorBrush contrastBrush)
{
ValidationHelper.NotNull(application, () => application);
application.Dispatcher.Invoke(new ApplyThemeToApplicationDelegate(ApplyThemeInternal), DispatcherPriority.Render,
application, theme, accentBrush, contrastBrush);
}
示例3: GetAttemptId
/// <summary>
/// Checks if related to theme package has been already uploaded.
/// In case it was not uploaded - upload package.
/// Check attempt has been created and get attempt id.
/// </summary>
/// <param name="theme">Theme object represents specified theme.</param>
/// <returns>Long integer value representing attempt id.</returns>
public long GetAttemptId(Theme theme)
{
GetCurrentUserIdentifier();
AttemptItemIdentifier attemptId = null;
ActivityPackageItemIdentifier organizationId;
var packageId = GetPackageIdentifier(theme.CourseRef.Value);
// in case package has not been uploaded yet.
if (packageId == null)
{
string zipPath = CourseService.Export(theme.CourseRef.Value);
Package package = new ZipPackage(zipPath);
package.CourseID = theme.CourseRef.Value;
packageId = AddPackage(package);
organizationId = GetOrganizationIdentifier(packageId);
attemptId = CreateAttempt(organizationId.GetKey(), theme.Id);
}
// otherwise check if attempt was created
else
{
organizationId = GetOrganizationIdentifier(packageId);
AttemptItemIdentifier attId = GetAttemptIdentifier(organizationId, theme.Id);
if (attId != null)
{
attemptId = attId;
}
else
{
attemptId = CreateAttempt(organizationId.GetKey(), theme.Id);
}
}
return attemptId.GetKey();
}
示例4: CreateAssets
public void CreateAssets()
{
if (_sandboxProject == null)
{
_sandboxProject = SandboxProject;
_andre = Instance.Get.MemberByID("Member:1000");
_danny = Instance.Get.MemberByID("Member:1005");
Theme theme1 = _sandboxProject.CreateTheme("Theme 1");
Theme theme2 = _sandboxProject.CreateTheme("Theme 2");
Theme theme11 = theme1.CreateChildTheme("Child Theme 1");
theme1.Customer = _andre;
theme1.Source.CurrentValue = "Customer";
theme1.Risk.CurrentValue = "Medium";
theme1.Priority.CurrentValue = "Medium";
theme1.Save();
theme2.Customer = _danny;
theme2.Source.CurrentValue = "Sales";
theme2.Risk.CurrentValue = "Low";
theme2.Priority.CurrentValue = "Low";
theme2.Save();
theme11.Customer = _andre;
theme11.Source.CurrentValue = "Customer";
theme11.Risk.CurrentValue = "Medium";
theme11.Priority.CurrentValue = "Medium";
theme11.Source.CurrentValue = "Sales";
theme11.Save();
_theme1 = theme1;
}
}
示例5: ChangeTheme
void ChangeTheme()
{
if (currentTheme == Theme.Dark)
{
// remove old theme
Application.Current.Resources.MergedDictionaries.Remove(
Application.Current.Resources.MergedDictionaries.FirstOrDefault(
x => x.Source.OriginalString.Equals(DarkThemePath)
)
);
// apply new theme
var newTheme = new ResourceDictionary();
newTheme.Source = new Uri(LightThemePath, UriKind.Relative);
Application.Current.Resources.MergedDictionaries.Add(newTheme);
currentTheme = Theme.Light;
}
else
{
// remove old theme
Application.Current.Resources.MergedDictionaries.Remove(
Application.Current.Resources.MergedDictionaries.FirstOrDefault(
x => x.Source.OriginalString.Equals(LightThemePath)
)
);
// apply new theme
var newTheme = new ResourceDictionary();
newTheme.Source = new Uri(DarkThemePath, UriKind.Relative);
Application.Current.Resources.MergedDictionaries.Add(newTheme);
currentTheme = Theme.Dark;
}
}
示例6: ThemeChooser
public ThemeChooser()
{
var theme1 = new Theme("/Content/Images/Application/MainViewPanoramaBackgrounds/empty_background.png",
"/Content/Images/Application/MainViewPanoramaBackgrounds/CroppedImages/empty_background.png")
{
AccentColor1 = new PortableSolidColorBrush(255, 128, 0, 128),
AccentColor2 = new PortableSolidColorBrush(255, 0, 128, 0),
AccentColor3 = new PortableSolidColorBrush(255, 155, 165, 0),
AppBarBackgroundBrush = new PortableSolidColorBrush("#FF333333"),
AppBarButtonBrush = new PortableSolidColorBrush("#FFFFFFFF"),
AppBarButtonClickBrush = new PortableSolidColorBrush("#FFFFFFFF"),
};
var theme2 = new Theme("/Content/Images/Application/MainViewPanoramaBackgrounds/MainViewPanorama_cats_blue.png",
"/Content/Images/Application/MainViewPanoramaBackgrounds/CroppedImages/MainViewPanorama_cats_blue_small.png")
{
AccentColor1 = new PortableSolidColorBrush(255, 128, 0, 128),
AccentColor2 = new PortableSolidColorBrush(255, 0, 128, 0),
AccentColor3 = new PortableSolidColorBrush(255, 155, 165, 0),
AppBarBackgroundBrush = new PortableSolidColorBrush(255, 50, 50, 50)
};
var theme3 = new Theme("/Content/Images/Application/MainViewPanoramaBackgrounds/MainViewPanorama_cats_pink.png",
"/Content/Images/Application/MainViewPanoramaBackgrounds/CroppedImages/MainViewPanorama_cats_pink_small.png")
{
AccentColor1 = new PortableSolidColorBrush(255, 128, 0, 128),
AccentColor2 = new PortableSolidColorBrush(255, 0, 128, 0),
AccentColor3 = new PortableSolidColorBrush(255, 155, 165, 0),
AppBarBackgroundBrush = new PortableSolidColorBrush(255, 50, 50, 50)
};
_themes = new ObservableCollection<Theme>() {theme1, theme2, theme3};
_selectedTheme = _themes[0];
}
示例7: ChangeTheme
public static void ChangeTheme(Application app, Accent newAccent, Theme newTheme)
{
if (app == null) throw new ArgumentNullException("app");
var oldTheme = DetectTheme(app);
ChangeTheme(app.Resources, oldTheme, newAccent, newTheme);
}
示例8: FakeThemesByCurriculumId
// SelectTheme
public static List<Theme> FakeThemesByCurriculumId()
{
Theme fakeTheme = new Theme();
fakeTheme.Id = 1;
fakeTheme.Name = "Тема1";
return new List<Theme>() { fakeTheme };
}
示例9: BuildLink
public ActionLink BuildLink(Theme theme)
{
RouteValueDictionary routeValueDictionary = new RouteValueDictionary();
routeValueDictionary.Add("id", theme.Id);
ActionLink actionLink = new ActionLink("Play", "Training", routeValueDictionary);
return actionLink;
}
示例10: MenuItem
public MenuItem(Theme theme, TextFormat font, float x, float y, float width, float height, Menu parentMenu, string text, string extraData)
: base(theme, font, x, y, width, height)
{
this.parentMenu = parentMenu;
this.Text = text;
this.extraData = extraData;
}
示例11: UpdateTheme
internal static void UpdateTheme(ResourceDictionary resourceDictionary, Theme theme)
{
ResourceDictionary brushResourceDictionary = resourceDictionary.FindDictionary(BrushDictionaryUri.ToString());
if (brushResourceDictionary != null)
{
if (theme == Theme.Dark)
{
brushResourceDictionary.ReplaceDictionary(LightColorDictionaryUri, DarkColorDictionaryUri);
}
else
{
brushResourceDictionary.ReplaceDictionary(DarkColorDictionaryUri, LightColorDictionaryUri);
}
}
else
{
if (theme == Theme.Dark)
{
resourceDictionary.MergedDictionaries.Add(
new ResourceDictionary()
{
Source = DarkColorDictionaryUri
});
}
else
{
resourceDictionary.MergedDictionaries.Add(
new ResourceDictionary()
{
Source = LightColorDictionaryUri
});
}
}
}
示例12: Initialize
protected override void Initialize(System.Web.Routing.RequestContext requestContext) {
base.Initialize(requestContext);
HttpContext ctx = System.Web.HttpContext.Current;
ViewBag.year = UDF.GetYearCookie(ctx);
ViewBag.make = UDF.GetMakeCookie(ctx);
ViewBag.model = UDF.GetModelCookie(ctx);
ViewBag.style = UDF.GetStyleCookie(ctx);
ViewBag.vehicleID = UDF.GetVehicleCookie(ctx);
// Get the theme ID
int themeID = new Theme().getTheme(ctx);
ViewBag.themeID = themeID;
if (themeID > 0) {
// if there is an active theme, get the files
string cname = this.ControllerContext.Controller.ToString();
Dictionary<int, List<ThemeFile>> themefiles = new Theme().getFiles(ctx,UDF.GetControllerName(cname));
ViewBag.themefiles = themefiles;
}
// We're gonna dump our Customer Session object out
Customer customer = new Customer();
customer.GetFromStorage(ctx);
Settings settings = new Settings();
ViewBag.settings = settings;
ViewBag.customer = customer;
}
示例13: ChangeTheme
public static void ChangeTheme(ResourceDictionary r, Accent accent, Theme theme)
{
ThemeIsDark = (theme == Theme.Dark);
var themeResource = (theme == Theme.Light) ? LightResource : DarkResource;
Util.ApplyResourceDictionary(themeResource, r);
Util.ApplyResourceDictionary(accent.Resources, r);
}
示例14: Create
public ActionResult Create(int stageId, CreateThemeModel model)
{
try
{
Theme theme = new Theme
{
CourseRef = model.CourseId == Constants.NoCourseId ? (int?)null : model.CourseId,
StageRef = model.StageId,
ThemeTypeRef = model.ThemeTypeId,
Name = model.ThemeName
};
AddValidationErrorsToModelState(Validator.ValidateTheme(theme).Errors);
if (ModelState.IsValid)
{
Storage.AddTheme(theme);
return RedirectToAction("Index", new { StageId = model.StageId });
}
else
{
SaveValidationErrors();
return RedirectToAction("Create");
}
}
catch (Exception e)
{
throw e;
}
}
示例15: CreateTheme
public long CreateTheme(string bgColor, string fColor, string hColor, string mColor, int userId)
{
long themeId = 0;
string result = string.Empty;
try
{
Theme theme = new Theme()
{
UserId = userId,
BackgroundColor = System.Drawing.ColorTranslator.FromHtml(String.Format("{0}", bgColor)),
HighlightColor = System.Drawing.ColorTranslator.FromHtml(String.Format("{0}", hColor)),
FontColor = System.Drawing.ColorTranslator.FromHtml(String.Format("{0}", fColor)),
MagnificationColor = System.Drawing.ColorTranslator.FromHtml(String.Format("{0}", mColor))
};
result = OBSDataSource.CreateTheme(theme, out themeId);
if (string.IsNullOrEmpty(result))
{
return themeId;
}
}
catch (Exception ex)
{
ExceptionLogger.LogException(ex, "AccountController.CreateTheme");
}
return 0;
}