Ejemplo n.º 1
0
        public Guid Create(Guid userId, Location location, string description)
        {
            Guard.AgainstNullOrEmpty(description);
            Guard.AgainstNullOrEmpty(userId);


            // todo: syntactic validation of the description
            // is it positive
            // does it contain enough meaning

            // todo: ValidateLocation

            var propertyId = Guid.NewGuid();

            _propertiesRepository.Add(new PropertyDao
            {
                Location = Mapper.Map <LocationDao>(location),

                Description = description,
                Id          = propertyId,
                Status      = (byte)PropertyStatus.Available,
                UserId      = userId
            });

            _propertiesRepository.Save();

            _eventBus.Publish(new PropertyCreated(userId, propertyId));

            return(propertyId);
        }
Ejemplo n.º 2
0
        public MainForm(IFormOpener formManager, IMainFormPresenter presenter, MainFormStyler mainFormStyler, IPubSub pubsub, IPropertiesRepository propertiesRepository)
        {
            InitializeComponent();

            _mainFormStyler = mainFormStyler;
            _pubsub         = pubsub;
            RenderTheme();
            if (propertiesRepository.GetValue <bool>(Constants.AppProperties.UpdateSettings))
            {
                propertiesRepository.Upgrade();
                propertiesRepository.SetValue(Constants.AppProperties.UpdateSettings, false);
                propertiesRepository.Save();
            }

            _formManager = formManager;
            presenter.InitializePresenter(new
            {
                MainForm = this,
                PubSub   = _pubsub
            });

            var selectedPath = propertiesRepository.GetValue <string>(Constants.AppProperties.SelectedPath);

            if (!string.IsNullOrEmpty(selectedPath))
            {
                Presenter.PopulateTreeView(selectedPath);
            }

            _propertiesRepository = propertiesRepository;
        }
Ejemplo n.º 3
0
 private void openFolderToolStripMenuItem_Click(object sender, System.EventArgs e)
 {
     if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
     {
         queryTabControl.TabPages.Clear();
         Presenter.PopulateTreeView(folderBrowserDialog1.SelectedPath);
         _propertiesRepository.SetValue(Constants.AppProperties.SelectedPath, folderBrowserDialog1.SelectedPath);
         _propertiesRepository.Save();
     }
 }
        public void SavePreferences(AppPreferences preferences)
        {
            if (!_propertiesRepository.GetValue <string>(Constants.AppProperties.TransactionCachePath).Equals(preferences.TransactionCacheLocation, System.StringComparison.InvariantCultureIgnoreCase))
            {
                _propertiesRepository.SetValue(Constants.AppProperties.TransactionCachePath, preferences.TransactionCacheLocation);
                _propertiesRepository.Save();
                _mainFormPresenter.InitializeTransactionCache();
            }

            if (_propertiesRepository.GetValue <bool>(Constants.AppProperties.UseDarkTheme) != preferences.UseDarkTheme)
            {
                _propertiesRepository.SetValue(Constants.AppProperties.UseDarkTheme, preferences.UseDarkTheme);
                _propertiesRepository.Save();
                _pubsub.Publish(this, new PubSubEventArgs {
                    Data = preferences.UseDarkTheme
                }, Constants.SubscriptionTypes.THEME_CHANGE);
                _view.RenderTheme();
            }
        }