public static IDesktopWallpaper CreateIDesktopWallpaper() { var d = new DesktopWallpaper(); var i = (IDesktopWallpaper)d; return(i); }
// GET: Cart public ActionResult Index() { int totalCount = 0; decimal totalPrice = 0; List <int> desktopWallpaperIds = (List <int>)Session["desktopWallpaperIds"]; /*因为页面需要metadata,所以不可设为null*/ List <DesktopWallpaper> desktopWallpapers = new List <DesktopWallpaper> { }; if (desktopWallpaperIds != null) { foreach (int desktopWallpaperId in desktopWallpaperIds) { DesktopWallpaper desktopWallpaper = _context.DesktopWallpapers.Where(d => d.DesktopWallpaperId == desktopWallpaperId).First(); if (desktopWallpaper != null) { desktopWallpapers.Add(desktopWallpaper); totalCount++; totalPrice += desktopWallpaper.Price; } } } CartIndexViewModel cartIndexViewModel = new CartIndexViewModel { DesktopWallpapers = desktopWallpapers, TotalCount = totalCount, TotalPrice = totalPrice }; return(View(cartIndexViewModel)); }
public override void Execute(CommandParameter commandParameter, IFeedbackFactory feedbackFactory, IClientInfo clientInfo) { commandParameter.InitializeProperties(this); DesktopWallpaper.Set(WallpaperUrl, DesktopWallpaperStyle); feedbackFactory.Succeeded(); }
private void Begin() { Configuration.UserAgent = typeof(App).Assembly.GetName().Name + "/" + typeof(App).Assembly.GetName().Version.ToString() + " (https://github.com/Paszt/weather-frog)"; Configuration.ApiKey = My.Settings.WeatherApiKey; notifyIcon = new() { Icon = Utilities.CreateIcon(16, 16, (ImageSource)FindResource("FrogHeadDrawingImage")), DataContext = Current, ContextMenu = (System.Windows.Controls.ContextMenu)FindResource("NotifyIconMenu"), TrayPopup = new TaskbarBalloon(), //ToolTip = new Resources.TaskbarBalloon(), }; // Add bindings to notifyicon MultiBinding toolTipMultiBinding = new() { StringFormat = "Weather Frog \n{0}° {1}\n{2}\nLast updated: {3}", Bindings = { new Binding("Forecast.CurrentWeather.Temp") { Source = this }, new Binding("Forecast.CurrentWeather.Condition.Text") { Source = this }, new Binding("Forecast.Location.DisplayName") { Source = this }, new Binding(nameof(LastUpdatedTimeString)) { Source = this }, } }; BindingOperations.SetBinding(notifyIcon, TaskbarIcon.ToolTipTextProperty, toolTipMultiBinding); Locations = My.Settings.Locations; SystemEvents sysEvents = new(); sysEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged; sysEvents.ResumedFromSuspension += SystemEvents_ResumedFromSuspension; sysEvents.AboutToSuspend += SystemEvents_AboutToSuspend; if (My.Settings.UpdateDesktop) { desktopWallpaper = DesktopWallpaper.FromSystemParameters(); } updateWeatherTimer = new(e => UpdateWeather(), null, TimeSpan.Zero, UpdateWeatherInterval); }
static void Main(string[] args) { try { string wallpaperDirectory = GetWallpaperDirectory(); if (string.IsNullOrWhiteSpace(wallpaperDirectory)) { throw new Exception("壁紙格納フォルダの取得に失敗しました。"); } string[] fileNames = Directory.GetFiles(wallpaperDirectory); string[] imageFileNames = ExcludeFileUnusableInWallpaper(fileNames); if (imageFileNames.Length == 0) { throw new Exception("壁紙に使えるファイルが見つかりませんでした。"); } //現在設定されている壁紙を取得する。 DesktopWallpaper wallpaper = new DesktopWallpaper(); uint monitorCount = wallpaper.GetMonitorDevicePathCount(); string lastMonitorId = wallpaper.GetMonitorDevicePathAt(monitorCount - 1); string currentWallpaperFilename = wallpaper.GetWallpaper(lastMonitorId); //現在の壁紙が何番目か調べる。 int currentWallpaperNum = Array.IndexOf(imageFileNames, currentWallpaperFilename); //壁紙を変更する int wallpaperFileIndex = currentWallpaperNum; for (int i = 0; i < monitorCount; i++) { wallpaperFileIndex = GetNextIndex(wallpaperFileIndex, imageFileNames.Length); string monitorId = wallpaper.GetMonitorDevicePathAt((uint)i); wallpaper.SetWallpaper(monitorId, imageFileNames[wallpaperFileIndex]); } //正常終了したらログファイルを削除する。 File.Delete(LogFilePath); } catch (Exception ex) { //ログ出力 List <string> logMessage = new List <string>(); logMessage.Add(DateTime.Now.ToLongDateString()); logMessage.Add(DateTime.Now.ToLongTimeString()); logMessage.Add(ex.ToString()); File.WriteAllLines(LogFilePath, logMessage.ToArray()); //設定ファイル削除 File.Delete(SettingFilePath); } }
public IllustrationViewModel() { desktopWallpaper = new(Width, Height, WorkArea) { DrawTaskbar = true }; Forecast = new() { Location = new() { Name = "Monkeys Eyebrow", Region = "Kentucky" }, CurrentWeather = new() { TempF = 67, TempC = 20, FeelsLikeF = 65, FeelsLikeC = 19, IsDay = true, Cloud = 0, Condition = new() { Code = 1087, Text = "Thundery outbreaks possible" } }, Days = new() { Forecastdays = new() { new() { WeatherData = new() { DailyWillItSnow = false, DailyWillItRain = true, DailyChanceOfRain = 88, } } } }, }; //CreateWallpaper(); }
public ActionResult ShowItem(int desktopWallpaperId) { string currentUserId = User.Identity.GetUserId(); // select子句的内容只是为了方便调试,不管select什么,都和业务逻辑无关。业务逻辑只看重聚合函数的结果。 int criterion = (from transaction in _context.Transactions join transactionDetails in _context.TransactionDetails on transaction.TransactionId equals transactionDetails.TransactionId where transactionDetails.UserId == currentUserId && transactionDetails.DesktopWallpaperId == desktopWallpaperId && transaction.Completeness == true select transactionDetails).Count(); if (criterion == 0) { return(View("Error", new HandleErrorInfo(new Exception("You have not bought this item yet."), ControllerContext.RouteData.Values["controller"].ToString(), ControllerContext.RouteData.Values["action"].ToString()) )); } else { DesktopWallpaper desktopWallpaper = _context.DesktopWallpapers.Where(d => d.DesktopWallpaperId == desktopWallpaperId).First(); return(View(desktopWallpaper)); } }
private static void FindWallpaperMethod() { DesktopWallpaper.GetWallpaper(); }