Пример #1
0
 public WelcomeDisplay(IToast toast, string title, string message)
 {
     _toast = toast;
     InitializeComponent();
     Title.Content = title;
     Message.Text  = message;
 }
Пример #2
0
        public bool displayOrAddToast(string toastName, string toastText, float displayTime = 2f, bool addOnTop = true, string toastHeader = null, Sprite toastSprite = null)
        {
            IToast toastToDisplay = requestToast(toastName);

            if (toastToDisplay == null)
            {
                return(false);
            }
            //if the Toast is already showing we'll clone it
            if (toastToDisplay.IsShowing)
            {
                toastToDisplay = instantiateToast(toastToDisplay.modalObject);
            }
            toastToDisplay.modalObject.SetActive(true);
            toastToDisplay.ModifyModal(toastText);
            if (toastHeader != null)
            {
                toastToDisplay.setupHeader(toastHeader);
            }
            if (toastSprite != null)
            {
                toastToDisplay.ModifyModalImage(toastSprite);
            }
            if (addOnTop)
            {
                toastToDisplay.modalObject.transform.SetAsFirstSibling();
            }
            toastToDisplay.display();
            toastToDisplay.hide(displayTime);
            return(true);
        }
Пример #3
0
        public AnswerViewModel(IToast toast, IReqDB reqq)
        {
            dbss       = reqq;
            SendButton = new MvxCommand(() =>
            {
                Hari = new Req
                {
                    ReqFrom  = MyGlobals.SelPer.pFirstname,
                    ReqTo    = MyGlobals.perr.pFirstname,
                    ReqCal   = IsCheckedCal,
                    ReqLoc   = IsCheckedLoc,
                    ReqExtra = ExtraInfo
                };
                InsertReq(Hari);

                toast.Show("Status Request Sent");

                ShowViewModel <NotificationViewModel>();
            });

            CancelButton = new MvxCommand(() =>
            {
                ShowViewModel <RequestsViewModel>();
            });
        }
Пример #4
0
        private ToastDisplayer CreateAdapter(IToast toast = null)
        {
            var taskbarIconAdapter = new ToastDisplayer(toast ?? new Toast(new TaskbarIcon()));

            _itemsToDispose.Push(taskbarIconAdapter);
            return(taskbarIconAdapter);
        }
        public static async Task OpenEmailAsync(string email)
        {
            IToast toast = DependencyService.Get <IToast>();

            if (string.IsNullOrEmpty(email))
            {
                toast.Show("email empty");
                return;
            }

            try
            {
                var message = new EmailMessage
                {
                    To = new List <string> {
                        email
                    },
                };
                await Email.ComposeAsync(message);
            }
            catch (FeatureNotSupportedException fbsEx)
            {
                toast.Show("Email is not supported on this device");
                WriteLogEntry("Email is not supported on this device");
                WriteLogEntry(fbsEx.Message);
            }
            catch (Exception ex)
            {
                WriteLogEntry(ex.Message);
            }
        }
        public static async Task OpenMapAsync(string cordinates)
        {
            IToast toast = DependencyService.Get <IToast>();

            if (string.IsNullOrEmpty(cordinates))
            {
                toast.Show("cordinates empty");
                return;
            }

            string[] parts = cordinates?.Split(CharConstants.COMMA);

            if (parts != null && parts.Length == 2)
            {
                try
                {
                    double latitude  = Convert.ToDouble(parts[0]);
                    double longitude = Convert.ToDouble(parts[1]);

                    Location loc = new Location(latitude, longitude);

                    await Map.OpenAsync(loc);
                }
                catch (Exception ex)
                {
                    EbLog.Error($"Cordinates value format error 'Value:{cordinates}'");
                    EbLog.Error(ex.Message);

                    toast.Show("Unable to open map");
                }
            }
        }
        public CloudServiceClientBase(
            ILogger logger,
            IHttpClientFactory clientFactory,
            IHttpPlatformHelperService http_helper,
            IToast toast,
            IAuthHelper authHelper,
            ICloudServiceSettings settings,
            IModelValidator validator) : base(logger, http_helper, clientFactory)
        {
            this.authHelper = authHelper;
            this.toast      = toast;
            this.settings   = settings;
            ApiBaseUrl      = string.IsNullOrWhiteSpace(settings.ApiBaseUrl)
                ? throw new ArgumentNullException(nameof(ApiBaseUrl)) : settings.ApiBaseUrl;
            connection = new ApiConnection(logger, this, http_helper, validator);

            #region SetClients

            Account       = new AccountClient(connection);
            Manage        = new ManageClient(connection);
            AuthMessage   = new AuthMessageClient(connection);
            Version       = new VersionClient(connection);
            ActiveUser    = new ActiveUserClient(connection);
            Accelerate    = new AccelerateClient(connection);
            Script        = new ScriptClient(connection);
            DonateRanking = new DonateRankingClient(connection);

            #endregion
        }
