Example #1
0
 private void mnuMiscInputLanguages_Click(object sender, EventArgs e)
 {
     foreach (InputLanguage lan in InputLanguage.InstalledInputLanguages)
     {
         Mbox.ShowInfo(lan.LayoutName);
     }
 }
Example #2
0
        private bool ValidarSenha()
        {
            if (tbSenha.Password == string.Empty && cadastrar)
            {
                Mbox.CampoInvalido("Senha");
                tbSenha.Focus();
                return(false);
            }

            if (tbConfirmarSenha.Password == string.Empty && cadastrar)
            {
                Mbox.CampoInvalido("Confimar Senha");
                tbConfirmarSenha.Focus();
                return(false);
            }

            if (tbSenha.Password != string.Empty)
            {
                if (tbSenha.Password != tbConfirmarSenha.Password)
                {
                    Mbox.Afirmacao("Aviso", "A senhas informadas são diferentes!");
                    tbSenha.Clear();
                    tbConfirmarSenha.Clear();
                    tbSenha.Focus();
                    return(false);
                }
            }

            return(true);
        }
 private void treeInfo_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
 {
     try
     {
         var menuItem = e.Node?.Tag as GroupedServerInfo;
         if (menuItem != null)
         {
             ShowDataPane(menuItem.SystemInfo);
             return;
         }
         var simpleNode = e.Node?.Tag as List <SuperSimpleColumnTypes.TwoColumnType>;
         if (simpleNode != null)
         {
             ShowDataPane(simpleNode);
             return;
         }
         var cmdLineNode = e.Node?.Tag as List <CmdLineResult>;
         if (cmdLineNode != null)
         {
             ShowStaticInfo(cmdLineNode);
         }
     }
     catch (Exception ex)
     {
         Mbox.Error(ex, $"Failed to load '{e.Node?.Text ?? "Unknown"}'");
     }
 }
Example #4
0
        static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
        {
            string message = "An error occured: " + Environment.NewLine + Environment.NewLine
                             + e.Exception.Message + Environment.NewLine
                             + e.Exception.StackTrace;

            Mbox.ShowError(message);
        }
        private bool NaoExisteConsulta()
        {
            if (ConsultaModel.ExisteConsulta(tbData.SelectedDate.Value, TimeSpan.Parse(tbHorario.Text), consulta?.id ?? 0))
            {
                Mbox.Afirmacao("Aviso", "Já existe uma consulta agendada na data e horário informado!");
                return(false);
            }

            return(true);
        }
Example #6
0
 private void btnGerar_Click(object sender, RoutedEventArgs e)
 {
     if (item != null)
     {
         MantemItem((item as TreeViewItem)?.Uid);
     }
     else
     {
         Mbox.SelecioneUmaLinhaDaTabela();
     }
 }
