コード例 #1
0
        //When Select New Item In The Combo Box Show The Proper Controls
        private void GetUsersByComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (GetUsersByComboBox.SelectedIndex)
            {
            case 0:    //All Users
                UserText.Hide();
                UserDate.Hide();
                break;

            case 1:    //Only Connected
                UserText.Hide();
                UserDate.Hide();
                break;

            case 2:    //Email
                UserText.Show();
                UserDate.Hide();
                break;

            case 3:    //Nick Name
                UserText.Show();
                UserDate.Hide();
                break;

            case 4:    //Lase Connection Date
                UserText.Hide();
                UserDate.Show();
                break;
            }
        }
コード例 #2
0
        private void btnLogeo_Click(object sender, RoutedEventArgs e)
        {
            if (UserText.Text != "")
            {
                if (PassText.Password != "")
                {
                    UserModel user            = new UserModel();
                    var       validacionLogin = user.LoginUser(UserText.Text, encrypt.md5(PassText.Password));
                    if (validacionLogin == true)
                    {
                        FormularioPrincipal frmP = new FormularioPrincipal();
                        frmP.Show();
                        frmP.Closing += frmP_Closing;
                        this.Hide();
                    }
                    else
                    {
                        MessageError("Contraseña o nombre de usuario incorrecto\n Intenta de nuevo");

                        PassText.Clear();
                        UserText.Focus();
                    }
                }
                else
                {
                    MessageError("Introduce una contraseña");
                }
            }
            else
            {
                MessageError("Introduce un nombre de usuario");
            }
        }
コード例 #3
0
 public override void NavigatedToEvent(object sender, IDictionary <string, object> kwargs)
 {
     base.NavigatedToEvent(sender, kwargs);
     UserText.ClearContent();
     UserName.ClearContent();
     PasswordText.ClearContent();
 }
コード例 #4
0
        public async Task <IActionResult> Start([FromBody] UserText userText)
        {
            var jsonResult = await _trnaslator.TranslateAsync(userText.text);

            var(lang, toText) = ParsedText(jsonResult);
            //Detect languge first()

            //Check parsed keywords if contain doctor keyword or not
            if (userText.text.Contains("doctors") || userText.text.Contains("doctor"))
            {
                return(RedirectToAction("Health", "Translate"));
            }
            var textBody = await CheckLangSourceAsync(lang, userText.text);

            if (textBody != null) //Mean the text is arabic and we need to translate it
            {
                return(Json(textBody));
            }

            //set  the trnaslation result
            return(Json(new
            {
                to = "ar",
                from = lang,
                text = toText
            }));
        }
コード例 #5
0
        /// <summary>
        /// Validating user inputs
        /// </summary>
        private bool ValidateParameters()
        {
            if (string.IsNullOrWhiteSpace(UrlText.Text))
            {
                MessageBox.Show("Please enter SharePoint Url value.");
                UrlText.Focus();
                return(false);
            }

            if (string.IsNullOrWhiteSpace(UserText.Text))
            {
                MessageBox.Show("Please enter User value.");
                UserText.Focus();
                return(false);
            }

            if (string.IsNullOrWhiteSpace(PasswordText.Text))
            {
                MessageBox.Show("Please enter Password.");
                PasswordText.Focus();
                return(false);
            }

            return(true);
        }
コード例 #6
0
        /// <summary>
        /// Метод построчно обрабатывает пользовательский текст и если он строка не соответсвует шаблону делаем
        /// ++countNotMatch, и сохраняем номера строк с неправильным форматом. По окончанию обработки, если countNotMatch>0
        /// генерируем наверх FormatException с количеством неправильных строк.
        /// </summary>
        /// <returns>если countNotMatch>0 генерируем наверх FormatException с количеством неправильных строк.
        /// Если нет то возвращаем ""</returns>
        public string CountBadLines()
        {
            if (Pathfile != null && !File.Exists(Pathfile))
            {
                throw new FileNotFoundException("Файл не существует либо указан неверный путь");
            }
            int           countNotMatch = 0;
            int           countLines    = 0;
            StringBuilder sb            = new StringBuilder();
            Regex         regx          = new Regex(Pattern);

            string[] kb = UserText.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < kb.Length; i++)
            {
                if (!regx.IsMatch(kb[i].ToString()))
                {
                    ++countNotMatch;
                    sb.AppendLine("неправильный формат в строке №" + (1 + countLines));
                }
                ++countLines;
            }
            if (countNotMatch > 0)
            {
                FormatException exF = new FormatException(countNotMatch + " строк имели неправильный формат. Вводите правильный формат везде");
                return(sb.ToString());

                throw exF;
            }

            return(sb.ToString());
        }
