public async void UsosLogin(string oAuthVerifier)
        {
            UsosPin.Text = oAuthVerifier;

            using (UserDialogs.Instance.Loading("Loading"))
            {
                usosAuth.OAuthVerifier = oAuthVerifier;
                try
                {
                    var result = await SystemApi.UsosAuth(usosAuth);

                    if (UpdateUsosData)
                    {
                        await SystemApi.UsersClient.UsersUpdateUserUsosDataPutAsync();

                        await UserHelper.UpdateCourseNotificationSubscribtions();

                        UserDialogs.Instance.Toast("Usos data updated!");
                    }
                    Application.Current.MainPage = new MainPage();
                }
                catch (ApiException e)
                {
                    Console.WriteLine(e);
                    AuthErrorLabel.IsVisible = true;
                }
            }
        }
Example #2
0
        protected virtual void Awake()
        {
            MetaPathVariables.AddPathVariables();
            const bool isHeadsetConnected = true;
            var        metaFactory        = new MetaFactory(isHeadsetConnected);
            var        package            = metaFactory.ConstructAll();

            SetContext(package.MetaContext);

            // Initialize events
            foreach (IEventReceiver eventReceiver in package.EventReceivers)
            {
                eventReceiver.Init(_eventHandlers);
            }


            _eventHandlers.RaiseOnAwake();

            // Start Meta system
            SystemApi.Start();

            // Wait on Meta Ready to call ready event (Note: Purposely disabled; see MET-1833.)
            // StartCoroutine(SystemApi.MetaReady(Ready));

            Ready();
        }
Example #3
0
        /// <summary>
        /// 获取新令牌
        /// </summary>
        /// <param name="url">调用基地址</param>
        /// <param name="appKey">应用程序标识</param>
        /// <param name="appSecret">应用程序密钥</param>
        /// <param name="fromAccount">账号</param>
        /// <returns>申请到的令牌</returns>
        private static async Task <string> GetNewTokenAsync(string url, string appKey, string appSecret, string fromAccount, string toAccounnt)
        {
            var api = new SystemApi();

            api.Init(url, appKey, appSecret, fromAccount, toAccounnt);
            return(await api.TokenAsync());
        }
Example #4
0
        private void OnDestroy()
        {
            _eventHandlers.RaiseOnDestroy();

            // Shutdown Meta system
            SystemApi.Stop();
        }
Example #5
0
        public SystemApiTest()
        {
            var sessionManagerMock = new Mock <IAuthTokens>();

            sessionManagerMock.Setup(obj => obj.SessionToken).Returns("sessionToken");
            _apiExecutorMock = new Mock <IApiExecutor>();
            _systemApi       = new SystemApi(sessionManagerMock.Object, "", new HttpClient(), _apiExecutorMock.Object);
        }
        public static async Task Logout()
        {
            var accounts = await FindAccountsForServiceAsync();

            accounts.RemoveAll(a => a.Username == User.Username);
            User = null;
            SystemApi.Logout();
            CrossFirebasePushNotification.Current.UnsubscribeAll();
        }
Example #7
0
        public async Task GetTradeIdAsync()
        {
            var api = new SystemApi();

            api.Init(base_url, appkey, appSecret, from_account, to_account);
            var tradeid = await api.TradeidAsync();

            Assert.IsNotNull(tradeid);
            System.Console.WriteLine($"tradeid is :{tradeid}");
        }
Example #8
0
        public async Task GetOrderStatusAsync()
        {
            var api = new SystemApi();

            api.Init(base_url, appkey, appSecret, from_account, to_account);
            var os = await api.Get_OrderStatusAsync();

            Assert.IsNotNull(os);
            System.Console.WriteLine($"OrderStatus is :{os}");
        }
 public FilterInfoViewModel(SystemApi systemApi, EventBus eventBus)
 {
     this.systemApi  = systemApi;
     this.eventBus   = eventBus;
     LandingPadSizes = new ObservableCollection <char> {
         'L', 'M'
     };
     MaxLandingPadSize = LandingPadSizes.First();
     eventBus.Rescues.SelectedRescueChanged += RescuesOnSelectedRescueChanged;
 }
