/// <summary> /// OnCreate /// </summary> /// <param name="savedInstanceState"></param> protected async override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); progress = ProgressDialog.Show(this, "Loading", "Please Wait...", true); //propertyManager = TinyIoC.TinyIoCContainer.Current.Resolve<IPropertyMangager>(); propertyManager = Mvx.GetSingleton <IPropertyMangager>(); // propertyManager = new PropertyMangager(); int listingID = Intent.GetIntExtra("ListingID", 0); if (listingID > 0) { propertydetail = await propertyManager.GetItemAsync(listingID.ToString()); } SetContentView(Resource.Layout.PropertyDetailView); if (propertydetail != null) { BindFields(); } if (CrossConnectivity.Current.IsConnected) { SQLLiteHelper.InsertPropertyDetails(propertydetail); } if (progress != null) { progress.Hide(); } }
private async void LoginButtonPressed() { LoggingIn = true; LoginError = null; var settings = ClientSettings.Instance; settings.SaveLogin = SaveLogin; if (SaveLogin) { settings.UserName = LoginName; settings.Password = Password; settings.Host = Host; } var apiManager = Mvx.GetSingleton <IApiManager>(); if (CheckError(await apiManager.LogIn(LoginName, Password))) { return; } var response = await apiManager.QueryApi("character-list.php"); if (CheckError(response)) { return; } LoggingIn = false; Characters = response["characters"].Values <string>().Select(x => new CharacterListItem { Name = x }).ToList(); }
private void SetSearchEngine() { switch (Engine) { case SearchType.Audible: _searchService = Mvx.GetSingleton <AudibleSearchService>(); break; case SearchType.Audiobookstore: _searchService = Mvx.GetSingleton <AudiobookstoreSearchService>(); break; case SearchType.GraphicAudio: _searchService = Mvx.GetSingleton <GraphicAudioSearchService>(); break; case SearchType.BigFinish: _searchService = Mvx.GetSingleton <BigFinishSearchService>(); break; case SearchType.GoodReads: _searchService = Mvx.GetSingleton <GoodReadsSearchService>(); break; } }
public MainView() { var vmLoader = Mvx.GetSingleton <NavigationService>(); Mvx.GetSingleton <IMessageManager>().CharacterMessageReceived += OnMessage; ChatViewModel = vmLoader.Load <ChatViewModel>(); CharacterLists = vmLoader.Load <ListsViewModel>(); EventsViewModel = vmLoader.Load <EventsViewModel>(); PeopleViewModel = vmLoader.Load <ListPeopleViewModel>(); IsHomeTabShown = ChatViewModel.SelectedTab == ChatViewModel.HomeTab; EventsViewModel.Events.CollectionChanged += (sender, args) => { if (args.Action != NotifyCollectionChangedAction.Add) { return; } foreach (EventViewModel evm in args.NewItems) { OnEvent(evm); } }; var characterManager = Mvx.GetSingleton <ICharacterManager>(); var channelManager = Mvx.GetSingleton <IChannelManager>(); ChatViewModel.SelectedTabChanged += () => { IsHomeTabShown = ChatViewModel.SelectedTab == ChatViewModel.HomeTab; var channelTab = ChatViewModel.SelectedTab as ChannelConversationViewModel; ChannelMembers = channelTab != null ? new ChannelMembersViewModel(channelManager, characterManager, channelTab.Channel) : null; if (!IsHomeTabShown) { MessagesView.ViewModel = (ConversationViewModel)ChatViewModel.SelectedTab; } }; InitializeComponent(); DataContextChanged += OnViewModelSet; }
private void ApplyListColors() { IEnumerable <CharacterList> lists = Character.CharacterLists.ToList(); if (ChannelMember != null && ChannelMember.Member.Rank > Channel.RankEnum.User) { lists = lists.Concat(Mvx.GetSingleton <CharacterListProvider>().ChannelOps.SingletonEnumerable()); } var list = lists.OrderBy(x => x.SortingOrder).FirstOrDefault(); if (list != null) { var bytes = BitConverter.GetBytes(list.UnderlineColor); if (bytes[3] != 0) { nameRun.TextDecorations.Add(new TextDecoration(TextDecorationLocation.Underline, new Pen(new SolidColorBrush(Color.FromArgb(bytes[3], bytes[2], bytes[1], bytes[0])), 1.5), 0, 0, TextDecorationUnit.FontRecommended)); } else { nameRun.TextDecorations.Clear(); } bytes = BitConverter.GetBytes(list.TextColor); nameRun.Foreground = new SolidColorBrush(bytes[3] != 0 ? Color.FromArgb(bytes[3], bytes[2], bytes[1], bytes[0]) : MvxWpfColor.ToNativeColor(Character.GenderColor)); } }
private static async void HandleEvent(Event e) { var msgEvent = e as MessageEvent; if (uiHandlers != 0 || msgEvent == null || !settings.NotifyPrivate) { return; } var intent = Intents.Create <MainActivity>(); if (notificationCount == 0) { intent.PutExtra(NotificationsSenderKey, msgEvent.Message.Sender.Name); } var builder = new NotificationCompat.Builder(Application.Context).SetAutoCancel(true) .SetContentTitle(notificationCount > 0 ? Strings.Events_Message_TitleMany : string.Format(Strings.Events_Message_TitleOne, msgEvent.Message.Sender.Name)) .SetContentText(notificationCount > 0 ? Strings.Events_Message_TextMany : msgEvent.Message.Text) .SetSmallIcon(Resource.Drawable.icon) .SetContentIntent(PendingIntent.GetActivity(Application.Context, notificationId, intent, PendingIntentFlags.UpdateCurrent)) .SetLargeIcon(await Mvx.GetSingleton <IMvxImageCache <Bitmap> >().RequestImage(Helpers.GetAvatar(msgEvent.Message.Sender.Name))); if (settings.Vibrate) { builder.SetVibrate(new long[] { 500, 500 }); } Android.App.NotificationManager.FromContext(Application.Context).Notify(notificationId, builder.Build()); ++notificationCount; }
public GameViewModel(IGameSettings gameSettings, IQuestsManager questsManager, IDialogService dialogService) { _gameSettings = gameSettings; _questsManager = questsManager; _dialogService = dialogService; _game = Mvx.GetSingleton <IGame>(); BoardViewModel = new BoardViewModel(Game.Info.BoardSize); BoardViewModel.BoardTapped += (s, e) => OnBoardTapped(e); BoardViewModel.IsTouchInputOffsetEnabled = gameSettings.Display.AddTouchInputOffset; // Set empty node (should be in the beginning of every gametree) as current node for board rendering RefreshBoard(Game.Controller.GameTree.LastNode); _uiConnector = new UiConnector(Game.Controller); _phaseStartHandlers = new Dictionary <GamePhaseType, Action <IGamePhase> >(); _phaseEndHandlers = new Dictionary <GamePhaseType, Action <IGamePhase> >(); SetupPhaseChangeHandlers(_phaseStartHandlers, _phaseEndHandlers); Game.Controller.RegisterConnector(_uiConnector); Game.Controller.GameEnded += (s, e) => OnGameEnded(e); Game.Controller.GameTree.LastNodeChanged += (s, e) => OnCurrentNodeChanged(e); Game.Controller.TurnPlayerChanged += (s, e) => OnTurnPlayerChanged(e); Game.Controller.GamePhaseChanged += (s, e) => OnGamePhaseChanged(e); ObserveDebuggingMessages(); }
public PropertyTableSource(List <Property> properties) { propertyCollection = properties; // propertyManager = new PropertyMangager(); //propertyManager = TinyIoC.TinyIoCContainer.Current.Resolve<IPropertyMangager>(); propertyManager = Mvx.GetSingleton <IPropertyMangager>(); }
public override void Initialize() { //Initializing NBitcoin's RNG RandomUtils.Random = new LynxSecureRandom(); //Register dependencies CreatableTypes() .EndingWith("Service") .AsInterfaces() .RegisterAsLazySingleton(); Mvx.RegisterSingleton <ITokenCryptoService <IToken> >(() => new TokenCryptoService <IToken>(Mvx.Resolve <IECCCryptoService>())); Mvx.RegisterSingleton(() => _dataService); string dbfile = _dataService.GetDatabaseFile(); Mvx.RegisterType <IMapper <Certificate> >(() => new ExternalElementMapper <Certificate>(dbfile)); Mvx.RegisterType <IMapper <Attribute> >(() => new AttributeMapper(dbfile, Mvx.Resolve <IMapper <Certificate> >())); Mvx.RegisterType <IMapper <ID> >(() => new IDMapper(dbfile, Mvx.Resolve <IMapper <Attribute> >())); //Configure the the eth node Mvx.GetSingleton <ILynxConfigurationService>().ConfigureEthNode(StaticRessources.FactoryContractAddress, StaticRessources.RpcEndpointUrl); //Register the dummy ContentService as a singleton, temp solution Mvx.RegisterSingleton <IContentService>(() => new DummyContentService()); RegisterAppStart <ViewModels.MainViewModel>(); Mvx.RegisterType <Requester>(() => new Requester(Mvx.Resolve <ITokenCryptoService <IToken> >(), Mvx.Resolve <IAccountService>(), Mvx.Resolve <ID>(), Mvx.Resolve <IIDFacade>(), Mvx.Resolve <IAttributeFacade>(), Mvx.Resolve <ICertificateFacade>())); Mvx.RegisterType <IReceiver>(() => new Receiver(Mvx.Resolve <ITokenCryptoService <IToken> >(), Mvx.Resolve <IAccountService>(), Mvx.Resolve <ID>(), Mvx.Resolve <IIDFacade>(), Mvx.Resolve <ICertificateFacade>())); }
public virtual void EnsureInitialized() { lock (LockObject) { if (_initialized) { return; } if (IsInitialisedTaskCompletionSource != null) { Mvx.Trace("EnsureInitialized has already been called so now waiting for completion"); IsInitialisedTaskCompletionSource.Task.Wait(); } else { IsInitialisedTaskCompletionSource = new TaskCompletionSource <bool>(); _setup.Initialize(); _initialized = true; if (_currentSplashScreen != null) { Mvx.Warning("Current splash screen not null during direct initialization - not sure this should ever happen!"); var dispatcher = Mvx.GetSingleton <IMvxMainThreadDispatcher>(); dispatcher.RequestMainThreadAction(() => { _currentSplashScreen?.InitializationComplete(); }); } IsInitialisedTaskCompletionSource.SetResult(true); } } }
private async void OnResuming(object sender, object e) { var suspension = Mvx.GetSingleton <IMvxSuspensionManager>() as MvxSuspensionManager; await Resume(suspension); await suspension.RestoreAsync(); }
private void OnCharacterSelected(CharacterListItem value) { Connecting = true; chatManager = Mvx.GetSingleton <IChatManager>(); chatManager.Connected += OnChatManagerConnected; chatManager.Connect(value.Name, Host); }
protected override void InitializeLastChance() { base.InitializeLastChance(); MvvmCross.Plugins.File.PluginLoader.Instance.EnsureLoaded(); MvvmCross.Plugins.DownloadCache.PluginLoader.Instance.EnsureLoaded(); Acr.Settings.Settings.InitRoaming(ApplicationContext.PackageName); Mvx.GetSingleton <IMvxTargetBindingFactoryRegistry>().RegisterCustomBindingFactory <TextView>("BBCode", view => new BBCodeBinding(view)); Mvx.ConstructAndRegisterSingleton <IMvxLocalFileImageLoader <Bitmap>, VectorFileImageLoader>(); }
/// <summary> /// Invoked when application execution is being suspended. Application state is saved /// without knowing whether the application will be terminated or resumed with the contents /// of memory still intact. /// </summary> /// <param name="sender">The source of the suspend request.</param> /// <param name="e">Details about the suspend request.</param> private async void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); var suspension = Mvx.GetSingleton<IMvxSuspensionManager>() as MvxSuspensionManager; await suspension.SaveAsync(); //TODO: Save application state and stop any background activity deferral.Complete(); }
public ChannelMemberViewModel(ICharacterManager characterManager, IChannelManager channelManager, Channel channel, Channel.Member member) { this.characterManager = characterManager; this.channel = channel; Member = member; Character = Mvx.GetSingleton <CharacterViewModels>().GetCharacterViewModel(member.Character); ChannelKickCommand = new MvxCommand(() => channelManager.KickUser(channel, member.Character.Name)); ChannelBanCommand = new MvxCommand(() => channelManager.SetUserBanned(channel, member.Character.Name, true)); ChannelToggleOpCommand = new MvxCommand(() => channelManager.SetUserOp(channel, member.Character.Name, Member.Rank == Channel.RankEnum.User)); }
public static void ImportLocal() { var clientSettings = ClientSettings.Instance; if (!Directory.Exists(slimCatLocal)) { return; } var configFile = Directory.EnumerateFiles(slimCatLocal, "*.config", SearchOption.AllDirectories).OrderByDescending(File.GetLastWriteTime).FirstOrDefault(); if (configFile == null) { return; } var config = XDocument.Parse(File.ReadAllText(configFile)).Root?.Element("userSettings")?.Element("slimCat.Properties.Settings")?.Descendants().ToList(); if (config == null) { return; } clientSettings.UserName = config.FirstOrDefault(x => (string)x.Attribute("name") == "UserName")?.Element("value")?.Value; clientSettings.Password = config.FirstOrDefault(x => (string)x.Attribute("name") == "Password")?.Element("value")?.Value; clientSettings.Host = config.FirstOrDefault(x => (string)x.Attribute("name") == "Host")?.Element("value")?.Value; clientSettings.SaveLogin = true; if (CanImportRoaming()) { var provider = Mvx.GetSingleton <CharacterListProvider>(); var settings = XDocument.Parse(File.ReadAllText(Path.Combine(slimCatRoaming, "!Defaults", "Global", "!settings.xml"))).Root; if (settings == null) { return; } TrySetBool(settings.Element("HideFriendsFromSearchResults"), b => provider.Friends.HideInSearch = b); var customLists = provider.CustomLists.ToList(); var interested = settings.Element("Interested"); if (interested != null) { customLists[1].Characters = new HashSet <string>(interested.Elements("character").Select(x => x.Value).Distinct()); } var interestColoring = settings.Element("AllowOfInterestColoring"); if (interestColoring != null && !bool.Parse(interestColoring.Value)) { customLists[1].UnderlineColor = 0; } var notInterested = settings.Element("NotInterested"); if (notInterested != null) { customLists[1].Characters = new HashSet <string>(notInterested.Elements("character").Select(x => x.Value).Distinct()); } provider.SaveCustomLists(customLists); } }
private async void OnSuspending(object sender, SuspendingEventArgs e) { var deferral = e.SuspendingOperation.GetDeferral(); var suspension = Mvx.GetSingleton <IMvxSuspensionManager>() as MvxSuspensionManager; await Suspend(suspension); await suspension.SaveAsync(); deferral.Complete(); }
private void OnCommandReceived(ServerCommand serverCommand) { if (serverCommand.Type != ServerCommandType.FKS) { return; } chatManager.CommandReceived -= OnCommandReceived; var cache = Mvx.GetSingleton <CharacterViewModels>(); Characters = serverCommand.Payload["characters"].Values <string>().Select(x => characterManager.GetCharacter(x)).Select(x => cache.GetCharacterViewModel(x)).ToList(); Pending = false; }
/// <summary> /// Ensures the platform specific version is loaded /// </summary> public void EnsureLoaded() { Mvx.CallbackWhenRegistered <IMvxFileStore>( () => Mvx.CallbackWhenRegistered <IMvxUserInteraction>(() => { Mvx.ConstructAndRegisterSingleton <IFeedbackDataService, FeedbackDataService>(); var manager = Mvx.Resolve <IMvxPluginManager>(); manager.EnsurePlatformAdaptionLoaded <PluginLoader>(); ((MvxFeedbackDialog)Mvx.GetSingleton <IMvxFeedbackDialog>()).SetConfiguration(_configuration); })); }
/// <summary> /// Constructor /// </summary> /// <param name="context"></param> /// <param name="layoutResourceId"></param> /// <param name="listingCollection"></param> public PropertyListingsManagerAdapter(Context context, int layoutResourceId, List <Property> listingCollection) { #region Commented //propertyManager = TinyIoC.TinyIoCContainer.Current.Resolve<IPropertyMangager>(); //propertyManager = new PropertyMangager(); #endregion this.context = context; this.layoutResourceId = layoutResourceId; this.propertyCollection = listingCollection; propertyManager = Mvx.GetSingleton <IPropertyMangager>(); }
private void ShowLogs(object sender, RoutedEventArgs e) { var vm = Mvx.IocConstruct <LogsViewModel>(); if (ViewModel is ChannelConversationViewModel channel) { vm.SetChannel(channel.Channel); } else { vm.SetCharacter(((CharacterConversationViewModel)ViewModel).Character.Character); } Mvx.GetSingleton <IMvxNavigationService>().Navigate(vm); }
public HomeViewModel(ISellerAuthService authService , ISellerOrderService sellerOrderService , IDialogService dialogService) : this(sellerOrderService, authService) { this._authService = authService; this._sellerOrderService = sellerOrderService; this._dialogService = dialogService; this._tokenClickOrder = Mvx.GetSingleton <IMvxMessenger>() .Subscribe <ClickOnFinishOrderMessage>(this.OnFinishOrder, MvxReference.Strong); this._sellerOrderService.OnNewPayedOrder += _sellerOrderService_OnNewPayedOrder; }
protected virtual IMvxAndroidCurrentTopActivity CreateAndroidCurrentTopActivity() { var mvxApplication = MvxAndroidApplication.Instance; if (mvxApplication != null) { var activityLifecycleCallbacksManager = new MvxApplicationCallbacksCurrentTopActivity(); mvxApplication.RegisterActivityLifecycleCallbacks(activityLifecycleCallbacksManager); return(activityLifecycleCallbacksManager); } else { return(new MvxLifecycleMonitorCurrentTopActivity(Mvx.GetSingleton <IMvxAndroidActivityLifetimeListener>())); } }
private void BtnCloseStack_OnPrimaryATcionTriggered(object sender, EventArgs e) { var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate; var presenter = Mvx.GetSingleton <IMvxTvosModalHost>() as MvxTvosViewPresenter; if (appDelegate.Window.RootViewController.PresentedViewController != null) { appDelegate.Window.RootViewController.DismissViewController(true, null); presenter.NativeModalViewControllerDisappearedOnItsOwn(); } else { presenter.MasterNavigationController.PopToRootViewController(true); } }
/// <summary> /// Get the items from teh sqllite db /// </summary> /// <param name="skip"></param> /// <param name="take"></param> /// <param name="forceRefresh"></param> /// <returns></returns> public async Task <List <Property> > GetItemsAsync(int skip = 0, int take = 100, bool forceRefresh = false) { List <Property> listings = new List <Property>(); try { var propertyRepository = Mvx.GetSingleton <PropertyRepository>(); listings = await propertyRepository.RetrieveAllProperties(); } catch (Exception ex) { throw; } return(listings); }
/// <summary> /// Get property detail by id /// </summary> /// <param name="id"></param> /// <returns></returns> public async Task <PropertyDetail> GetItemAsync(string id) { PropertyDetail propertyDetail = new PropertyDetail(); try { var propertyRepository = Mvx.GetSingleton <PropertyRepository>(); propertyDetail = await propertyRepository.GetPropertyDetailById(Convert.ToInt32(id)); } catch (Exception ex) { throw; } return(propertyDetail); }
private void BtnCloseStack_TouchUpInside(object sender, EventArgs e) { var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate; var presenter = Mvx.GetSingleton <IMvxIosViewPresenter>() as MvxIosViewPresenter; if (appDelegate.Window.RootViewController.PresentedViewController != null) { appDelegate.Window.RootViewController.DismissViewController(true, null); presenter.CloseModalViewControllers(); } else { presenter.MasterNavigationController.PopToRootViewController(true); } }
/// <summary> /// OnCreate /// </summary> /// <param name="bundle"></param> protected async override void OnCreate(Bundle bundle) { SetUpIOC.SetupContainer(); if (!CrossConnectivity.Current.IsConnected) { Mvx.RegisterSingleton(new PropertyRepository(new SQLiteInfoMonodroid())); } base.OnCreate(bundle); propertyManager = Mvx.GetSingleton <IPropertyMangager>(); //propertyManager = new PropertyMangager(); SetContentView(Resource.Layout.PropertyViewMain); propertylisttingsView = FindViewById <ListView>(Resource.Id.PropertylisttingsView); propertylisttingsView.SetItemChecked(0, true); propertylisttingsView.ItemClick += ListtingsView_ItemClick; }
public GameCreationViewModel(IGameSettings gameSettings) { _gameSettings = gameSettings; _customWidth = _gameSettings.Interface.BoardWidth; _customHeight = _gameSettings.Interface.BoardHeight; SetCustomBoardSize(); _bundle = Mvx.GetSingleton <GameCreationBundle>(); _bundle.OnLoad(this); this.OpponentName = _bundle.OpponentName; var thisTab = Mvx.Resolve <ITabProvider>().GetTabForViewModel(this); if (thisTab != null) { thisTab.Title = _bundle.TabTitle; } }
private async Task <View> CreateProfileView(ProfileViewModel profile) { var parent = new LinearLayout(Activity) { LayoutParameters = defaultLayoutParams, Orientation = Orientation.Vertical }; var images = Mvx.GetSingleton <IMvxImageCache <Bitmap> >(); var inlines = new Dictionary <int, Bitmap>(profile.InlineImages.Count); foreach (var inline in profile.InlineImages) { inlines.Add(inline.Key, await images.RequestImage(inline.Value.Url)); } var text = await BBCodeBinding.GetFormatted(profile.Description, (node, builder) => AddProfile(builder, node, inlines, parent, 0)); AddTextView(text, parent, 0); return(parent); }