Пример #1
0
    public void OnExport(object sender)
    {
        Jokes.Clear();
        var path = System.IO.Directory.GetParent(Application.dataPath).Parent.FullName + "/Configs/" + version;

        if (System.IO.Directory.Exists(path) == false)
        {
            System.IO.Directory.CreateDirectory(path);
        }
        var filename = UnityEditor.EditorUtility.SaveFilePanel("Save exported data", path, "config", "txt");

        if (filename.HasContent(4))
        {
            System.IO.File.WriteAllText(filename, JsonUtility.ToJson(data, false), System.Text.Encoding.UTF8);
        }
    }
Пример #2
0
        public async Task Search(string query)
        {
            IsBusy = true;

            var jokes = await _apiService.GetSearchResult(query);

            Jokes.Clear();

            if (jokes != null)
            {
                foreach (var joke in jokes.result)
                {
                    Jokes.Add(joke);
                }
            }

            IsBusy = false;
        }
Пример #3
0
        private async Task Search(string query)
        {
            IsBusy = true;

            var jokes = await ApiService.Search(query);

            Jokes.Clear();

            if (jokes != null)
            {
                foreach (var joke in jokes.result)
                {
                    Jokes.Add(joke);
                }
            }

            IsBusy = false;
        }
Пример #4
0
        async Task ExecuteLoadItemsCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                if (UserID > 0)
                {
                    Jokes.Clear();
                    var jokes = await JokeInitializer.GetItemsAsync(true, UserID);

                    Jokes.ReplaceRange(jokes);
                }
                else
                {
                    Jokes.Clear();
                    var jokes = await JokeInitializer.GetItemsAsync(true);

                    Jokes.ReplaceRange(jokes);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                MessagingCenter.Send(new MessagingCenterAlert
                {
                    Title   = "Error",
                    Message = "Unable to load items.",
                    Cancel  = "OK"
                }, "message");
            }
            finally
            {
                IsBusy = false;
            }
        }