Example #1
0
        public PictureViewer(string type, Bitmap bitmap)
        {
            InitializeComponent();
            this.WindowState    = FormWindowState.Maximized;
            this.MinimumSize    = this.Size;
            this.DoubleBuffered = true;
            this.type           = type;
            this.bitmap         = bitmap;
            LblResult.Hide();
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            oldHeight            = ImageBox.Height;
            oldWidth             = ImageBox.Width;
            ImageBox.Image       = bitmap;
            ImageBox.SizeMode    = PictureBoxSizeMode.StretchImage;
            directory            = Directory.GetCurrentDirectory();

            if (type == "result")
            {
                this.WindowState     = FormWindowState.Maximized;
                this.FormBorderStyle = FormBorderStyle.Sizable;
                this.MinimumSize     = Size.Empty;
                this.MinimizeBox     = this.MaximizeBox = true;
                BtnDone.Hide();
                BtnReset.Hide();
                LblResult.Show();
                ImageBox.Width  = this.Width = bitmap.Width;
                ImageBox.Height = this.Height = bitmap.Height;
                ImageBox.Dock   = DockStyle.None;
                ImageBox.Anchor = AnchorStyles.None;
                //  ImageBox.Width = bitmap.Width;
                //ImageBox.Height = bitmap.Height;

                Console.WriteLine("scalebitmap" + ImageBox.Width.ToString() + "x" + ImageBox.Height.ToString());
            }
        }
