Esempio n. 1
0
        private void newArticle()
        {
            btnNewSave.Text = Recursos.Rscresx.mensajeEtiquetaGuardar;
            btnClose.Text   = Recursos.Rscresx.mensajeEtiquetaCancelarNuevo;
            tipo            = TipoComandoEnum.Nuevo;

            enabledControls(true);
            fillComboStore();

            txtName.Focus();
        }
Esempio n. 2
0
        private void btnCerrar_Click(object sender, EventArgs e)
        {
            if (tipo == TipoComandoEnum.Ninguno)
            {
                this.Close();
            }
            else if (tipo == TipoComandoEnum.Nuevo)
            {
                btnClose.Text   = Recursos.Rscresx.mensajeEtiquetaCerrar;
                btnNewSave.Text = Recursos.Rscresx.mensajeEtiquetaNuevo;

                cleanControls();
                enabledControls(false);

                tipo = TipoComandoEnum.Ninguno;
            }
        }
Esempio n. 3
0
        static IEnumerable <string> GetItensSelecionadosExplorer(TipoComandoEnum tipoComando)
        {
            // get the active window
            IntPtr handle = NativeMethods.GetForegroundWindow();

            string        filename;
            List <string> lstItens = new List <string>();

            foreach (SHDocVw.InternetExplorer window in new SHDocVw.ShellWindows())
            {
                // match active window
                if (window.HWND != (int)handle)
                {
                    continue;
                }

                filename = Path.GetFileNameWithoutExtension(window.FullName).ToLower();
                if (filename.ToLowerInvariant() == "explorer")
                {
                    Shell32.FolderItems items = ((Shell32.IShellFolderViewDual2)window.Document).SelectedItems();
                    foreach (Shell32.FolderItem item in items)
                    {
                        bool isArquivo = File.Exists(item.Path);

                        Trace.WriteLine("Este item: " + item.Path + " é um arquivo? R: " + isArquivo);

                        if (tipoComando == TipoComandoEnum.ArquivoCopiarNomeArquivo)
                        {
                            if (isArquivo)
                            {
                                lstItens.Add(item.Path);
                            }
                        }
                        else if (item.IsFolder)
                        {
                            lstItens.Add(item.Path);
                        }
                    }
                }
                else
                {
                    Trace.WriteLine("Não achei janela do explorer");
                }
            }
            return(lstItens.OrderBy(x => x));
        }
        static IEnumerable <string> GetItensSelecionadosExplorer(TipoComandoEnum tipoComando)
        {
            // get the active window
            IntPtr handle = NativeMethods.GetForegroundWindow();

            string filename;

            List <Tuple <string, bool> > lstItens = new List <Tuple <string, bool> >();

            SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindows();
            foreach (SHDocVw.InternetExplorer window in shellWindows)
            {
                // match active window
                if (window.HWND != (int)handle)
                {
                    continue;
                }

                filename = Path.GetFileNameWithoutExtension(window.FullName).ToLower();
                if (filename.ToLowerInvariant() == "explorer")
                {
                    Shell32.FolderItems items = ((Shell32.IShellFolderViewDual2)window.Document).SelectedItems();
                    foreach (Shell32.FolderItem item in items)
                    {
                        lstItens.Add(Tuple.Create(item.Path, item.IsFolder));
                        //bool isArquivo = File.Exists(item.Path);

                        //if (tipoComando == TipoComandoEnum.ArquivoCopiarNomeArquivo)
                        //{
                        //  if (isArquivo)
                        //    lstItens.Add(item.Path);
                        //}
                        //else if (item.IsFolder)
                        //  lstItens.Add(item.Path);
                    }
                }
                else
                {
                    Trace.WriteLine("Não achei janela do explorer");
                }
            }
            return(lstItens.OrderByDescending(x => x.Item2).ThenBy(x => x.Item1).Select(x => x.Item1));
        }
Esempio n. 5
0
        private void saveArticle()
        {
            if (ValidateData())
            {
                BEStore store = cmbStore.SelectedItem as BEStore;

                string  name         = txtName.Text;
                string  description  = txtDescription.Text;
                int     totalInVault = int.Parse(txtTotalInVault.Text);
                int     totalInShelf = int.Parse(txtTotalInShelf.Text);
                short   storeId      = store.id;
                decimal price        = decimal.Parse(txtPrice.Text);

                BERespuesta res = articleApiConsumer.AddArticle(name, description, price, totalInShelf, totalInVault,
                                                                storeId);

                if (res.success)
                {
                    MessageBox.Show("Se ha guardado el articulo de manera satisfactoria. Presione OK", Recursos.Rscresx.mensajeEtiquetaAviso,
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);

                    cleanControls();
                    enabledControls(false);

                    btnNewSave.Text = Recursos.Rscresx.mensajeEtiquetaNuevo;
                    btnClose.Text   = Recursos.Rscresx.mensajeEtiquetaCerrar;

                    tipo = TipoComandoEnum.Ninguno;

                    loadArticles();
                }
                else
                {
                    MessageBox.Show(Recursos.Rscresx.mensajeEtiquetaErrorArticuloGuardar, Recursos.Rscresx.mensajeEtiquetaAviso,
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }