Exemple #1
0
        private void Add_Campaing(CreateCampaingResponse response)
        {
            GetCampaingResponse add    = API.GetCampaing(response.response[0].id);
            CampaingViewer      viewer = new CampaingViewer(add.response[0].id);

            viewer.Click += Choose_Camp;
            viewer.campaingTitle.Content = add.response[0].name;
            viewer.DayLim.Content        = add.response[0].day_limit;
            viewer.AllLim.Content        = add.response[0].all_limit;
            CampaingStack.Children.Add(viewer);
        }
Exemple #2
0
        /// <summary>
        /// Создаёт рекламную кампанию.
        /// </summary>
        /// <returns></returns>
        public CreateCampaingResponse CreateCampaign(CreateCampaignData[] Cdata)
        {
            string      data;
            HttpRequest Request = new HttpRequest();

            Request.AddUrlParam("account_id", _CABID);
            data = JsonConvert.SerializeObject(Cdata);
            Request.AddUrlParam("data", data);
            Request.AddUrlParam("access_token", _Token);
            Request.AddUrlParam("v", __API_VERSION);
            string json = Request.Get(__VKAPIURL + "ads.createCampaigns").ToString();
            CreateCampaingResponse campaings = JsonConvert.DeserializeObject <CreateCampaingResponse>(json);

            return(campaings);
        }
Exemple #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            CreateCampaignData[] Data = new CreateCampaignData[1];
            Data[0]            = new CreateCampaignData();
            Data[0].name       = Name.Text;
            Data[0].status     = Status.IsChecked.Value;
            Data[0].start_time = new Helper().GetUnixTime(StartDate.Text, start_time_hour.Text, start_time_minute.Text).ToString();
            Data[0].stop_time  = new Helper().GetUnixTime(StopDate.Text, stop_time_hour.Text, stop_time_minute.Text).ToString();
            if (CampaingType.SelectedIndex == 0)
            {
                Data[0].type = "normal";
            }
            else
            {
                Data[0].type = "promoted_posts";
            }
            Data[0].day_limit = DayLimit.Text;
            Data[0].all_limit = AllLimit.Text;
            CreateCampaingResponse response = new CreateCampaingResponse();

            response = API.CreateCampaign(Data);
            Create(response);
            this.Close();
        }