Example #2
0
        private void CmdFiles_Click(object sender, EventArgs e)
        {
            DialogResult result1 = MessageBox.Show("Αρχείο εισαγωγής στίχων: inverse.txt\nΑρχείο εγγραφής αποτελεσμάτων: outverse.txt\nΝα συνεχίσω ;", "Έγκριση ...", MessageBoxButtons.OKCancel);
            String       message = null;

            ErrorLines = 0;
            TotalLines = 0;

            if (result1 == DialogResult.OK)
            {
                try
                {
                    /*ΑΝΟΙΓΜΑ ΑΡΧΕΙΟΥ ΤΟ ΟΠΟΙΟ ΒΡΙΣΚΕΤΑΙ ΣΤΟ ΣΧΕΤΙΚΟ ΜΟΝΟΠΑΤΙ ΤΟΥ project*/
                    using (StreamReader inputFile = new StreamReader("inverse.txt"))  /*Το using στο τέλος κλείνει το stream*/
                    {
                        /*Εφόσον όλα πήγαν ΟΚ με το άνοιγμα του input file θα δημιουργήσουμε το αρχείο των αποτελεσμάτων*/
                        /*ΑΝΟΙΓΜΑ ΑΡΧΕΙΟΥ ΑΠΟΤΕΛΕΣΜΑΤΩΝ*/
                        using (StreamWriter outputFile = new StreamWriter("outverse.txt"))
                        {
                            LblResult.Text = "Μετρική ανάλυση σε εξέλιξη ..."; //Εμφάνιση μηνύματος στο LblResult
                            LblResult.SelectAll();
                            LblResult.SelectionColor = Color.Black;

                            /*ΔΙΑΒΑΣΜΑ ΓΡΑΜΜΗ-ΓΡΑΜΜΗ ΤΟΥ ΑΡΧΕΙΟΥ ΜΕΧΡΙ ΤΟ EOF*/
                            while ((VerseLine = inputFile.ReadLine()) != null)
                            {
                                //Αύξηση της τιμής του counter των γραμμών
                                TotalLines++;

                                //Μετρική ανάλυση αυτού του στίχου
                                Metrics.DoScansion(ref VerseLine, ref ScansionLine, ref ErrorLines);

                                outputFile.WriteLine(VerseLine);    //Εγγραφή στο αρχείο αποτελεσμάτων του στίχου
                                outputFile.WriteLine(ScansionLine); //και του αποτελέσματος της μετρικής του ανάλυσης
                            }
                        }

                        message = "Η μετρική ανάλυση μέσω αρχείων ολοκληρώθηκε.\nΣύνολο στίχων: " + TotalLines + "\nΣύνολο λαθών: " + ErrorLines;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Λάθος στη διαχείριση των αρχείων !", MessageBoxButtons.OK);
                    LblResult.Clear();
                    TxtInput.Focus();
                    return;
                }
            }
            else
            {
                message = "Η διαδικασία ακυρώθηκε !";
            }

            MessageBox.Show(message, "Τέλος μετρικής ανάλυσης", MessageBoxButtons.OK);
            LblResult.Clear();
            TxtInput.Focus();
        }
Example #3
0
        private void BgCleaner_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            sWebhook.Token      = TbxToken.Text.Trim();
            sWebhook.UriClean   = TbxUri.Text.Trim();
            sWebhook.UriCurrent = TbxUriDefault.Text.Trim();

            if (!string.IsNullOrEmpty(sWebhook.Token) &&
                !string.IsNullOrEmpty(sWebhook.UriClean))
            {
                int count = sWebhook.GetWebhookInfo().PendingUpdateCount;
                tsProgBar.GetCurrentParent().Invoke((MethodInvoker) delegate
                {
                    tsProgBar.Maximum = count;
                });

                for (int x = 0; x <= count; count--)
                {
                    sWebhook.HapusWebhook();
                    sWebhook.GetUpdates();
                    sWebhook.SetWebhook();
                    count    = sWebhook.GetWebhookInfo().PendingUpdateCount;
                    e.Result = count;
                    tsProgBar.GetCurrentParent().Invoke((MethodInvoker) delegate
                    {
                        tsProgBar.Value = tsProgBar.Maximum - count;
                    });

                    //HControls.InvokeIfRequired(this, LblResult => LblResult.Text = "Sisa pendings : " + count);
                    LblResult.Invoke((MethodInvoker) delegate { LblResult.Text = "Sisa pending : " + count; });
                }

                if (!string.IsNullOrEmpty(sWebhook.UriCurrent) &&
                    SetURIHookSetBersihkanToolStripMenuItem.Checked)
                {
                    sWebhook.SetWebhookDefault();
                }

                if (!BwChecker.IsBusy)
                {
                    BwChecker.RunWorkerAsync();
                }
            }
            else
            {
                MessageBox.Show("Token & URI Clear Hook dibutuhkan!", Application.ProductName,
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #4
0
        private void CmdVerse_Click(object sender, EventArgs e)
        {
            ErrorLines = 0;
            VerseLine  = TxtInput.Text;
            Metrics.DoScansion(ref VerseLine, ref ScansionLine, ref ErrorLines);

            if (ErrorLines != 0)
            {
                ScansionLine = "Λάθος ανάλυση...";
            }

            LblResult.Text = VerseLine + "\n" + ScansionLine;
            LblResult.SelectAll();
            LblResult.SelectionColor = Color.Black;

            TxtInput.Clear();
            CmdClear.Focus();
        }
Example #5
0
        private void BwChecker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            sWebhook.Token      = TbxToken.Text.Trim();
            sWebhook.UriClean   = TbxUri.Text.Trim();
            sWebhook.UriCurrent = TbxUriDefault.Text.Trim();

            if (!string.IsNullOrEmpty(sWebhook.Token))
            {
                var data = sWebhook.GetWebhookInfo();
                LblResult.Invoke((MethodInvoker) delegate
                {
                    LblResult.Text = "URI Webhook         : " + data.Url +
                                     "\nPending Update     : " + data.PendingUpdateCount +
                                     "\nMax Connection     : " + data.MaxConnections +
                                     "\nLast Error Date       : " + data.LastErrorDate +
                                     "\nLast Error Message : " + data.LastErrorMessage;
                });

                if (data.PendingUpdateCount > 5)
                {
                    LblResult.Invoke((MethodInvoker) delegate
                    {
                        LblResult.Text += "\nLebih dari " + data.PendingUpdateCount;
                    });

                    if (bersihkanPendingCountOtomatisToolStripMenuItem.Checked)
                    {
                        BgCleaner.RunWorkerAsync();
                    }
                    //PushNotif("Pending Update Count : " + data.PendingUpdateCount);
                }
            }
            else
            {
                MessageBox.Show("Token dibutuhkan!", Application.ProductName,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #6
0
    protected void btnGetStudentData_Click(object sender, EventArgs e)
    {
        Student student = new Student();

        student.StudentNo = TxtBxStudentNo.Text;
        student           = Student.GetStudentDetails(student.StudentNo);
        if (student == null)
        {
            LblResult.Text = "No data found";
            LblResult.Focus();
        }
        else
        {
            TxtBxStudentNo.Text      = student.StudentNo;
            TxtBxName.Text           = student.Name;
            TxtBxEmail.Text          = student.EmailID;
            TxtBxContactNo.Text      = student.ContactNo;
            RBLGender.SelectedIndex  = RBLGender.Items.IndexOf(RBLGender.Items.FindByText(student.Gender.ToString()));
            DDLBranch.SelectedIndex  = DDLBranch.Items.IndexOf(DDLBranch.Items.FindByText(student.Branch.ToString()));
            DDLYear.SelectedIndex    = DDLYear.Items.IndexOf(DDLYear.Items.FindByValue(student.Year.ToString()));
            DDLCollege.SelectedIndex = DDLCollege.Items.IndexOf(DDLCollege.Items.FindByValue("1"));
        }
    }
        void ReleaseDesignerOutlets()
        {
            if (BtnCalculate != null)
            {
                BtnCalculate.Dispose();
                BtnCalculate = null;
            }

            if (LblAddition != null)
            {
                LblAddition.Dispose();
                LblAddition = null;
            }

            if (LblDivision != null)
            {
                LblDivision.Dispose();
                LblDivision = null;
            }

            if (LblMultiplication != null)
            {
                LblMultiplication.Dispose();
                LblMultiplication = null;
            }

            if (LblNumber1 != null)
            {
                LblNumber1.Dispose();
                LblNumber1 = null;
            }

            if (LblNumber2 != null)
            {
                LblNumber2.Dispose();
                LblNumber2 = null;
            }

            if (LblResult != null)
            {
                LblResult.Dispose();
                LblResult = null;
            }

            if (LblSubstraction != null)
            {
                LblSubstraction.Dispose();
                LblSubstraction = null;
            }

            if (SldOperator != null)
            {
                SldOperator.Dispose();
                SldOperator = null;
            }

            if (TxtNumber1 != null)
            {
                TxtNumber1.Dispose();
                TxtNumber1 = null;
            }

            if (TxtNumber2 != null)
            {
                TxtNumber2.Dispose();
                TxtNumber2 = null;
            }

            if (BtnGoToSettings != null)
            {
                BtnGoToSettings.Dispose();
                BtnGoToSettings = null;
            }
        }
Example #8
0
 private void CmdClear_Click(object sender, EventArgs e)
 {
     LblResult.Clear();
     TxtInput.Clear();
     TxtInput.Focus();
 }