コード例 #7
0
ファイル: TextOperations.cs プロジェクト: jenyayel/rgroup
        public static async Task <UserText> CreateTextAsync(
            ApplicationDbContext dbContext,
            string content)
        {
            var entity = new UserText
            {
                Content    = content,
                CreatedUtc = DateTime.UtcNow
            };

            MatchCollection matches = _emailRefRe.Matches(content);

            if (matches.Count > 0)
            {
                entity.MentionsUser = new List <UserInfo>();

                // We typically have few enough users that it's easiest just to get
                // all of them.
                IDictionary <string, UserInfo> allUsers = (await dbContext.UserInfos
                                                           .ToListAsync())
                                                          .ToDictionary(u => u.Email);

                foreach (string match in matches.Cast <Match>().Select(m => m.Groups[1].Value).Distinct())
                {
                    UserInfo mentionedUser;
                    if (allUsers.TryGetValue(match, out mentionedUser))
                    {
                        entity.MentionsUser.Add(mentionedUser);
                    }
                }
            }

            return(entity);
        }
コード例 #8
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (this.NavigationContext.QueryString.ContainsKey("user"))
            {
                string title = this.NavigationContext.QueryString["title"];
                if (title.Length > 3 && title.Substring(0, 3) == "Re:")
                {
                    TitleText.Text = title;
                }
                else
                {
                    TitleText.Text = "Re: " + title;
                }

                UserText.Text = this.NavigationContext.QueryString["user"];
                reid          = int.Parse(this.NavigationContext.QueryString["reid"]);

                ContentText.Focus();
            }
            else
            {
                UserText.Focus();
            }
        }
コード例 #9
0
ファイル: UserText.cs プロジェクト: ewin66/Management-System
        /// <summary>
        /// 克隆
        /// </summary>
        /// <returns>当前类实例的副本</returns>
        public new UserText Clone()
        {
            UserText userText = base.Clone() as UserText;

            userText.Group = this.Group.Clone();

            return(userText);
        }
コード例 #10
0
 private void frmP_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     PassText.Clear();
     UserText.Clear();
     errorlabel.IsEnabled = false;
     this.Show();
     UserText.Focus();
 }
コード例 #11
0
ファイル: TextBox.cs プロジェクト: xvwvx/Myra
        private void DeleteChars(int pos, int l)
        {
            if (l == 0)
            {
                return;
            }

            UserText = UserText.Substring(0, pos) + UserText.Substring(pos + l);
        }
コード例 #12
0
        public async Task <IActionResult> Answer([FromBody] UserText userText)
        {
            var jsonResult = await _trnaslator.TranslateAsync(userText.text, "en");

            var(lang, toText) = ParsedText(jsonResult);
            //set  the trnaslation result
            return(Json(new
            {
                text = toText
            }));
        }
コード例 #13
0
ファイル: UserOperations.cs プロジェクト: jenyayel/rgroup
        public static async Task NotifyMentionsAsync(
            ApplicationDbContext dbContext,
            string mentionedIn,
            string mentioningUserId,
            UserText text)
        {
            await dbContext.Entry(text).Collection(t => t.MentionsUser).LoadAsync();

            if (text.MentionsUser != null && text.MentionsUser.Count > 0)
            {
                // TBD
            }
        }
コード例 #14
0
ファイル: TextBox.cs プロジェクト: xvwvx/Myra
        private bool InsertChar(int pos, char ch)
        {
            if (string.IsNullOrEmpty(Text))
            {
                UserText = ch.ToString();
            }
            else
            {
                UserText = UserText.Substring(0, pos) + ch + UserText.Substring(pos);
            }

            return(true);
        }
コード例 #15
0
        public async Task <IActionResult> SmartMessage([FromBody] UserText userText)
        {
            Languages languages  = new Languages();
            var       jsonResult = await _trnaslator.TranslatAllAsync(userText.text);

            var langList = JsonConvert.DeserializeObject <List <JsonBody> >(jsonResult);
            List <Translations> translations = new List <Translations>();

            //Loop through translations and get lang name
            langList.First().Translations.ForEach(t =>
            {
                t.To = languages.GetLanguageName(t.To);
            });
            return(Json(langList.First().Translations));
        }
コード例 #16
0
ファイル: TextBox.cs プロジェクト: xvwvx/Myra
        private bool InsertChars(int pos, string s)
        {
            if (string.IsNullOrEmpty(s))
            {
                return(false);
            }

            if (string.IsNullOrEmpty(Text))
            {
                UserText = s;
            }
            else
            {
                UserText = UserText.Substring(0, pos) + s + UserText.Substring(pos);
            }

            return(true);
        }
コード例 #17
0
        public override void parse(BinaryReader br, ChunkMap chkMap, Boolean dbg, int chunkLength)
        {
            if (dbg)
            {
                Console.Out.WriteLine("|--| " + ChunkHeader.W3D_CHUNK_MESH_USER_TEXT);
            }

            HeaderID   = (int)ChunkHeader.W3D_CHUNK_MESH_USER_TEXT;
            HeaderName = ChunkHeader.W3D_CHUNK_MESH_USER_TEXT.ToString();

            byte[] nameArray = br.ReadBytes(chunkLength);
            user_text = System.Text.ASCIIEncoding.ASCII.GetString(nameArray);

            if (dbg)
            {
                Console.Out.WriteLine("\t\t Mesh User Text: " + UserText.Trim());
            }
        }