Example #7
0
 private void cmdApplyAndClose_Click(object sender, EventArgs e)
 {
     SelectedLogFiles = GetAllSelectedLogs();
     if (SelectedLogFiles.Count == 0)
     {
         Mbox.Show("There are no selected files.\r\n\r\nUse Ctrl-A to select all files\r\n\r\nUse Ctrl/Shift And click on row for individual select.", "No selected files", MessageBoxButtons.OK);
         return;
     }
     DialogResult = DialogResult.OK;
     Close();
 }
 private void Vincular()
 {
     if (lvwClientes.SelectedItems.Count > 0)
     {
         Cliente  = lClientes[lvwClientes.SelectedIndex];
         Vinculou = true;
         Close();
     }
     else
     {
         Mbox.SelecioneUmaLinhaDaTabela();
     }
 }
        private static void ClickExceptionButton(ControlExceptions controlExceptions)
        {
            try
            {
                Exception exception;
                Button    removeButton;

                lock (_syncObj)
                {
                    exception = controlExceptions.Exceptions.Count > 0
                        ? controlExceptions.Exceptions.Dequeue()
                        : null;

                    if (controlExceptions.Exceptions.Count == 0)
                    {
                        _controlExceptions.Remove(controlExceptions.Control);
                        removeButton             = controlExceptions.Button;
                        controlExceptions.Button = null;
                    }
                    else
                    {
                        removeButton = null;
                    }
                }

                if (removeButton != null)
                {
                    try
                    {
                        controlExceptions.Control.OnUiThread(removeButton.Dispose);
                    }
                    catch
                    {
                    }
                }
                else
                {
                    controlExceptions.Control.OnUiThread(() => UpdateButton(controlExceptions));
                }

                if (exception != null)
                {
                    Mbox.Error(exception, "Sorry! We could not load the data you wanted.");
                }
            }
            catch
            {
            }
        }
        private void cmdApplyAndClose_Click(object sender, EventArgs e)
        {
            _filter.QuickFilters = new List <QuickFilterValues>();

            foreach (var item in lstCheckBox.CheckedItems)
            {
                _filter.QuickFilters.AddRange(((QuickFilterDisplay)item).GetFilters());
            }
            if (!string.IsNullOrWhiteSpace(txtFilter.Text))
            {
                var newFilters = txtFilter.Lines?.ToList().Where(p => !string.IsNullOrEmpty(p));
                if (newFilters != null)
                {
                    foreach (var newFilter in newFilters)
                    {
                        bool negFilter = false;
                        var  filter    = newFilter;
                        if (radStartsWith.Checked)
                        {
                            filter = $"^{filter}";
                        }
                        if (radNotContains.Checked)
                        {
                            negFilter = true;
                        }
                        try
                        {
                            var regex = new Regex(filter);
                            Trace.WriteLine(regex.IsMatch(""));
                            _filter.QuickFilters.Add(new QuickFilterValues
                            {
                                FilterValue    = filter,
                                FriendlyName   = (negFilter ? "<>" : "=") + filter,
                                ColumnName     = cboColumn.SelectedIndex > 0 ? cboColumn.SelectedItem.ToString() : null,
                                NegativeFilter = negFilter
                            });
                        }
                        catch
                        {
                            Mbox.Show("The filter is not correct. Edit or Cancel", "No you dont!");
                            return;
                        }
                    }
                }
            }
            Close();
        }
        private void Remover()
        {
            if (lvwFuncionarios.SelectedIndex >= 0)
            {
                var despesa = lvwFuncionarios.SelectedItems[0] as DespesaModel;
                var r       = Mbox.DesejaExcluir();

                if (r == MessageDialogResult.Affirmative)
                {
                    despesa?.Remover();
                    CarregarDespesas();
                }
            }
            else
            {
                Mbox.SelecioneUmaLinhaDaTabela();
            }
        }
Example #12
0
        private void lvwSaidas_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (lvwSaidas.SelectedIndex >= 0)
            {
                var caixa     = lvwSaidas.SelectedItems[0] as CaixaSaidaModel;
                var cadLancar = new LancarSaidaWin(caixa);
                cadLancar.ShowDialog();

                if (cadLancar.cadastrou)
                {
                    CarregarDados();
                }
            }
            else
            {
                Mbox.SelecioneUmaLinhaDaTabela();
            }
        }
Example #13
0
        private void Editar()
        {
            if (lvwCargos.SelectedIndex >= 0)
            {
                var cargo    = lvwCargos.SelectedItems[0] as CargoModel;
                var cadCargo = new CadCargoWin(cargo);
                cadCargo.ShowDialog();

                if (cadCargo.cadastrou)
                {
                    CarregarCargos();
                }
            }
            else
            {
                Mbox.SelecioneUmaLinhaDaTabela();
            }
        }
Example #14
0
        private static bool ValidarTextBox(IEnumerable <TextBox> lTextBoxs)
        {
            foreach (TextBox tb in lTextBoxs)
            {
                if (tb?.Tag?.ToString() == "*")
                {
                    if (string.IsNullOrEmpty(tb.Text.Trim()))
                    {
                        Mbox.CampoInvalido(tb.Uid);
                        tb.Focus();

                        return(false);
                    }
                }
            }

            return(true);
        }
        private void ApagarConsulta()
        {
            if (lvwConsultas.SelectedItems.Count > 0)
            {
                var item        = lvwConsultas.SelectedItems[0] as ConsultaModel;
                var frmCancelar = new Consultas.ExcluirConsultaWin(item);
                frmCancelar.ShowDialog();

                if (frmCancelar.Removeu)
                {
                    CarregarDados();
                }
            }
            else
            {
                Mbox.SelecioneUmaLinhaDaTabela();
            }
        }
        private void Editar()
        {
            if (lvwFormaDePagamento.SelectedIndex >= 0)
            {
                var formaDePagamento    = lvwFormaDePagamento.SelectedItems[0] as FormaDePagamentoModel;
                var cadFormaDePagamento = new CadFormaDePagamentoWin(formaDePagamento);
                cadFormaDePagamento.ShowDialog();

                if (cadFormaDePagamento.cadastrou)
                {
                    CarregarFormaDePagamento();
                }
            }
            else
            {
                Mbox.SelecioneUmaLinhaDaTabela();
            }
        }
