Ejemplo n.º 1
0
        private void cmbState_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (cmbState.SelectedItem != null)
            {
                HubItem item = (HubItem)cmbState.SelectedItem;

                switch (item.Name)
                {
                case "ArtBoardLeft":
                    State = ArtBoardState.ArtboardLeft;
                    break;

                case "ArtBoardRight":
                    State = ArtBoardState.ArtBoardRight;
                    break;

                case "PaintSplitLeft":
                    State = ArtBoardState.PaintSplitLeft;
                    break;

                case "PaintSplitRight":
                    State = ArtBoardState.PaintSplitRight;
                    break;

                case "Preview":
                    State = ArtBoardState.Preview;
                    break;
                }
            }
        }
 public PullRequestsPage(HubItem hubItem)
 {
     InitializeComponent();
     this.Title                = hubItem.full_name;
     viewModel                 = AppContainer.Container.Resolve <PullRequestsPageViewModel>();
     viewModel.HubItem         = hubItem;
     viewModel.TryAgainCommand = new Command(async() => await viewModel.GetPullRequests());
     lstView.ItemTemplate      = new DataTemplate(() => new PullRequestsViewCell());
     lstView.ItemSelected     += LstView_ItemSelected;
     OpeningText.TextColor     = Color.FromHex("#e19a17");
     this.BindingContext       = viewModel;
 }
        public async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req,
            ILogger log)
        {
            try
            {
                var table                  = tableClient.GetTableReference(Environment.GetEnvironmentVariable("tableName"));
                var queue                  = queueClient.GetQueueReference(Environment.GetEnvironmentVariable("queueName"));
                var blobContainer          = blobClient.GetContainerReference(Environment.GetEnvironmentVariable("blobStorageName"));
                List <TableResult> results = new List <TableResult>();

                StringBuilder           builder = new StringBuilder();
                List <SampleModel.Data> samples = new List <SampleModel.Data>();

                var message = await queue.GetMessageAsync();

                if (message != null)
                {
                    samples = SampleModel.Data.FromJson <List <SampleModel.Data> >(message.AsString);
                }

                await blobContainer.CreateIfNotExistsAsync();

                foreach (var item in samples)
                {
                    HubItem hItem     = new HubItem();
                    var     blockBlob = blobContainer.GetBlockBlobReference(item.Id);
                    await blockBlob.UploadTextAsync(JsonConvert.SerializeObject(item));

                    hItem.BlobUri = blockBlob.Uri.ToString();

                    var insertData = TableOperation.Insert(hItem);
                    await table.CreateIfNotExistsAsync();

                    results.Add(await table.ExecuteAsync(insertData));
                }

                // Protip : Remove your message from queue, Azure Queue will not do this for you automatically
                await queue.DeleteMessageAsync(message);

                return(new OkObjectResult(results));
            }
            catch (Exception ex)
            {
                return(new BadRequestObjectResult("It allways may be worst"));
            }
        }