Example #10
0
        public SystemApiTest()
        {
            var sessionManagerMock = new Mock <IAuthTokens>();

            sessionManagerMock.Setup(obj => obj.SessionToken).Returns("sessionToken");
            var configuration = new Configuration();

            _apiExecutorMock = new Mock <IApiExecutor>();
            _systemApi       = new SystemApi(sessionManagerMock.Object, configuration, _apiExecutorMock.Object);
        }
Example #11
0
        public async Task GetTokenAsync()
        {
            var api = new SystemApi();

            api.Init(base_url, appkey, appSecret, from_account, to_account);
            var token = await api.TokenAsync();

            Assert.IsNotNull(token);
            System.Console.WriteLine($"Token is :{token}");
        }
 // Update is called once per frame
 void Update()
 {
     if (!recieved_transform_ || continuous_update_)
     {
         recieved_transform_ = SystemApi.GetTransform(destination,
                                                      source,
                                                      ref current_transform);
     }
     transform.localPosition = current_transform.GetPosition();
     transform.localRotation = current_transform.GetRotation();
 }
        private async void Button_UsosAuth(object sender, EventArgs e)
        {
            using (UserDialogs.Instance.Loading("Loading"))
            {
                usosAuth = await SystemApi.GetUsosAuthData();

                await Launcher.OpenAsync(new Uri(usosAuth.UsosAuthUrl));
            }

            UsosPin.IsVisible          = true;
            ConfirmPinButton.IsVisible = true;
        }
        public static async Task <bool> AutoLogin()
        {
            var user = await GetUser();

            if (user == null || user.TokenExpirationDate < DateTime.Now)
            {
                return(false);
            }
            User = user;
            SystemApi.AuthApi(user.Token);
            return(true);
        }
 public RescuesViewModel(EventBus eventBus, SystemApi systemApi, Cache cache)
 {
     this.eventBus                   = eventBus;
     this.systemApi                  = systemApi;
     this.cache                      = cache;
     allRescues                      = new List <RescueModel>();
     Rescues                         = new ObservableCollection <RescueModel>();
     eventBus.RescueCreated         += EventBusOnRescueCreated;
     eventBus.RescueUpdated         += EventBusOnRescueUpdated;
     eventBus.RescuesReloaded       += EventBusOnRescuesReloaded;
     eventBus.RescueClosed          += EventBusOnRescueClosed;
     eventBus.Rescues.FilterChanged += RescuesOnFilterChanged;
 }
        private async void StartActiveSurvey_OnClicked(object sender, EventArgs e)
        {
            using (UserDialogs.Instance.Loading())
            {
                FillSurveyObject();
                try
                {
                    await SystemApi.SurveysClient.SurveysStartSurveyFromTemplatePostAsync(Survey);

                    await Navigation.PopAsync();
                }
                catch (ApiException exception)
                {
                    SystemApi.HandleException(exception);
                }
            }
        }
        private void Update()
        {
            if (!Initialized)
            {
                return;
            }

            FrameHands frame;

            if (SystemApi.GetFrameHandsFlatbufferObject(ref _buffer, out frame))
            {
                RightHand.UpdateHand(frame.RightHand);
                LeftHand.UpdateHand(frame.LeftHand);

                RightHand.UpdateEvents();
                LeftHand.UpdateEvents();
            }
        }
        //private async void Button_Login(object sender, EventArgs e)
        //{
        //    using (UserDialogs.Instance.Loading("Loading"))
        //    {
        //        try
        //        {
        //            var result = await SystemApi.Auth(Username.Text, Password.Text);
        //            Application.Current.MainPage = new MainPage();
        //        }
        //        catch (ApiException exception)
        //        {
        //            AuthErrorLabel.IsVisible = true;
        //            Console.WriteLine(exception);
        //        }
        //    }
        //}

        private async void Button_UsosPinAuth(object sender, EventArgs e)
        {
            var oAuthVerifier = UsosPin.Text;

            using (UserDialogs.Instance.Loading("Loading"))
            {
                usosAuth.OAuthVerifier = oAuthVerifier;
                try
                {
                    var result = await SystemApi.UsosAuth(usosAuth);

                    Application.Current.MainPage = new MainPage();
                }
                catch (ApiException exception)
                {
                    Console.WriteLine(exception);
                    AuthErrorLabel.IsVisible = true;
                }
            }
        }
