public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var view = convertView;
            var item = data[position];

            if (view != null)
            {
                viewHolder = view.Tag as ListViewAdapterViewHolder;
            }
            else
            {
                view = LayoutInflater.From(context).Inflate(Resource.Layout.ItemList, null, false);

                viewHolder = new ListViewAdapterViewHolder();

                viewHolder.Name_File = view.FindViewById <TextView>(Resource.Id.Name_file);
                viewHolder.Size_File = view.FindViewById <TextView>(Resource.Id.Size_file);
                viewHolder.Type_File = view.FindViewById <TextView>(Resource.Id.Type_file);
                viewHolder.Data_File = view.FindViewById <TextView>(Resource.Id.Data_file);

                view.Tag = viewHolder;
            }

            viewHolder.Name_File.Text = item.FileName;
            viewHolder.Type_File.Text = item.FileType;
            viewHolder.Size_File.Text = EncryptionDecryptionService.ConvertToSizeWithName(item.FileSize);
            viewHolder.Data_File.Text = item.FileDate;

            return(view);
        }
        private void Button_Click(object sender, EventArgs e)
        {
            var conn       = new DataBase().SQLiteConnection();
            var db         = new DataBaseHelp(conn);
            var toast_mess = string.Empty;

            if (validate())
            {
                var category = category_text.Text;
                var password = password_text.Text;

                if (information_category == null)
                {
                    var list = db.GetItems <ModelCategory>();
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (list[i].Category == category)
                        {
                            Toast.MakeText(this, "Категория с таким именем уже зарегистрирована", ToastLength.Short).Show();
                            return;
                        }
                    }

                    information_category          = new ModelCategory();
                    information_category.Category = category;
                    information_category.Password = EncryptionDecryptionService.GetSHA(password, false);
                    information_category.Count    = 0;
                    toast_mess = "Категория успешно создана";
                    db.SaveItem(information_category, false);
                }
                else
                {
                    information_category.Category = category;
                    information_category.Password = EncryptionDecryptionService.GetSHA(password, false);
                    information_category.Count    = information_category.Count;
                    toast_mess = "Категория обновлена";
                    db.SaveItem(information_category, true);
                }

                Toast.MakeText(this, toast_mess, ToastLength.Short).Show();
                StartActivity(typeof(CategoryActivity));
            }
            else
            {
                Toast.MakeText(this, "Поля ввода не пройшли валидацию", ToastLength.Short).Show();
            }
        }
Beispiel #3
0
        private void DialogFragment_DialogClosed(object sender, DialogEventArgs e)
        {
            var current_password_SHA = EncryptionDecryptionService.GetSHA(e.Password, false);

            if (item.Password != current_password_SHA)
            {
                Toast.MakeText(this, "Неверный пароль", ToastLength.Long).Show();
                return;
            }
            else
            {
                switch (control_flag)
                {
                case 0:
                {
                    support_func.DataBaseConnection().DeleteItem <ModelCategory>(item.id);
                    LoadData();
                    break;
                }

                case 1:
                {
                    var intent = new Intent(this, typeof(RegistrationEditActivity));
                    intent.PutExtra("about_category", JsonConvert.SerializeObject(item));
                    StartActivity(intent);
                    break;
                }

                case 2:
                {
                    var intent = new Intent(this, typeof(MainActivity));
                    intent.PutExtra("id", item.id);
                    intent.PutExtra("key", e.Password);
                    StartActivity(intent);
                    break;
                }
                }
            }
        }
Beispiel #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.layout_detailpage);

            receiver = new CompleteReceiver();

            Title = "Описание";
            information_about_file = JsonConvert.DeserializeObject <ModelDataFile>(Intent.GetStringExtra("about_file"));
            password = Intent.GetStringExtra("key");

            var File_Name = FindViewById <TextView>(Resource.Id.Name_File);

            File_Name.Text = information_about_file.FileName;
            var File_Type = FindViewById <TextView>(Resource.Id.Type_File);

            File_Type.Text = information_about_file.FileType;
            var File_Size = FindViewById <TextView>(Resource.Id.Size_File);

            File_Size.Text = EncryptionDecryptionService.ConvertToSizeWithName(information_about_file.FileSize);
            var File_Date = FindViewById <TextView>(Resource.Id.Date_File);

            File_Date.Text = information_about_file.FileDate;
            var File_SHA = FindViewById <TextView>(Resource.Id.File_SHA);

            File_SHA.Text = information_about_file.FileSHA;
            var File_Pash = FindViewById <TextView>(Resource.Id.File_Path);

            File_Pash.Text = information_about_file.FilePath;

            var Delete_Button   = FindViewById <Button>(Resource.Id.Button_Delete);
            var Decrypto_Button = FindViewById <Button>(Resource.Id.Button_Decrypto);

            Delete_Button.Click   += Delete_Button_Click;
            Decrypto_Button.Click += Decrypto_Button_Click;

            support_func = new SupportCryptoFunction(this);
        }