Example #17
0
        private static bool ValidarHoras(IEnumerable <MaskedTextBox> lTextBoxs)
        {
            foreach (TextBox tb in lTextBoxs)
            {
                if (tb?.Tag?.ToString() == "horas*")
                {
                    if (!DataUtil.ValidarHorario(tb.Text))
                    {
                        Mbox.CampoInvalido(tb.Uid);
                        tb.Focus();

                        return(false);
                    }
                }
            }

            return(true);
        }
Example #18
0
        private static bool ValidarComboBox(IEnumerable <ComboBox> lCombo)
        {
            foreach (ComboBox cb in lCombo)
            {
                if (cb?.Tag?.ToString() == "*")
                {
                    if (string.IsNullOrEmpty(cb.Text.Trim()))
                    {
                        Mbox.CampoInvalido(cb.Uid);
                        cb.Focus();

                        return(false);
                    }
                }
            }

            return(true);
        }
Example #19
0
        private void Editar()
        {
            if (lvwCategorias.SelectedIndex >= 0)
            {
                var categoria    = lvwCategorias.SelectedItems[0] as CategoriaModel;
                var cadCategoria = new CadCategoriaWin(categoria);
                cadCategoria.ShowDialog();

                if (cadCategoria.cadastrou)
                {
                    CarregarCategorias();
                }
            }
            else
            {
                Mbox.SelecioneUmaLinhaDaTabela();
            }
        }
Example #20
0
        private static bool ValidarDatePicker(IEnumerable <DatePicker> lDates)
        {
            foreach (DatePicker dp in lDates)
            {
                if (dp?.Tag?.ToString() == "dataPicker*")
                {
                    if (!DataUtil.ValidarData(dp.Text))
                    {
                        Mbox.CampoInvalido(dp.Uid);
                        dp.SelectedDate = DateTime.Now;
                        dp.Focus();

                        return(false);
                    }
                }
            }

            return(true);
        }
Example #21
0
        private void RemoverSaida()
        {
            if (lvwSaidas.SelectedIndex >= 0)
            {
                var r = Mbox.DesejaExcluir();

                if (r == MessageDialogResult.Affirmative)
                {
                    var saida = lvwSaidas.SelectedItems[0] as CaixaSaidaModel;
                    saida?.Remover();

                    CarregarDados();
                }
            }
            else
            {
                Mbox.SelecioneUmaLinhaDaTabela();
            }
        }
        private void Remover()
        {
            if (lvwFormaDePagamento.SelectedIndex >= 0)
            {
                var formaDePagamento = lvwFormaDePagamento.SelectedItems[0] as FormaDePagamentoModel;
                var r = Mbox.DesejaExcluir();

                if (r == MessageDialogResult.Affirmative)
                {
                    formaDePagamento?.Remover();
                    lFormaDePagamento.Remove(formaDePagamento);
                    lvwFormaDePagamento.Items.Refresh();
                }
            }
            else
            {
                Mbox.SelecioneUmaLinhaDaTabela();
            }
        }
        private void Editar()
        {
            if (lvwFuncionarios.SelectedIndex >= 0)
            {
                var despesa    = lvwFuncionarios.SelectedItems[0] as DespesaModel;
                var cadCliente = new CadDespesaWin(despesa);

                cadCliente.ShowDialog();

                if (cadCliente.cadastrou)
                {
                    CarregarDespesas();
                }
            }
            else
            {
                Mbox.SelecioneUmaLinhaDaTabela();
            }
        }
