Пример #1
0
 public SettingsViewModel(int user_id)
 {
     user = SettingsModel.GetUser(user_id);
     if (user.Icon != null)
     {
         UserIcon = user.Icon;
     }
     else
     {
         UserIcon = AddUserElementModel.GetBytes("..\\..\\Resources\\DefaultImage\\userBig.png");
     }
     SurnameProperty  = user.Surname;
     NameProperty     = user.Name;
     EmailProperty    = user.Email;
     UsernameProperty = user.Username;
     //if(user.Theme != null)
 }
Пример #2
0
        private bool Validator()
        {
            string result_string = "";
            bool   result        = true;

            if ((TopImage == "..\\..\\Resources\\DefaultImage\\browse_top_image.jpg"))
            {
                result_string += "Insert Top Image\n";
                result         = false;
            }
            if ((SideImage == "..\\..\\Resources\\DefaultImage\\browse_side_image.jpg"))
            {
                result_string += "Insert Side Image\n";
                result         = false;
            }
            if ((string.IsNullOrEmpty(Name) || Name.Length > 30))
            {
                result_string += "Check  Russian mame (max length: 30)\n";
                result         = false;
            }
            if (string.IsNullOrEmpty(Info))
            {
                Info = "0_0";
            }
            try
            {
                if (Cost == 0 || Convert.ToDouble(Cost) > 999)
                {
                    result         = false;
                    result_string += "Enter cost of element (max:999)\n";
                }
            }
            catch { result = false; result_string = ("You cost is not a number\n"); }

            try
            {
                if (Size == 0 || Convert.ToInt32(Size) > 300)
                {
                    result         = false;
                    result_string += "Enter size of element (max:300)\n";
                }
            }
            catch { result = false; result_string = ("You size is not a number\n"); }

            if (result == true)
            {
                result = AddUserElementModel.NameImageVerificator(Name, AddUserElementModel.GetBytes(TopImage), AddUserElementModel.GetBytes(SideImage));
                if (result == false)
                {
                    result_string += "Element whith this name is exists";
                }
            }
            if (result)
            {
                return(true);
            }
            else
            {
                CustomMessageBox.Show(result_string);
                return(false);
            }
        }