コード例 #1
0
        protected override void OnAppearing()
        {
            try
            {
                base.OnAppearing();

                MessagingCenter.Unsubscribe <Popup_ProfileImageDialog, string>(this, "blobimagename");
                MessagingCenter.Subscribe <Popup_ProfileImageDialog, string>(this, "blobimagename", (sender, value) =>
                {
                    bool ab = true;
                    if (ab == true && value != null)
                    {
                        ImageName = value;

                        int index  = -1;
                        int index2 = -1;
                        int index3 = -1;
                        int index4 = -1;
                        int index5 = -1;

                        index  = ImageName.IndexOf("ProfilePhoto");
                        index2 = ImageName.IndexOf("OneStorePhoto");
                        index3 = ImageName.IndexOf("StoreLogo");
                        index4 = ImageName.IndexOf("TwoStorePhoto");
                        index5 = ImageName.IndexOf("ThreeStorePhoto");


                        if (index == 0)
                        {
                            ProfileImageName    = ImageName.Substring(ImageName.LastIndexOf("/") + 1);
                            ProfilePhoto        = ImageName.Substring(index + 12);
                            profileimage.Source = ProfilePhoto;
                        }
                        else if (index2 == 0)
                        {
                            StoreImageName    = ImageName.Substring(ImageName.LastIndexOf("/") + 1);
                            StoreImage        = ImageName.Substring(index + 14);
                            storephoto.Source = StoreImage;
                        }
                        else if (index3 == 0)
                        {
                            LogoImageName = ImageName.Substring(ImageName.LastIndexOf("/") + 1);
                            StoreLogo     = ImageName.Substring(index + 10);
                            logo.Source   = StoreLogo;
                        }
                        else if (index4 == 0)
                        {
                            StoreImageName2    = ImageName.Substring(ImageName.LastIndexOf("/") + 1);
                            StoreImage2        = ImageName.Substring(index + 14);
                            storephoto2.Source = StoreImage2;
                        }
                        else if (index5 == 0)
                        {
                            StoreImageName3    = ImageName.Substring(ImageName.LastIndexOf("/") + 1);
                            StoreImage3        = ImageName.Substring(index + 16);
                            storephoto3.Source = StoreImage3;
                        }



                        //  ImageName2 = await AzureStorage.UploadFileAsync(ContainerType.Image, new MemoryStream(byteArray.ToArray()));
                    }

                    ab    = false;
                    value = null;
                });
                businesscategory.Text = string.Empty;
                subcategory.Text      = string.Empty;
                CategoryString        = string.Empty;
                SubCategorystring     = string.Empty;
                SendData = "";

                //memberDatabase = new MemberDatabase();
                //var members = memberDatabase.GetCatSubCa();
                //foreach (CategorySubCat var1 in members)
                //{
                //    SendData = SendData + var1.Id + "|" + var1.SubCategoryId + "@";
                //    CategoryString = CategoryString + " " + var1.CategoryName;
                //    SubCategorystring = SubCategorystring + " " + var1.SubCategory;
                //}

                //businesscategory.Text = CategoryString;
                //subcategory.Text = SubCategorystring;
                businesscategory.Text = string.Empty;
                subcategory.Text      = string.Empty;
                CategoryString        = string.Empty;
                SubCategorystring     = string.Empty;

                memberDatabase = new MemberDatabase();
                var members = memberDatabase.GetCatSubCa();

                string catname = "";

                foreach (CategorySubCat var1 in members.Where(c => c.SubTextColor == "#FF0000"))
                {
                    catname = var1.CategoryName;
                    if (SendData.Contains(var1.CategoryID))
                    {
                        SendData = SendData + "`" + var1.SubCategoryID;
                    }
                    else
                    {
                        SendData = SendData + "@" + var1.CategoryID + "|" + "`" + var1.SubCategoryID;
                    }

                    SubCategorystring = SubCategorystring + " " + var1.SubCategoryName;

                    if (!CategoryString.Contains(catname))
                    {
                        CategoryString = CategoryString + " " + var1.CategoryName;
                    }
                }

                businesscategory.Text = CategoryString;
                subcategory.Text      = SubCategorystring;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
コード例 #2
0
        private void lstView2_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            var dataItem      = e.Item as CategorySubC1;
            var CategoryID    = dataItem.CategoryID;
            var SubCategory   = dataItem.SubCategoryName;
            var SubCategoryID = dataItem.SubCategoryID;

            var clr = dataItem.SubTextColor.ToString();


            if (clr == "[Color: A=1, R=0, G=0, B=0, Hue=0, Saturation=0, Luminosity=0]")
            {
                subcategory           = subcategory + "`" + dataItem.SubCategoryName;
                dataItem.SubTextColor = Color.Red;
                dataItem.img          = ImageSource.FromFile("TickRed.png");
                dataItem.OnPropertyChanged();

                catsubcat1      = new CategorySubCat();
                memberDatabase1 = new MemberDatabase();
                catsubcat1      = new CategorySubCat();
                var members = memberDatabase1.GetCatSubCa(SubCategoryID);

                foreach (var a in members)
                {
                    catsubcat1.Id              = a.Id;
                    catsubcat1.CategoryName    = a.CategoryName;
                    catsubcat1.CategoryID      = a.CategoryID;
                    catsubcat1.SubCategoryName = a.SubCategoryName;
                    catsubcat1.SubCategoryID   = a.SubCategoryID;
                    catsubcat1.img             = "TickRed.png";
                    catsubcat1.SubTextColor    = "#FF0000";
                }

                if (members.Any())
                {
                    memberDatabase1.UpdateCategorySub(catsubcat1);
                }
                else
                {
                    memberDatabase1.AddCategorySub(catsubcat1);
                }
            }
            else if (clr == "[Color: A=1, R=1, G=0, B=0, Hue=1, Saturation=1, Luminosity=0.5]")
            {
                subcategory           = subcategory + "`" + dataItem.SubCategoryName;
                dataItem.SubTextColor = Color.Black;
                dataItem.img          = ImageSource.FromFile("");
                dataItem.OnPropertyChanged();

                catsubcat1      = new CategorySubCat();
                memberDatabase1 = new MemberDatabase();
                catsubcat1      = new CategorySubCat();
                var members = memberDatabase1.GetCatSubCa(SubCategoryID);

                foreach (var a in members)
                {
                    catsubcat1.Id              = a.Id;
                    catsubcat1.CategoryName    = a.CategoryName;
                    catsubcat1.CategoryID      = a.CategoryID;
                    catsubcat1.SubCategoryName = a.SubCategoryName;
                    catsubcat1.SubCategoryID   = a.SubCategoryID;
                    catsubcat1.img             = "";
                    catsubcat1.SubTextColor    = "#000000";
                }

                if (members.Any())
                {
                    memberDatabase1.UpdateCategorySub(catsubcat1);
                }
                else
                {
                    memberDatabase1.AddCategorySub(catsubcat1);
                }
            }
        }