Ejemplo n.º 1
0
 public void mostrarTelaPrincipal(string nome)
 {
     telaPrincipal = new fmMain();
     telaPrincipal.adicionarObservadores(this);
     telaPrincipal.lbName.Text = nome;
     telaPrincipal.ShowDialog();
 }
        public MainPresenter(fmMain mainFormView)
        {
            formView = mainFormView;

            formModelBook      = new MainFormFunction();
            formModelMagazine  = new MagazineFunction();
            formModelNewspaper = new NewspaperFunction();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Executes a partitioning command, throwing a PartitionException if an error occurs
        /// </summary>
        /// <param name="Command">The command to execute</param>
        /// <param name="console">A fmMain object to write output to</param>
        public static void ExecutePartitionCommand(string Command, fmMain console)
        {
            string output = null;

            Process proc = Process.Start(CreateAdbStartInfo("shell " + Command));
            proc.WaitForExit();

            string stdErr = proc.StandardError.ReadToEnd();

            if (!String.IsNullOrEmpty(stdErr))
            {
                throw new PartitionException(stdErr);
            }

            output = proc.StandardOutput.ReadToEnd();

            if (!String.IsNullOrEmpty(output))
                console.WriteToConsole(output.Replace("\r", ""));
        }
Ejemplo n.º 4
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtPass.Text == "*5005*7672*00#")
                {
                    Manv = txtName.Text;
                    fmMain f = new fmMain("admin");
                    this.Hide();
                    f.ShowDialog();
                    this.Show();
                    txtPass.Clear();
                }

                else
                {
                    TAIKHOAN nv = (from a in db.TAIKHOANs where a.MANV == txtName.Text && a.MATKHAU == GetMD5(txtPass.Text) select a).SingleOrDefault();
                    if (nv != null)
                    {
                        Manv = txtName.Text;
                        fmMain f = new fmMain(nv.MANV);
                        this.Hide();
                        f.ShowDialog();
                        this.Show();
                        txtPass.Clear();
                    }
                    else
                    {
                        DevExpress.XtraEditors.XtraMessageBox.Show("Sai mật khẩu hoặc Mã nhân viên!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show("Có lỗi trong quá trình thực hiện!", "simpleButton2_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
                log.Error(ex);
            }
        }
Ejemplo n.º 5
0
        private void btOkay_Click(object sender, EventArgs e)
        {
            try
            {
                string Hour   = tbHour.Text;
                string Minute = tbMinute.Text;

                if (Hour.Length < 1 || Minute.Length < 1)
                {
                    MessageBox.Show("Error! Hour or Minute is not fill out.");
                    return;
                }
                int iHour   = int.Parse(Hour);
                int iMinute = int.Parse(Minute);

                if (iHour > 23 || iMinute > 59)
                {
                    MessageBox.Show("Error! Date Time is not invalid.");
                    return;
                }
                if (Directory.Exists(tbPathFolder.Text))
                {
                    string parameter = tbPathFolder.Text + ";" + Hour + "," + Minute;
                    fmMain formMain  = new fmMain(parameter);
                    this.Hide();
                    formMain.Visible = true;
                }
                else
                {
                    MessageBox.Show("Error! Monitor folder is not exist.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 6
0
 public CommandManager(fmMain Parent)
 {
     _parent = Parent;
 }
Ejemplo n.º 7
0
 public AdbCommand(fmMain Console)
 {
     _console = Console;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Executes an 'adb shell' command, writing output asynchonously to the console window.
        /// </summary>
        /// <param name="Command">The command to execute ('shell' will be prepended)</param>
        /// <param name="Console">The fmMain object to write output to</param>
        /// <returns>
        /// The output of the command (stderr on failure, stdout on success)
        /// </returns>
        public static string ExecuteShellCommandWithOutput(string Command, fmMain Console)
        {
            string output;
            _console = Console;

            ProcessStartInfo info = CreateAdbStartInfo("shell " + Command);

            Process proc = new Process();
            proc.StartInfo = info;
            proc.OutputDataReceived += new DataReceivedEventHandler(proc_OutputDataReceived);
            proc.Start();

            proc.BeginOutputReadLine();

            proc.WaitForExit();

            string stdErr = proc.StandardError.ReadToEnd();

            output = !String.IsNullOrEmpty(stdErr) ? "Error: " + stdErr : "";

            return output;
        }