Пример #8
0
        private void InitializeContent(IToast toastContent)
        {
            HasContent = false;

            TextBlockTitle.Text          = "";
            TextBlockSubtitle.Text       = "";
            TextBlockSubtitle.Visibility = Visibility.Collapsed;

            ImageAppLogoOverride.Visibility       = Visibility.Collapsed;
            CircleImageAppLogoOverride.Visibility = Visibility.Collapsed;

            if (toastContent != null)
            {
                if (toastContent.Visual != null)
                {
                    var visual = toastContent.Visual;

                    var binding = visual.Bindings.FirstOrDefault();

                    if (binding != null)
                    {
                        HasContent = true;

                        var container = binding.Container;

                        var texts = container.Children.OfType <AdaptiveTextField>().ToList();

                        var titleText = texts.ElementAtOrDefault(0);
                        if (titleText != null)
                        {
                            TextBlockTitle.Text = titleText.Text;
                        }

                        var bodyTextLine1 = texts.ElementAtOrDefault(1);
                        if (bodyTextLine1 != null)
                        {
                            TextBlockSubtitle.Text       = bodyTextLine1.Text;
                            TextBlockSubtitle.Visibility = Visibility.Visible;
                        }

                        var appLogoOverride = container.Children.OfType <AdaptiveImage>().FirstOrDefault(i => i.Placement == Model.Enums.Placement.AppLogoOverride);
                        if (appLogoOverride != null)
                        {
                            var bmp = ImageHelper.GetBitmap(appLogoOverride.Src);
                            if (appLogoOverride.HintCrop == Model.Enums.HintCrop.Circle)
                            {
                                CircleImageAppLogoOverride.Source     = bmp;
                                CircleImageAppLogoOverride.Visibility = Visibility.Visible;
                            }
                            else
                            {
                                ImageAppLogoOverride.Source     = bmp;
                                ImageAppLogoOverride.Visibility = Visibility.Visible;
                            }
                        }
                    }
                }
            }
        }
Пример #9
0
        protected override void AppendSpecificTypeProperties(StringBuilder builder)
        {
            IToast toast        = _widget as IToast;
            bool   bTouchClose  = false;
            int    exposureTime = 0;

            switch (toast.CloseSetting)
            {
            case ToastCloseSetting.ExposureTime:
                exposureTime = toast.ExposureTime * 1000;      // ExposureTime is in milliseconds in js.
                bTouchClose  = false;
                break;

            case ToastCloseSetting.CloseButton:
                exposureTime = 0;
                bTouchClose  = false;
                break;

            case ToastCloseSetting.AreaTouch:
                exposureTime = 0;
                bTouchClose  = true;
                break;

            default:
                break;
            }

            builder.AppendFormat("\"exposureTime\":{0},", exposureTime);
            builder.AppendFormat("\"bTouchClose\":{0},", bTouchClose.ToString().ToLower());

            bool isClosedPage = false;

            if (!toast.ToastPage.IsOpened)
            {
                isClosedPage = true;
                toast.ToastPage.Open();
            }

            if (IsSetMD5 == true)
            {
                builder.AppendFormat("\"Content\":\"{0}\",", toast.ToastPage.MD5);
            }

            builder.Append("\"toastWidgets\":[");
            foreach (IWidget widget in toast.ToastPage.Widgets)
            {
                JsWidget jsWidget = JsWidgetFactory.CreateJsWidget(_service, widget, IsSetMD5);
                builder.Append(jsWidget.ToString());
                builder.Append(",");
            }

            if (isClosedPage)
            {
                toast.ToastPage.Close();
            }

            JsHelper.RemoveLastComma(builder);
            builder.Append("],");
        }
Пример #10
0
 public ToastDisplayer(IToast toast)
 {
     if (toast == null)
     {
         throw new ArgumentNullException("toast");
     }
     _toast = toast;
 }
        public DoctorsScheduleViewModel(INavigationService navigationService, IToast toast) : base(navigationService)
        {
            this.navigationService = navigationService;
            this.toast             = toast;

            SelectDateCommand = new DelegateCommand <CalendarTappedEventArgs>((selectedDate) => SelectDate(selectedDate));
            AddToPendingConsultationCommand = new DelegateCommand(async() => await AddToPendingConsultation());
        }
 public AvaloniaDesktopAppUpdateServiceImpl(
     IDesktopAppService app,
     IToast toast,
     ICloudServiceClient client,
     IOptions <AppSettings> options) : base(toast, client, options)
 {
     this.app = app;
 }
