Example #1
0
        internal void SaveStatusUpdate(String statusContent, int range)
        {
            if (!_userSession.LoggedIn)
            {
                // _view.Message("Chưa đăng nhập");
                return;
            }
            int accountID;
            int senderID;

            senderID  = _userSession.CurrentUser.AccountID;
            accountID = _webContext.AccountID;
            if (accountID <= 0)
            {
                accountID = senderID;
            }

            StatusUpdate status;

            status                   = new StatusUpdate();
            status.AccountID         = accountID;
            status.SenderID          = senderID;
            status.Status            = statusContent;
            status.VisibilityLevelID = range;

            IStatusUpdateService _statusUpdateService;

            _statusUpdateService = new StatusUpdateService();
            _statusUpdateService.SaveStatusUpdate(status);
            LogUtil.Logger.Writeln("SaveStatusUpdate: " + statusContent);
            _view.LoadStatus(GetStatusToShow(account));
        }
Example #2
0
        //}

        internal void SaveStatusUpdate(String statusContent, int range)
        {
            if (!_userSession.LoggedIn)
            {
                _view.Message("Chưa đăng nhập");
                return;
            }
            int accountID;
            int senderID;

            senderID  = _userSession.CurrentUser.AccountID;
            accountID = _webContext.AccountID;
            bool IsAccount = true;

            if (accountID != senderID)
            {
                IsAccount = false;
            }
            if (accountID <= 0)
            {
                accountID = senderID;
            }

            StatusUpdate status;

            status                   = new StatusUpdate();
            status.AccountID         = accountID;
            status.SenderID          = senderID;
            status.Status            = statusContent;
            status.VisibilityLevelID = range;

            IStatusUpdateService _statusUpdateService;

            _statusUpdateService = new StatusUpdateService();
            _statusUpdateService.SaveStatusUpdate(status);
            _view.LoadAlert(_alertService.GetAlerts(senderID, accountID), _statusUpdateService.GetStatusUpdateByID(_userSession.CurrentUser, _accountService.GetAccountByAccountID(accountID), IsAccount));
        }
 public SearchViewModel()
 {
     SearchProviders = new ObservableCollection<ISearchProvider>();
     Results = new StatusUpdateService();
     Title = "Search";
 }
        public MahTweetsBuilder(ComposablePartCatalog catalog)
        {
            Catalog = catalog;

            Assembly currentAssembly = Assembly.GetExecutingAssembly();
            Assembly coreAssembly = typeof (IEventAggregator).Assembly;

            // defaults - find interfaces and concrete types and marry them up
            this.RegisterAssemblyTypes(currentAssembly, coreAssembly)
                .AsImplementedInterfaces();

            this.RegisterType<AccountSettingsProvider>()
                .As<IAccountSettingsProvider>()
                .SingleInstance();

            this.RegisterType<ColumnsSettingsProvider>()
                .As<IColumnsSettingsProvider>()
                .SingleInstance();

            this.RegisterType<ApplicationSettingsProvider>()
                .As<IApplicationSettingsProvider>()
                .Exported(x => x.As<IApplicationSettingsProvider>()) // make this part visible to MEF components
                .SingleInstance();

            this.RegisterType<PluginSettingsProvider>()
                .As<IPluginSettingsProvider>()
                .Exported(x => x.As<IPluginSettingsProvider>())
                .SingleInstance();

            this.RegisterType<XmlSettingsProvider>()
                .As<ISettingsProvider>()
                .SingleInstance();

            this.RegisterType<EventAggregator>()
                .As<IEventAggregator>()
                .Exported(x => x.As<IEventAggregator>()) // make this part visible to MEF components
                .SingleInstance();

            this.RegisterType<PluginRepository>()
                .As<IPluginRepository>()
                .Exported(x => x.As<IPluginRepository>())
                .SingleInstance();

            this.RegisterType<LongUrlPleaseService>()
                .As<IUrlExpandService>()
                .SingleInstance();

            this.RegisterType<GlobalExcludeSettingProvider>()
                .As<IGlobalExcludeSettings>()
                .SingleInstance();

            this.RegisterType<GlobalExcludeSettingProvider>()
                .As<IGlobalExcludeSettings>()
                .SingleInstance();

            this.RegisterType<AcronymSettingsProvider>()
                .As<IAcronymSettingsProvider>()
                .SingleInstance();

            this.RegisterType<AdditonalSmartsSettingsProvider>()
                 .As<IAdditonalSmartsSettingsProvider>()
                 .SingleInstance();

            this.RegisterType<ManualLongUrlRetrieverService>()
                .As<IManualLongUrlRetrieverService>()
                .InstancePerDependency();

            this.RegisterType<Storage>()
                .As<IStorage>()
                .SingleInstance();

            this.RegisterType<TextProcessorEngine>()
                .As<ITextProcessorEngine>()
                .SingleInstance();

            this.RegisterType<CurrentVersion>()
                .As<ICurrentVersionCheck>()
                .SingleInstance();

            this.RegisterType<AutoNotifyPropertyChangedInterceptor>();

            this.RegisterAssemblyTypes(coreAssembly)
                .Where(t => t.Name.EndsWith("ViewModel"))
                .EnableClassInterceptors()
                .InterceptedBy(typeof (AutoNotifyPropertyChangedInterceptor));

            this.RegisterAssemblyTypes(currentAssembly)
                .Where(t => t.Name.EndsWith("ViewModel"))
                .EnableClassInterceptors()
                .InterceptedBy(typeof (AutoNotifyPropertyChangedInterceptor));

            this.RegisterType<AppViewModel>()
                .SingleInstance();

            this.RegisterType<MainViewModel>()
                .As<IMainViewModel>()
                .SingleInstance()
                .EnableClassInterceptors()
                .InterceptedBy(typeof (AutoNotifyPropertyChangedInterceptor))
                .OnActivated(a =>
                                 {
                                     var viewModel = a.Instance;
                                     // commands that are not dependent on external members
                                     viewModel.AddColumnCommand = new DelegateCommand(viewModel.CreateBlankStream);
                                     viewModel.SearchCommand = new DelegateCommand(viewModel.CreateNewSearch);
                                     viewModel.RefreshCommand = new DelegateCommand(viewModel.Refresh);
                                     viewModel.ClearAllCommand = new DelegateCommand(viewModel.ClearAll);
                                     viewModel.AboutCommand = new DelegateCommand(viewModel.ShowAbout);
                                     viewModel.SetupCommand = new DelegateCommand(viewModel.ShowSetup);
                                     viewModel.NewUpdateCommand = new DelegateCommand(viewModel.NewUpdate);
                                     // are we not using the commands here
                                     viewModel.CloseCommand = new DelegateCommand(viewModel.Close);
                                     viewModel.SendMessageCommand =
                                         new SendMessageCommand((obj, src) => viewModel.SendMessage(obj));
                                 });

            this.RegisterType<StreamViewModel>()
                .EnableClassInterceptors()
                .InterceptedBy(typeof (AutoNotifyPropertyChangedInterceptor))
                .OnActivated(a =>
                                 {
                                     var viewmodel = a.Instance;
                                     viewmodel.ClearCommand =
                                         new DelegateCommand(() => viewmodel.ClearBeforeDate(DateTime.Now));
                                 });


            this.RegisterType<SetupViewModel>()
                .SingleInstance();

            this.RegisterType<ResourcesViewModel>()
                .As<IResourcesViewModel>()
                .SingleInstance();

            this.RegisterType<HashtagService>()
                .AsImplementedInterfaces()
                .SingleInstance();

            this.RegisterType<ContactService>()
                .AsImplementedInterfaces()
                .Exported(x => x.As<IContactsRepository>()) // make this part visible to MEF components
                .SingleInstance();

            this.RegisterType<PluginLoader>()
                .As<IPluginLoader>()
                .SingleInstance();

            // StatusUpdateManager defined under two interfaces
            // one for plugins to use, the other for application to use
            var statusManager = new StatusUpdateService();

            this.RegisterType<StatusUpdateService>()
                .AsImplementedInterfaces()
                .Exported(x => x.As<IStatusUpdateRepository>()) // make this part visible to MEF components
                .SingleInstance();

            // register MEF plugins for consumption
             this.RegisterComposablePartCatalog(catalog);

            // default behaviour - just use the damn window
            this.RegisterType<MainWindow>()
                .As<MainWindow>()
                .As<IShell>()
                .SingleInstance();

            this.RegisterInstance(Application.Current.Resources)
                .ExternallyOwned()
                .SingleInstance();

            // MahTweets Scripting
            // order is important

            this.RegisterType<ScriptingManager>()
                .As<IScriptingManager>()
                .SingleInstance();

            this.RegisterType<ScriptingConfiguration>()
                .As<IScriptingConfiguration>()
                .SingleInstance();

            this.RegisterType<ScriptingHelper>()
                .As<IScriptingHelper>()
                .SingleInstance();

            this.RegisterType<ScriptingUIHelper>()
                .As<IScriptingUIHelper>()
                .SingleInstance();

            this.RegisterType<DynamicLanguagesScriptEngine>()
                .As<IScriptingEngine>()
                .SingleInstance();

            this.RegisterType<ScriptLibrarian>()
                .As<IScriptingLibrarian>()
                .SingleInstance();
        }
Example #5
0
 public InvitationsController(StatusUpdateService service)
 {
     _service = service;
 }