Exemple #1
0
        /// <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();
        }
Exemple #2
0
        /// <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();
            }
        }
Exemple #3
0
 /// <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;
 }