Пример #13
0
 public EpisodePageViewModel(INavigationService navigationService, IToast toast, IGraphQL graphQL) : base(navigationService)
 {
     this.navigationService = navigationService;
     this.toast             = toast;
     this.graphQL           = graphQL;
     AddToListCommand       = new DelegateCommand(async() => await AddtoList());
     SearchPageCommand      = new DelegateCommand(async() => await this.navigationService.NavigateAsync("SearchPage"));
     ProfilePageCommand     = new DelegateCommand(async() => await this.navigationService.NavigateAsync("ProfilePage"));
 }
Пример #14
0
 public TrailerListViewModel(IGatewayService gatewayService,
                             IRepositories repositories,
                             IReachability reachabibilty,
                             IToast toast,
                             IInfoService infoService,
                             INavigationService navigationService) : base(gatewayService, repositories, reachabibilty, toast, infoService, navigationService)
 {
     _applicationProfileRepository = repositories.ApplicationRepository;
 }
Пример #15
0
 public ScriptManagerServiceImpl(
     IScriptRepository scriptRepository, IMapper mapper, ILoggerFactory loggerFactory, IToast toast, IHttpService httpService)
 {
     this.scriptRepository = scriptRepository;
     this.mapper           = mapper;
     this.toast            = toast;
     this.httpService      = httpService;
     logger = loggerFactory.CreateLogger <ScriptManagerServiceImpl>();
 }
 public ApplicationUpdateServiceImpl(
     IApplication application,
     INotificationService notification,
     IToast toast,
     ICloudServiceClient client,
     IOptions <AppSettings> options) : base(application, toast, client, options)
 {
     this.notification = notification;
 }
Пример #17
0
        public ToastProxy()
        {
            _toastProxy = DependencyService.Get <IToast>(DependencyFetchTarget.NewInstance);

            if (_toastProxy == null)
            {
                throw new InvalidOperationException("Internal instance via DependecyService was not created.");
            }
        }
Пример #18
0
 public AvaloniaApplicationUpdateServiceImpl(
     IAvaloniaApplication app,
     IWindowManager windowManager,
     IToast toast,
     ICloudServiceClient client,
     IOptions <AppSettings> options) : base(app, toast, client, options)
 {
     this.app           = app;
     this.windowManager = windowManager;
 }
Пример #19
0
 public CloudServiceClient(
     ILoggerFactory loggerFactory,
     IUserManager userManager,
     IToast toast,
     IOptions<AppSettings> options,
     IModelValidator validator) : base(loggerFactory.CreateLogger(TAG), userManager, options, validator)
 {
     this.userManager = userManager;
     this.toast = toast;
 }
Пример #20
0
 // Main View Model Function
 public RequestsViewModel(IAPerson dbs, IToast toast)
 {
     this.dbs = dbs;
     ReloadCommand.Execute(null);
     SelectPer = new MvxCommand <Perso>(selectedPer =>
     {
         MyGlobals.perr = null;
         MyGlobals.perr = selectedPer;
         ShowViewModel <AnswerViewModel>();
     });
 }
Пример #21
0
 public InstructionTrailerViewModel(IGatewayService gatewayService,
                                    INavigationService navigationService,
                                    IRepositories repositories,
                                    IReachability reachabiity,
                                    IToast toast,
                                    IInfoService startUpService)
     : base(gatewayService, repositories, reachabiity, toast, startUpService, navigationService)
 {
     _notificationToken            = Messenger.Subscribe <Messages.GatewayInstructionNotificationMessage>(async m => await CheckInstructionNotificationAsync(m));
     _applicationProfileRepository = _repositories.ApplicationRepository;
 }
Пример #22
0
 public AppUpdateServiceImpl(
     IToast toast,
     ICloudServiceClient client,
     IOptions <AppSettings> options)
 {
     this.toast         = toast;
     this.client        = client;
     settings           = options.Value;
     SupportedAbis      = GetSupportedAbis();
     StartUpdateCommand = ReactiveCommand.Create(StartUpdate);
 }
Пример #23
0
        public WelcomeViewModel(IToast toast, IAPerson per)
        {
            adb = per;

            Gur = new Perso
            {
                pFirstname = "Gurpreet",
                pLastname  = "Dhaliwal",
                PEmail     = "*****@*****.**",
                photo      = "@drawable/gur",
                PCalCheck  = true,
                PLocation  = "Available",
                PLocCheck  = true
            };

            Hari = new Perso
            {
                pFirstname = "Harri",
                pLastname  = "Tuononen",
                PEmail     = "*****@*****.**",
                photo      = "@drawable/harri",
                PCalCheck  = true,
                PLocation  = "Having Food",
                PLocCheck  = true
            };

            //Perso Ian = new Perso
            //{
            //    pFirstname = "Ian",
            //    pLastname = "Maskell",
            //    PEmail = "*****@*****.**",
            //    photo = "@drawable/iam",
            //    PCalCheck = true,
            //    PLocation = "Meeting in QUT",
            //    PLocCheck = true
            //};

            //getCount(Gur);
            //getCount(Hari);
            //getCount(Ian);

            GurButton = new MvxCommand(() =>
            {
                MyGlobals.SelPer = Gur;
                toast.Show("Logged in as " + MyGlobals.SelPer.pFirstname + "");
                ShowViewModel <SettingsViewModel>();
            });
            HarriButton = new MvxCommand(() =>
            {
                MyGlobals.SelPer = Hari;
                toast.Show("Logged in as " + MyGlobals.SelPer.pFirstname + "");
                ShowViewModel <SettingsViewModel>();
            });
        }
