Ejemplo n.º 1
0
        public AlertWindow(string WindowName, AlertCode NAlertCode, CloseEventDelegate CloseEvent = null)
        {
            InitializeComponent();
            EventsInitialize();

            this.CloseEvent = CloseEvent;

            this.Title = WindowName;


            if (NAlertCode == AlertCode.SendToServer)
            {
                TextBlock_Message.Text = "Не удалось установить соединение с сервером. " +
                                         "Возможно сервер выключен, или у вас проблемы с интернет-соединением.";
            }
            else if (NAlertCode == AlertCode.AddConfirm)
            {
                TextBlock_Message.Text = "Данные успешно добавлены.";
            }
            else if (NAlertCode == AlertCode.UpdateConfirm)
            {
                TextBlock_Message.Text = "Данные успешно обновлены.";
            }
            else if (NAlertCode == AlertCode.DeleteConfirm)
            {
                TextBlock_Message.Text = "Данные успешно удалены.";
            }

            this.Show();
        }
Ejemplo n.º 2
0
 public SocketPlugin()
 {
     socketStorage       = SocketStorage.CreateSocketStorage();
     dispatcher          = CoreWindow.GetForCurrentThread().Dispatcher;
     dataConsumeDelegate = DataConsumer;
     closeEventDelegate  = CloseEventHandler;
     errorDelegate       = ErrorHandler;
 }
Ejemplo n.º 3
0
        public static bool Email(string Email, CloseEventDelegate CloseEvent = null)
        {
            if (Email.Length == 0 || !StringValid.IsValidEmail(Email))
            {
                new AlertWindow("Ошибка", "Не верно задан формат почты!\r\nПример: [email protected]", CloseEvent);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 4
0
        public static bool Patronymic(string Patronymic, CloseEventDelegate CloseEvent = null)
        {
            if (new Regex("^[0-9]+$").IsMatch(Patronymic))
            {
                new AlertWindow("Ошибка", "Поле отчества не может содержать в себе цифры!", CloseEvent);

                return(false);
            }

            return(true);
        }
Ejemplo n.º 5
0
 public SocketServerAdapter(
     ISocketStorage socketStorage,
     DataConsumeDelegate dataConsumeDelegate,
     CloseEventDelegate closeEventDelegate,
     ErrorDelegate errorDelegate)
 {
     this.socketStorage       = socketStorage;
     this.dataConsumeDelegate = dataConsumeDelegate;
     this.closeEventDelegate  = closeEventDelegate;
     this.errorDelegate       = errorDelegate;
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Конструктор оповещения.
        /// </summary>
        /// <param name="WindowName">Название окна</param>
        /// <param name="Message">Текст оповещения</param>
        /// <param name="CloseEvent">Событие при закрытии окна</param>
        public AlertWindow(string WindowName, string Message, CloseEventDelegate CloseEvent = null)
        {
            InitializeComponent();
            EventsInitialize();

            this.CloseEvent = CloseEvent;

            this.Title             = WindowName;
            TextBlock_Message.Text = Message;

            this.Show();
        }
Ejemplo n.º 7
0
        public ConfirmWindow(string WindowName, string Message,
                             CloseEventDelegate YesEvent = null, CloseEventDelegate NotEvent = null)
        {
            InitializeComponent();
            EventsInitialize();

            this.YesEvent = YesEvent;
            this.NotEvent = NotEvent;

            this.Title             = WindowName;
            TextBlock_Message.Text = Message;

            this.Show();
        }
Ejemplo n.º 8
0
        public static bool Surname(string Surname, CloseEventDelegate CloseEvent = null)
        {
            if (Surname.Length == 0)
            {
                new AlertWindow("Ошибка", "Поле отчества не может быть пустым!", CloseEvent);

                return(false);
            }
            else if (new Regex("^[0-9]+$").IsMatch(Surname))
            {
                new AlertWindow("Ошибка", "Поле фамилии не может содержать в себе цифры!", CloseEvent);

                return(false);
            }

            return(true);
        }
Ejemplo n.º 9
0
        public static bool Password(string Password, string ConfirmPassword, CloseEventDelegate CloseEvent = null)
        {
            if (Password.Length >= 6)
            {
                if (Password == ConfirmPassword)
                {
                    return(true);
                }
                else
                {
                    new AlertWindow("Ошибка", "Пароли не совпадают!", CloseEvent);

                    return(false);
                }
            }
            else
            {
                new AlertWindow("Ошибка", "Пароль должен содержать минимум 6 символов!", CloseEvent);

                return(false);
            }
        }
Ejemplo n.º 10
0
        public static bool Login(string Login, CloseEventDelegate CloseEvent = null)
        {
            if (Login.Length >= 3)
            {
                if (!new Regex("^[a-z|A-Z|0-9|._-]+$").IsMatch(Login))
                {
                    new AlertWindow("Ошибка", "Поле логина не может содержать любые " +
                                    "символы кроме чисел и латинских букв!",
                                    CloseEvent);

                    return(false);
                }
            }
            else
            {
                new AlertWindow("Ошибка", "Логин должен содержать минимум 3 символа!",
                                CloseEvent);

                return(false);
            }

            return(true);
        }
Ejemplo n.º 11
0
 public void RegisterEvent(DataRecvEventDelegate _SEventRecv, CloseEventDelegate _SEventClose,
                           LogEventDelegate _LogEventSend, LogEventDelegate _LogEventRecv)
 {
     SEventRecv = _SEventRecv;
     SEventClose = _SEventClose;
     LogEventSend = _LogEventSend;
     LogEventRecv = _LogEventRecv;
 }