Exemple #1
0
        private bool IsNotificationEnabled(IntPtr windowHandle, string?windowTitle, string?windowClass)
        {
            var titles  = TextBoxTitles.GetLines();
            var classes = TextBoxClasses.GetLines();

            return(windowHandle != IntPtr.Zero && !_skipped.Exists(windowHandle) &&
                   (titles.Length == 0 && classes.Length == 0 ||
                    HasLineMatching(windowTitle, titles) ||
                    HasLineMatching(windowClass, classes)));
Exemple #2
0
        private void metroTileEnter_Click(object sender, EventArgs e)
        {
            SimsOracle db   = new SimsOracle();
            int        rows = 0;

            if (TextBoxName.Text == "")
            {
                MessageBox.Show("You should enter centre name");
                TextBoxName.Focus();
            }
            else if (TextBoxAddress.Text == "")
            {
                MessageBox.Show("You should enter centre address");
                TextBoxAddress.Focus();
            }
            else if (TextBoxClasses.Text == "")
            {
                MessageBox.Show("You should enter number of classes");
                TextBoxClasses.Focus();
            }
            else if (!checkValue.isValidInteger(TextBoxClasses.Text))
            {
                MessageBox.Show("The number format is not valid");
                TextBoxClasses.Focus();
            }
            else
            {
                try
                {
                    string sql = "INSERT INTO CENTRE " +
                                 "(NAME, ADDRESS, CLASSES) " +
                                 " VALUES " +
                                 "(:NAME, :ADDRESS, :CLASSES)";
                    OracleCommand cmd = new OracleCommand(sql, db.Connection);
                    cmd.Parameters.Add("NAME", TextBoxName.Text);
                    cmd.Parameters.Add("ADDRESS", TextBoxAddress.Text);
                    cmd.Parameters.Add("CLASSES", TextBoxClasses.Text);

                    rows = cmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error adding a centre:\n" + ex.Message.ToString());
                }
                if (rows > 0)
                {
                    MessageBox.Show("Centre added successfully");
                    ClearControls();
                }
                else
                {
                    MessageBox.Show("Centre was not added, there might have been unexpected error");
                }
            }
        }
Exemple #3
0
        protected override void OnClosed(EventArgs e)
        {
            base.OnClosed(e);

            if (_hwndSource != null)
            {
                Win32.DeregisterShellHookWindow(_hwndSource.Handle);
                _hwndSource.RemoveHook(MessageHookProc);
            }

            _notifyWindow?.Close();

            FileStorage.Store(new WindowData {
                Titles = TextBoxTitles.GetLines(), Classes = TextBoxClasses.GetLines()
            });
        }
Exemple #4
0
        protected override void OnSourceInitialized(EventArgs e)
        {
            base.OnSourceInitialized(e);

            var winData = FileStorage.Load <WindowData>();

            if (winData != null)
            {
                TextBoxTitles.SetLines(winData.Titles);
                TextBoxClasses.SetLines(winData.Classes);
            }

            _hwndSource = PresentationSource.FromVisual(this) as HwndSource;

            if (_hwndSource != null)
            {
                _hwndSource.AddHook(MessageHookProc);
                Win32.RegisterShellHookWindow(_hwndSource.Handle);
                SetValue(_isDisabledPropertyKey, false);
            }
        }
Exemple #5
0
 private void ClearControls()
 {
     TextBoxAddress.Clear();
     TextBoxName.Clear();
     TextBoxClasses.Clear();
 }