public TweetToolViewModel(Settings settings)
 {
     if (settings == null) { throw new ArgumentNullException(); }
     settings_ = settings;
 }
 public SettingsViewModel(Settings settings)
 {
     if (settings == null) { throw new ArgumentNullException("settings"); }
     Settings = settings;
 }
        public void Initialize()
        {
            var dispatcher = new WPFDispatcher(Application.Current.Dispatcher);

            // Initialize Settings
            var settingsImpl = new SettingsImpl((string)null);
            settings_ = new Settings(settingsImpl, dispatcher);

            // Load settings from file if it exists
            if (File.Exists(PluginInfo.SettingsFilePath)) {
                try {
                    using (var fs = new FileStream(PluginInfo.SettingsFilePath, FileMode.Open, FileAccess.Read, FileShare.Read)) {
                        var serializer = new DataContractSettingsSerializer();
                        serializer.Deserialize(fs, settingsImpl);
                    }
                }
                catch (Exception ex) {
                    Logger.Error("Failed to load settings from file.", ex);
                    if (ex.IsCritical()) { throw; }
                }
            }

            // Initialize settings auto expoter
            expoter_ = new SettingsAutoExpoter(
                PluginInfo.SettingsFilePath, PluginInfo.SettingsFilePath + ".temp",
                settingsImpl, new DataContractSettingsSerializer());
        }