Example #19
0
        public LeagueClientApi()
        {
            HttpClient = new LeagueHttpClient();

            Assets         = new AssetsApi(HttpClient);
            ChampSelect    = new ChampSelectApi(HttpClient);
            Chat           = new ChatApi(HttpClient);
            DataStore      = new DataStoreApi(HttpClient);
            GameData       = new GameDataApi(HttpClient);
            Inventory      = new InventoryApi(HttpClient);
            ItemSets       = new ItemSetsApi(HttpClient);
            Login          = new LoginApi(HttpClient);
            Matchmaking    = new MatchmakingApi(HttpClient);
            Missions       = new MissionsApi(HttpClient);
            Performance    = new PerformanceApi(HttpClient);
            Perks          = new PerksApi(HttpClient);
            PlayerBehavior = new PlayerBehaviorApi(HttpClient);
            RiotClient     = new RiotClientApi(HttpClient);
            Summoner       = new SummonerApi(HttpClient);
            System         = new SystemApi(HttpClient);
        }
    void Update()
    {
        if (!recieved_transform_ || continuous_update_)
        {
            // Use Meta API to find coordiations
            recieved_transform_ = SystemApi.GetTransform(destination, source, ref current_transform);

            // Meta API uses a right-hand rule, GetPosition() and GetRotation() change this to left-hand rule coordinates
            transform.localPosition = current_transform.GetPosition();
            transform.localRotation = current_transform.GetRotation();

            // Use this to fix position offset
            Vector3 pos = new Vector3(x, y, z);
            pos += transform.position;

            transform.position = pos;

            // Use this to fix rotation offset
            transform.Rotate(angleX, angleY, angleZ, Space.World);
        }
    }
        private async Task Submit(bool activate = false)
        {
            using (UserDialogs.Instance.Loading())
            {
                FillSurveyObject();
                try
                {
                    if (Survey.Id.HasValue)
                    {
                        await SystemApi.SurveysClient.SurveysIdPutAsync(Survey.Id, Survey, activate);
                    }
                    else
                    {
                        await SystemApi.SurveysClient.SurveysPostAsync(Survey, activate);
                    }

                    await Navigation.PopAsync();
                }
                catch (ApiException exception)
                {
                    SystemApi.HandleException(exception);
                }
            }
        }