Example #24
0
        private void Remover()
        {
            if (lvwFuncionarios.SelectedIndex >= 0)
            {
                var cliente = lvwFuncionarios.SelectedItems[0] as ClienteModel;
                var r       = Mbox.DesejaExcluir();

                if (r == MessageDialogResult.Affirmative)
                {
                    cliente?.Remover();
                    lClientes.Remove(cliente);
                    lvwFuncionarios.Items.Refresh();
                }
            }
            else
            {
                Mbox.SelecioneUmaLinhaDaTabela();
            }
        }
Example #25
0
        private void Editar()
        {
            if (lvwFuncionarios.SelectedIndex >= 0)
            {
                var cliente    = lvwFuncionarios.SelectedItems[0] as ClienteModel;
                var cadCliente = new CadClienteWin(cliente);

                cadCliente.ShowDialog();

                if (cadCliente.cadastrou)
                {
                    CarregarClientes();
                }
            }
            else
            {
                Mbox.SelecioneUmaLinhaDaTabela();
            }
        }
Example #26
0
        private void Remover()
        {
            if (lvwCategorias.SelectedIndex >= 0)
            {
                var categoria = lvwCategorias.SelectedItems[0] as CategoriaModel;
                var r         = Mbox.DesejaExcluir();

                if (r == MessageDialogResult.Affirmative)
                {
                    categoria?.Remover();
                    categorias.Remove(categoria);
                    lvwCategorias.Items.Refresh();
                }
            }
            else
            {
                Mbox.SelecioneUmaLinhaDaTabela();
            }
        }
Example #27
0
        private static async Task <bool> AskInstallNewerVersion(IStoreFactory storeFactory, ApplicationVersion newerVersion)
        {
            if (_skipAskDownload)
            {
                return(false);
            }

            try
            {
                Log.To.Main.Add($"There is a new version available. Current version: {Version}, available version: {newerVersion}");

                DialogResult doYouWantToDownload = Mbox.Show(
                    string.Join("\r\n",
                                "Great Scott! There's an update available.",
                                $"Changes in version {newerVersion} include:",
                                "",
                                newerVersion.Description,
                                "",
                                "Would you like to download and install the latest version?"),
                    null,
                    MessageBoxButtons.YesNo,
                    MessageBoxIcon.Question);

                if (doYouWantToDownload != DialogResult.Yes)
                {
                    return(false);
                }
                //SplashManager.Loader.ShowFloatingSplash(SplashManager.Loader.GetDefaultOwner());
                //splashFormStatus.Text = "Downloading...";


                var packageManager = new PackageManager(storeFactory);

                string packageFilename = await packageManager.DownloadLatestVersionPackage(ApplicationId);

                return(PackageManager.InstallApplication(packageFilename));
            }
            catch (Exception ex)
            {
                Log.To.Main.AddException("Error in AskInstallNewerVersion", ex);
                return(false);
            }
        }
        private void lvwConsultas_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (lvwConsultas.SelectedIndex >= 0)
            {
                var consulta   = lvwConsultas.SelectedItems[0] as ConsultaModel;
                var cadConsuta = new Consultas.CadConsultasWin(consulta);

                cadConsuta.ShowDialog();

                if (cadConsuta.cadastrou)
                {
                    CarregarDados();
                }
            }
            else
            {
                Mbox.SelecioneUmaLinhaDaTabela();
            }
        }
Example #29
0
        private void Remover()
        {
            if (lvwFuncionarios.SelectedIndex >= 0)
            {
                var funcionario = lvwFuncionarios.SelectedItems[0] as FuncionarioModel;
                var r           = Mbox.DesejaExcluir();

                if (r == MessageDialogResult.Affirmative)
                {
                    AlterouOftal = funcionario?.cargo?.id == 1;
                    funcionario?.Remover();
                    lFuncionarios.Remove(funcionario);
                    lvwFuncionarios.Items.Refresh();
                }
            }
            else
            {
                Mbox.SelecioneUmaLinhaDaTabela();
            }
        }
        private void Remover()
        {
            if (lvwCargos.SelectedIndex >= 0)
            {
                var r = Mbox.DesejaExcluir();

                if (r == MessageDialogResult.Affirmative)
                {
                    var convenio = lvwCargos.SelectedItems[0] as ConvenioModel;
                    convenio?.Remover();

                    listaDeConvenios.Remove(convenio);
                    lvwCargos.Items.Refresh();
                }
            }
            else
            {
                Mbox.SelecioneUmaLinhaDaTabela();
            }
        }