예제 #1
0
 public void ShowProperties(object model)
 {
     if (model == null)
     {
         return;
     }
     try
     {
         Z.ClearRightRegion(regionManager);
         if (model == null)
         {
             return;
         }
         IRegion rightRegion = this.regionManager.Regions[RegionNames.RightRegion];
         if (rightRegion == null)
         {
             return;
         }
         object view = GetView(model);
         if (view == null)
         {
             return;
         }
         rightRegion.Add(view);
     }
     catch (Exception ex)
     {
         Z.Notify(new Notification {
             Title = "Z-Metadata", Content = ExceptionsHandling.GetErrorText(ex)
         });
     }
 }
예제 #2
0
        public async Task <OkResult> Post([FromBody] Update update)
        {
            if (update == null)
            {
                return(Ok());
            }

            if (!update.Type.In(Types))
            {
                return(Ok());
            }

            try
            {
                if (update.Type == UpdateType.CallbackQuery)
                {
                    foreach (var i in keyboards.Get())
                    {
                        if (i.Contains(update.CallbackQuery.Data))
                        {
                            await i.HandleCallBackAsync(update.CallbackQuery);

                            return(Ok());
                        }
                    }
                }

                if (update.Type == UpdateType.InlineQuery)
                {
                    await inlineQueryHandler.HandleAsync(update.InlineQuery);

                    return(Ok());
                }

                var message = update.Message;

                if (message == null || String.IsNullOrEmpty(message.Text))
                {
                    return(Ok());
                }

                foreach (var command in commands.Get())
                {
                    if (command?.Contains(message.Text) ?? false)
                    {
                        await command.Execute(message);

                        break;
                    }
                }
            }
            catch (Exception e)
            {
                await ExceptionsHandling.HandleExceptionAsync(e, update, update.Type);
            }

            return(Ok());
        }
예제 #3
0
        private void RefreshInfoBases()
        {
            this.infoBases.Clear();
            try
            {
                InfoBase system = dataService.GetSystemInfoBase();
                this.InfoBases.Add(system);

                foreach (InfoBase infoBase in dataService.GetInfoBases())
                {
                    this.infoBases.Add(infoBase);
                }
            }
            catch (Exception ex)
            {
                Z.Notify(new Notification {
                    Title = "Z-Metadata", Content = ExceptionsHandling.GetErrorText(ex)
                });
            }
        }