Пример #24
0
 public HomePageViewModel(INavigationService navigationService, IToast toast, IGraphQL graphQL) : base(navigationService)
 {
     this.navigationService = navigationService;
     this.toast             = toast;
     this.graphQL           = graphQL;
     ShowInfo = new DelegateCommand(async() => await ShowPopup());
     GotoSearchPageCommand = new DelegateCommand(async() => await this.navigationService.NavigateAsync("SearchPage"));
     GotoMyListPage        = new DelegateCommand(async() => await this.navigationService.NavigateAsync("MyListPage"));
     GotoProfilePage       = new DelegateCommand(async() => await this.navigationService.NavigateAsync("ProfilePage"));
     AddtoListCommand      = new DelegateCommand(async() => await AddtoList());
 }
 public IntegralPageViewModel(
     INavigationService navigationService,
     IPageDialogService pageDialogService,
     IToast toast)
     : base(navigationService, pageDialogService)
 {
     PrecisionChangedCommand = new DelegateCommand(PrecisionChanged);
     SolveIntegralCommand    = GetBusyDependedCommand(SolveIntegral);
     ShowHelpCommand         = new DelegateCommand(ShowHelp);
     _toast = toast;
 }
Пример #26
0
        private IToast instantiateToast(GameObject prefab)
        {
            GameObject go = Instantiate(prefab) as GameObject;

            go.SetActive(false);
            go.transform.SetParent(transform, false);
            IToast toast = go.GetComponent <IToast>();

            toast.modalObject = go;
            return(toast);
        }
Пример #27
0
        public BaseTrailerListViewModel(IGatewayService gatewayService, IRepositories repositories, IReachability reachabilty, IToast toast, IInfoService infoService, INavigationService navigationService)
        {
            _reachability      = reachabilty;
            _toast             = toast;
            _infoService       = infoService;
            _navigationService = navigationService;
            _gatewayService    = gatewayService;
            _repositories      = repositories;

            ProgressMessage = "Updating Trailers.";
        }
 public ApplicationUpdateServiceBaseImpl(
     IApplication application,
     IToast toast,
     ICloudServiceClient client,
     IOptions <AppSettings> options)
 {
     this.toast         = toast;
     this.client        = client;
     this.application   = application;
     settings           = options.Value;
     StartUpdateCommand = ReactiveCommand.Create(StartUpdate);
 }
Пример #29
0
 private void toastSetup()
 {
     foreach (Toast t in toasts)
     {
         if (toastLookup.ContainsKey(t.toastname))
         {
             Debug.Log("There are two Modals with this name: " + t.toastname + ". The second one will be ignored");
             continue;
         }
         IToast toast = instantiateToast(t.toastPrefab);
         toastLookup.Add(t.toastname, toast);
     }
 }
Пример #30
0
 public ViewModelBase(INavigationService navigationService, IEventAggregator eventAggregator, IStoreManager storeManager, IToast toast, IFavoriteService favoriteService, ILoggerFacade logger, ILaunchTwitter twitter, ISSOClient ssoClient, IPushNotifications pushNotifications, IReminderService reminderService, IPageDialogService pageDialogService)
 {
     Navigation        = navigationService;
     EventAggregator   = eventAggregator;
     StoreManager      = storeManager;
     Toast             = toast;
     FavoriteService   = favoriteService;
     Logger            = logger;
     SSOClient         = ssoClient;
     PushNotifications = pushNotifications;
     ReminderService   = reminderService;
     PageDialogService = pageDialogService;
     LaunchTwitter     = twitter;
 }
 public void FromToast(IToast toast)
 {
     _toast = toast;
     _tcs.TrySetFromTask(toast.CompletionTask);
 }
 public void Close()
 {
     var toast = _toast;
     if (toast == null)
     {
         var snackbar = _snackbar;
         if (snackbar == null)
             return;
         _snackbar = null;
         snackbar.Dismiss();
     }
     else
     {
         _toast = null;
         toast.Close();
     }
 }