コード例 #1
0
ファイル: ShellViewModel.cs プロジェクト: Soinou/MeliMelo
        /// <summary>
        /// Creates a new ShellViewModel
        /// </summary>
        public ShellViewModel()
        {
            configuration_ = new Configuration();
            task_ = new WarmerTask(configuration_);
            tray_ = new TrayIcon("MeliMelo.Warmer", Warmer.Properties.Resources.Icon);
            main_open_ = false;

            switch (CultureInfo.CurrentUICulture.TwoLetterISOLanguageName)
            {
                case "fr":
                    locale_ = new FrenchLocale();
                    break;

                default:
                    locale_ = new EnglishLocale();
                    break;
            }

            about_ = locale_["Tray.About"];
            show_ = locale_["Tray.Show"];
            exit_ = locale_["Tray.Exit"];

            tray_.AddItem(show_);
            tray_.AddSeparator();
            tray_.AddItem(about_);
            tray_.AddSeparator();
            tray_.AddItem(exit_);

            tray_.ItemClicked += TrayIconItemClicked;
            tray_.DoubleClicked += TrayIconDoubleClicked;

            tray_.Show();
        }
コード例 #2
0
ファイル: WarmerTask.cs プロジェクト: Soinou/MeliMelo
        /// <summary>
        /// Creates a new WarmerTask
        /// </summary>
        /// <param name="configuration">Configuration</param>
        public WarmerTask(Configuration configuration)
        {
            helper_ = new TemperatureHelper();
            configuration_ = configuration;

            configuration_.TemperatureChanged += OnTemperatureChanged;
            configuration_.StateChanged += OnStateChanged;
            configuration_.IntervalChanged += OnIntervalChanged;

            Interval = configuration_.Interval;

            if (configuration.State)
            {
                Start();
            }
        }
コード例 #3
0
ファイル: MainViewModel.cs プロジェクト: Soinou/MeliMelo
 /// <summary>
 /// Creates a new MainViewModel
 /// </summary>
 /// <param name="configuration">Configuration</param>
 /// <param name="locale">Locale</param>
 public MainViewModel(Configuration configuration, ILocale locale)
 {
     configuration_ = configuration;
     locale_ = locale;
 }