Exemplo n.º 1
0
        public cMessage Previous(cMessage pMessage)
        {
            var lBindingSource = dgvMessages.DataSource as BindingSource;

            if (lBindingSource == null)
            {
                return(null);
            }

            for (int i = 1; i < lBindingSource.List.Count; i++)
            {
                var lData = lBindingSource.List[i] as cGridRowData;

                if (lData != null && lData.Message.MessageHandle == pMessage.MessageHandle)
                {
                    lData = lBindingSource.List[i - 1] as cGridRowData;
                    if (lData == null)
                    {
                        return(null);
                    }
                    return(lData.Message);
                }
            }

            return(null);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Question,Answer")] cMessage cMessage)
        {
            if (id != cMessage.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    cMessage.Question = cMessage.Question.ToUpper();
                    _context.Update(cMessage);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!cMessageExists(cMessage.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(cMessage));
        }
Exemplo n.º 3
0
 public frmMessage(string pInstanceName, frmSelectedMailbox pParent, bool pProgressBar, cMailbox pMailbox, int pMaxTextBytes, cMessage pMessage)
 {
     mInstanceName = pInstanceName;
     mParent       = pParent;
     mProgressBar  = pProgressBar;
     mMailbox      = pMailbox;
     mMaxTextBytes = pMaxTextBytes;
     mMessage      = pMessage;
     InitializeComponent();
 }
Exemplo n.º 4
0
        public async Task <IActionResult> Create([Bind("Id,Question,Answer")] cMessage cMessage)
        {
            if (ModelState.IsValid)
            {
                cMessage.Question = cMessage.Question.ToUpper();
                _context.Add(cMessage);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(cMessage));
        }
Exemplo n.º 5
0
        private void cmdNext_Click(object sender, EventArgs e)
        {
            var lMessage = mParent.Next(mMessage);

            if (lMessage == null)
            {
                MessageBox.Show(this, "no next");
                return;
            }

            ZSubscribe(false);
            mMessage = lMessage;
            ZQueryAsync(true);
        }
Exemplo n.º 6
0
        public MyCardsPage()
        {
            InitializeComponent();

            Profile profile = DatabaseHelper.GetProfile(App.Os_Folder);

            BindingContext = viewModel = new MyCardsPageViewModel(profile.Email);
            lb_CarDeleteFunc();
            _apiService = new ApiService();

            var t = Task.Run(async() => c = await _apiService.getUserCards(profile.Email));

            t.Wait();

            if (c.Count > 0)
            {
                CardsList.IsVisible   = true;
                CardsList.ItemsSource = c;
                LabelCard.IsVisible   = false;
            }
            else
            {
                CardsList.IsVisible = false;
                bt_delete.IsVisible = false;
                LabelCard.IsVisible = true;
            }

            void lb_CarDeleteFunc()
            {
                try
                {
                    bt_delete.GestureRecognizers.Add(new TapGestureRecognizer()
                    {
                        Command = new Command(async() =>
                        {
                            var delcard = await DisplayAlert(Translator.getText("Notice"), Translator.getText("DeleteCard"), Translator.getText("Yes"), Translator.getText("No"));

                            if (delcard)
                            {
                                _apiService = new ApiService();
                                App.WaitScreenStart(Translator.getText("DeletingCard"));
                                Card selected     = (Card)CardsList.SelectedItem;
                                cMessage response = await _apiService.deleteUserCard(profile.Email, selected.Id);
                                App.WaitScreenStop();
                                if (response.RETURN_CODE == 0)
                                {
                                    await Navigation.PopModalAsync();
                                }
                                else
                                {
                                    await DisplayAlert(Translator.getText("Notice"), response.RETURN_DESCRIPTION, "Ok");
                                    await Navigation.PopModalAsync();
                                }
                            }
                        }
                                              )
                    });
                }
                catch (Exception ex) { Debug.WriteLine(ex); }
            }

            lb_backFunc();
            void lb_backFunc()
            {
                try
                {
                    Back.GestureRecognizers.Add(new TapGestureRecognizer()
                    {
                        Command = new Command(() =>
                        {
                            Navigation.PopModalAsync();
                        })
                    });
                }
                catch (Exception ex) { Debug.WriteLine(ex); }
            }
        }
Exemplo n.º 7
0
 public cGridRowData(cMessage pMessage)
 {
     Message = pMessage ?? throw new ArgumentNullException(nameof(pMessage));
 }