コード例 #18
0
        /// <summary>
        /// Returns if supplied string meets <see cref="UserText"/> filtering.
        /// </summary>
        public bool IsTextValid(string text, UserText userText)
        {
            if (!userTextAttributes.TryGetValue(userText, out UserTextAttribute attribute))
            {
                return(false);
            }

            if (attribute.MaxLength < text.Length)
            {
                return(false);
            }

            if (attribute.MinLength != 0u && attribute.MinLength > text.Length)
            {
                return(false);
            }

            return(IsTextValid(text, attribute.Flags));
        }
コード例 #19
0
ファイル: TextBox.cs プロジェクト: xvwvx/Myra
        public void Replace(int where, int len, string text)
        {
            if (len <= 0)
            {
                Insert(where, text);
                return;
            }

            text = Process(text);

            if (string.IsNullOrEmpty(text))
            {
                Delete(where, len);
                return;
            }

            UndoStack.MakeReplace(Text, where, len, text.Length);
            UserText = UserText.Substring(0, where) + text + UserText.Substring(where + len);
        }
コード例 #20
0
        protected void DeleteCharacter()
        {
            if (UserText.Length >= 1)
            {
                UserText = UserText.Substring(0, UserText.Length - 1);

                if (Building.Text.Length == 0 && Runs.Count > 0)
                {
                    Building = Runs.Last.Value;
                    Runs.RemoveLast();
                }

                if (Building.Text.Length > 0)
                {
                    Building.Text = Building.Text.Substring(0, Building.Text.Length - 1);
                }

                UpdateParagraph();
            }
        }
コード例 #21
0
        void ReleaseDesignerOutlets()
        {
            if (UserImage != null)
            {
                UserImage.Dispose();
                UserImage = null;
            }

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

            if (UserTitle != null)
            {
                UserTitle.Dispose();
                UserTitle = null;
            }
        }
コード例 #22
0
        private List <List <string> > GetTextChunks()
        {
            var chunks       = new List <List <string> >();
            var currentChunk = new List <string>();

            chunks.Add(currentChunk);

            foreach (var line in UserText.Split(new[] { Environment.NewLine }, StringSplitOptions.None))
            {
                if (string.IsNullOrWhiteSpace(line))
                {
                    // Currently not worried about multiple consecutive blank lines causing extra spacing
                    currentChunk = new List <string>();
                    chunks.Add(currentChunk);
                }
                else
                {
                    currentChunk.Add(line);
                }
            }

            return(chunks);
        }
コード例 #23
0
ファイル: TAD.cs プロジェクト: JiMin-Temprecord/DIO_TEST
        private void Connect_Click(object sender, EventArgs e)
        {
            string[] split;

            pc = new TcpClient();

            if (Connect.Text == "CONNECT")
            {
                if (IP_input.Text != "")
                {
                    if (Port_input.Text != "")
                    {
                        try
                        {
                            TARGET = IP_input.Text;
                            PORT   = Int32.Parse(Port_input.Text);

                            split = TARGET.Split('.');
                            if (split.Length == 4)
                            {
                                XIP.Visible   = false;
                                XPORT.Visible = false;

                                pc.Connect(TARGET, PORT);
                                this.Size            = new Size(450, 360);
                                IP_input.BackColor   = Color.LightGray;
                                Port_input.BackColor = Color.LightGray;
                                IP_input.Refresh();
                                Port_input.Refresh();
                                IP_input.Enabled   = false;
                                Port_input.Enabled = false;
                                UserText.Text      = "";
                                Connect.Text       = "DISCONNECT";

                                //Test.Visible = true;
                            }
                        }
                        catch (System.Net.Sockets.SocketException)
                        {
                            UserText.Text = "INVALID IP or PORT";
                            UserText.Refresh();
                            XIP.Visible   = true;
                            XPORT.Visible = true;
                            pc.Close();
                        }
                    }
                    else
                    {
                        UserText.Text = "INVALID IP or PORT";
                        XIP.Visible   = true;
                        XPORT.Visible = true;
                    }
                }
                else
                {
                    UserText.Text = "Please enter IP and PORT";
                    XIP.Visible   = true;
                    XPORT.Visible = true;
                }
            }
            else
            {
                pc.Close();
                Connect.Text         = "CONNECT";
                UserText.Text        = "";
                IP_input.Enabled     = true;
                Port_input.Enabled   = true;
                IP_input.BackColor   = Color.White;
                Port_input.BackColor = Color.White;
                number            = false;
                DIO1_icon.Visible = false;
                DIO2_icon.Visible = false;
                DIO3_icon.Visible = false;
                DIO4_icon.Visible = false;

                this.Size = new Size(240, 360);
            }
        }
コード例 #24
0
        void ReleaseDesignerOutlets()
        {
            if (AddressHelp != null)
            {
                AddressHelp.Dispose();
                AddressHelp = null;
            }

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

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

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

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

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

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

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

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

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

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