Exemplo n.º 1
0
        public void AddAboutPanel(string title = "New Panel", string content = "No content added",
                                  Uri image    = null, Uri imageDestination  = null, AboutPanelType type = AboutPanelType.DEFAULT)
        {
            if (!_account.IsAuthenticated)
            {
                _account.RaiseError(
                    "Authentication is required to use mutations. Set the AuthorizationToken property with your user token to authenticate");
            }

            GraphQLRequest _req = new GraphQLRequest
            {
                Query = $"mutation{{panelAdd(input:{{ type: {type} }}) {{ err {{ message }} panel {{ id }}}}}}"
            };

            if (!Dlive.CanExecuteQuery())
            {
                Task.Delay((Dlive.NextIntervalReset - DateTime.Now).Milliseconds).Wait();
            }
            Dlive.IncreaseQueryCounter();

            GraphQLResponse res = Task.Run(() => _account.Client.SendMutationAsync(_req)).Result;

            if (res.Errors != null)
            {
                _account.RaiseError($"An error occured while creating a new panel: {res.Errors[0].Message}");
            }

            UpdateAboutPanel(new AboutPanel(int.Parse(res.Data.panelAdd.panel.id.ToString()), type, title, content,
                                            image, imageDestination));
        }
Exemplo n.º 2
0
 public AboutPanel(int id, AboutPanelType type, string title, string content, Uri imageUrl, Uri destination)
 {
     PanelId             = id;
     PanelType           = type;
     PanelTitle          = title;
     PanelText           = content;
     PanelImageUrl       = imageUrl;
     PanelUrlDestination = destination;
 }
Exemplo n.º 3
0
        public RawPanelData(JObject panel)
        {
            Enum.TryParse(panel["type"].ToString().ToUpper(), out AboutPanelType type);

            id           = int.Parse(panel["id"].ToString());
            this.type    = type;
            title        = panel["title"].ToString();
            body         = panel["body"].ToString();
            imageURL     = panel["imageURL"].ToString();
            imageLinkURL = panel["imageLinkURL"].ToString();
        }