Пример #1
0
 public AppIssueClient()
 {
     LastErrorText    = string.Empty;
     FilteringChanged = false;
     Initilized       = false;
     LoggedIn         = false;
     apiClient        = new IssueManagerClientUser(Defaulthost);
     state            = new IssueManagerState();
     filtering        = new FilteringAndSorting();
 }
Пример #2
0
        public async Task <bool> Init()
        {
            await Task.Run(async() =>
            {
                IFileHelper service = DependencyService.Get <IFileHelper>();

                string content = await service.Load("Filtering.dat");
                if (content.Length > 0)
                {
                    this.filtering = JsonConvert.DeserializeObject <FilteringAndSorting>(content);
                }
                else
                {
                    this.filtering.SetDefault();
                }

                content = await service.Load("AppState.dat");
                if (content.Length > 0)
                {
                    this.state = JsonConvert.DeserializeObject <IssueManagerState>(content);

                    if (this.state.Host.Length == 0)
                    {
                        this.state.Host = Defaulthost;
                    }

                    this.apiClient = new IssueManagerClientUser(this.state.Host, this.state.AccessToken);
                    LoggedIn       = this.state.AccessToken.Length > 0;
                }

                Initilized = true;
                SaveState();
                return(true);
            });

            return(false);
        }