Example #22
0
 public SystemApiTests()
 {
     instance = new SystemApi();
 }
        public SystemCheckerGameView(IPlayniteAPI PlayniteApi, string PluginUserDataPath, Game GameSelected)
        {
            this.PlayniteApi = PlayniteApi;

            InitializeComponent();

            // Local
            SystemConfiguration systemConfiguration = PluginDatabase.Database.PC;

            LocalOs                = systemConfiguration.Os;
            LocalCpu               = systemConfiguration.Cpu;
            LocalRamUsage          = systemConfiguration.RamUsage;
            LocalGpu               = systemConfiguration.GpuName;
            LocalDisks.ItemsSource = systemConfiguration.Disks;


            // Minimum & Recommanded
            GameRequierements gameRequierements = PluginDatabase.Get(GameSelected, true);

            Requirement Minimum     = gameRequierements.GetMinimum();
            Requirement Recommanded = gameRequierements.GetRecommanded();

            if (Minimum.HasData)
            {
                MinimumOs       = "Windows " + string.Join(" / ", Minimum.Os);
                MinimumCpu      = Minimum.Cpu;
                MinimumRamUsage = Minimum.RamUsage;
                MinimumGpu      = Minimum.Gpu;
                MinimumStorage  = Minimum.StorageUsage;
            }

            if (Recommanded.HasData)
            {
                RecommandedOs       = "Windows " + string.Join(" / ", Recommanded.Os);
                RecommandedCpu      = Recommanded.Cpu;
                RecommandedRamUsage = Recommanded.RamUsage;
                RecommandedGpu      = Recommanded.Gpu;
                RecommandedStorage  = Recommanded.StorageUsage;
            }


            // Check config
            string IsOk = "";
            string IsKo = "";

            CheckSystem CheckMinimum = SystemApi.CheckConfig(Minimum, systemConfiguration);

            if (Minimum.HasData)
            {
                MinimumCheckOs = IsKo;
                if (CheckMinimum.CheckOs)
                {
                    MinimumCheckOs = IsOk;
                }
                if (Minimum.Os.Count == 0)
                {
                    MinimumCheckOs = string.Empty;
                }

                MinimumCheckCpu = IsKo;
                if (CheckMinimum.CheckCpu)
                {
                    MinimumCheckCpu = IsOk;
                }
                if (Minimum.Cpu.Count == 0)
                {
                    MinimumCheckCpu = string.Empty;
                }

                MinimumCheckRam = IsKo;
                if (CheckMinimum.CheckRam)
                {
                    MinimumCheckRam = IsOk;
                }
                if (Minimum.Ram == 0)
                {
                    MinimumCheckRam = string.Empty;
                }

                MinimumCheckGpu = IsKo;
                if (CheckMinimum.CheckGpu)
                {
                    MinimumCheckGpu = IsOk;
                }
                if (Minimum.Gpu.Count == 0)
                {
                    MinimumCheckGpu = string.Empty;
                }

                MinimumCheckStorage = IsKo;
                if (CheckMinimum.CheckStorage)
                {
                    MinimumCheckStorage = IsOk;
                }
                if (Minimum.Storage == 0)
                {
                    MinimumCheckStorage = string.Empty;
                }
            }

            CheckSystem CheckRecommanded = SystemApi.CheckConfig(Recommanded, systemConfiguration);

            if (Recommanded.HasData)
            {
                RecommandedCheckOs = IsKo;
                if (CheckRecommanded.CheckOs)
                {
                    RecommandedCheckOs = IsOk;
                }
                if (Recommanded.Os.Count == 0)
                {
                    RecommandedCheckOs = string.Empty;
                }

                RecommandedCheckCpu = IsKo;
                if (CheckRecommanded.CheckCpu)
                {
                    RecommandedCheckCpu = IsOk;
                }
                if (Recommanded.Cpu.Count == 0)
                {
                    RecommandedCheckCpu = string.Empty;
                }

                RecommandedCheckRam = IsKo;
                if (CheckRecommanded.CheckRam)
                {
                    RecommandedCheckRam = IsOk;
                }
                if (Recommanded.Ram == 0)
                {
                    RecommandedCheckRam = string.Empty;
                }

                RecommandedCheckGpu = IsKo;
                if (CheckRecommanded.CheckGpu)
                {
                    RecommandedCheckGpu = IsOk;
                }
                if (Recommanded.Gpu.Count == 0)
                {
                    RecommandedCheckGpu = string.Empty;
                }

                RecommandedCheckStorage = IsKo;
                if (CheckRecommanded.CheckStorage)
                {
                    RecommandedCheckStorage = IsOk;
                }
                if (Recommanded.Storage == 0)
                {
                    RecommandedCheckStorage = string.Empty;
                }
            }

            btLink.Visibility = System.Windows.Visibility.Hidden;
            if (Minimum.HasData || Recommanded.HasData)
            {
                btLink.Visibility = System.Windows.Visibility.Visible;
                btLink.Tag        = gameRequierements.Link;
            }

#if DEBUG
            logger.Debug("CheckMinimum" + JsonConvert.SerializeObject(CheckMinimum));
            logger.Debug("CheckRecommanded" + JsonConvert.SerializeObject(CheckRecommanded));
#endif

            if (!gameRequierements.SourceGameName.IsNullOrEmpty() && !gameRequierements.SourceName.IsNullOrEmpty())
            {
                ScSourceName = resources.GetString("LOCSourceLabel") + ": " + gameRequierements.SourceGameName + $" ({gameRequierements.SourceName})";
            }
            else
            {
                ScSourceName = resources.GetString("LOCSourceLabel") + ": " + GameSelected.Name;
            }

            DataContext = this;
        }