private void UpdateAvailableDays()
        {
            CustomListPickerItem        day = this.Day;
            List <CustomListPickerItem> customListPickerItemList = new List <CustomListPickerItem>();
            CustomListPickerItem        customListPickerItem     = new CustomListPickerItem();

            customListPickerItem.Name      = CommonResources.NotDefined;
            customListPickerItem.IsUnknown = true;
            long num1 = 0;

            customListPickerItem.Id = num1;
            customListPickerItemList.Add(customListPickerItem);
            List <CustomListPickerItem> source = customListPickerItemList;
            int num2 = 31;

            if (this.Year != null && this.Month != null && (this.Year.Id != 0L && this.Month.Id != 0L))
            {
                num2 = DateTime.DaysInMonth(Convert.ToInt32(this.Year.Id), Convert.ToInt32(this.Month.Id));
            }
            for (int index = 1; index <= num2; ++index)
            {
                source.Add(new CustomListPickerItem()
                {
                    Name = index.ToString(),
                    Id   = (long)index
                });
            }
            this.AvailableDays = source;
            this.Day           = day == null || day.Id > (long)num2 ? source.First <CustomListPickerItem>() : source.First <CustomListPickerItem>((Func <CustomListPickerItem, bool>)(d => d.Id == day.Id));
        }
 public void Read(CommunitySettings information)
 {
     if (information.Type != GroupType.PublicPage)
     {
         this.Visibility = Visibility.Collapsed;
     }
     else
     {
         this.Title = information.public_date_label;
         if (this.Title.EndsWith(":"))
         {
             this.Title = this.Title.Substring(0, this.Title.Length - 1);
         }
         List <CustomListPickerItem> customListPickerItemList = new List <CustomListPickerItem>();
         CustomListPickerItem        customListPickerItem     = new CustomListPickerItem();
         customListPickerItem.Name      = CommonResources.NotDefined;
         customListPickerItem.IsUnknown = true;
         long num = 0;
         customListPickerItem.Id = num;
         customListPickerItemList.Add(customListPickerItem);
         this.AvailableYears = customListPickerItemList;
         for (int year = DateTime.Now.Year; year >= 1800; --year)
         {
             this.AvailableYears.Add(new CustomListPickerItem()
             {
                 Name = year.ToString(),
                 Id   = (long)year
             });
         }
         string[] date = information.public_date.Split('.');
         this.Month = this.AvailableMonths[int.Parse(date[1])];
         if (date.Length > 2)
         {
             this.Year = this.AvailableYears.FirstOrDefault <CustomListPickerItem>((Func <CustomListPickerItem, bool>)(y => y.Id == (long)int.Parse(date[2])));
         }
         if (this.Year == null)
         {
             this.Year = this.AvailableYears.First <CustomListPickerItem>();
         }
         this.UpdateAvailableDays();
         this.Day = this.AvailableDays[int.Parse(date[0])];
     }
 }
 public void Read(CommunitySettings information)
 {
     this.Name        = Extensions.ForUI(information.title);
     this.Description = Extensions.ForUI(information.description);
     this.Domain      = this.CurrentDomain = information.address;
     this.Site        = Extensions.ForUI(information.website);
     if (information.Type != GroupType.PublicPage)
     {
         this.CategoryTitle       = CommonResources.CommunitySubject;
         this.CategoryPlaceholder = CommonResources.SelectSubject;
         information.subject_list.Insert(0, new Section()
         {
             id   = 0,
             name = CommonResources.NoneSelected
         });
         this.AvailableCategories = information.subject_list.Select <Section, CustomListPickerItem>((Func <Section, CustomListPickerItem>)(c =>
         {
             CustomListPickerItem customListPickerItem = new CustomListPickerItem();
             customListPickerItem.Name = c.name;
             customListPickerItem.Id   = c.id;
             int num = c.id == 0L ? 1 : 0;
             customListPickerItem.IsUnknown = num != 0;
             return(customListPickerItem);
         })).ToList <CustomListPickerItem>();
         this.Category = this.AvailableCategories.First <CustomListPickerItem>((Func <CustomListPickerItem, bool>)(c => c.Id == information.subject));
     }
     else
     {
         this.CategoryTitle       = CommonResources.PublicPageCategory;
         this.CategoryPlaceholder = CommonResources.SelectCategory;
         for (int index = 1; index < information.public_category_list.Count; ++index)
         {
             List <Section> subtypesList = information.public_category_list[index].subtypes_list;
             if (subtypesList != null && subtypesList.Any <Section>())
             {
                 subtypesList.First <Section>().name = CommonResources.NoneSelected;
             }
         }
         information.public_category_list.First <Section>().name = CommonResources.NoneSelected;
         this._publicPageCategories = information.public_category_list;
         this.AvailableCategories   = information.public_category_list.Select <Section, CustomListPickerItem>((Func <Section, CustomListPickerItem>)(c =>
         {
             CustomListPickerItem customListPickerItem = new CustomListPickerItem();
             customListPickerItem.Name = c.name;
             customListPickerItem.Id   = c.id;
             int num = c.id == 0L ? 1 : 0;
             customListPickerItem.IsUnknown = num != 0;
             return(customListPickerItem);
         })).ToList <CustomListPickerItem>();
         this.Category = this.AvailableCategories.First <CustomListPickerItem>((Func <CustomListPickerItem, bool>)(c => c.Id == information.public_category));
         if (this.Category.Id == 0L)
         {
             return;
         }
         List <CustomListPickerItem> availableSubcategories = this.AvailableSubcategories;
         CustomListPickerItem        customListPickerItem1;
         if (availableSubcategories == null)
         {
             customListPickerItem1 = (CustomListPickerItem)null;
         }
         else
         {
             Func <CustomListPickerItem, bool> predicate = (Func <CustomListPickerItem, bool>)(s => s.Id == information.public_subcategory);
             customListPickerItem1 = availableSubcategories.First <CustomListPickerItem>(predicate);
         }
         this.Subcategory = customListPickerItem1;
     }
 }
        public FoundationDateViewModel(InformationViewModel parentViewModel)
        {
            List <CustomListPickerItem> customListPickerItemList = new List <CustomListPickerItem>();
            CustomListPickerItem        customListPickerItem     = new CustomListPickerItem();

            customListPickerItem.Name = FoundationDateViewModel.HandleCase(CommonResources.NotDefined);
            int num1 = 1;

            customListPickerItem.IsUnknown = num1 != 0;
            long num2 = 0;

            customListPickerItem.Id = num2;
            customListPickerItemList.Add(customListPickerItem);
            customListPickerItemList.Add(new CustomListPickerItem()
            {
                Name = FoundationDateViewModel.HandleCase(CommonResources.OfJanuary),
                Id   = 1L
            });
            customListPickerItemList.Add(new CustomListPickerItem()
            {
                Name = FoundationDateViewModel.HandleCase(CommonResources.OfFebruary),
                Id   = 2L
            });
            customListPickerItemList.Add(new CustomListPickerItem()
            {
                Name = FoundationDateViewModel.HandleCase(CommonResources.OfMarch),
                Id   = 3L
            });
            customListPickerItemList.Add(new CustomListPickerItem()
            {
                Name = FoundationDateViewModel.HandleCase(CommonResources.OfApril),
                Id   = 4L
            });
            customListPickerItemList.Add(new CustomListPickerItem()
            {
                Name = FoundationDateViewModel.HandleCase(CommonResources.OfMay),
                Id   = 5L
            });
            customListPickerItemList.Add(new CustomListPickerItem()
            {
                Name = FoundationDateViewModel.HandleCase(CommonResources.OfJune),
                Id   = 6L
            });
            customListPickerItemList.Add(new CustomListPickerItem()
            {
                Name = FoundationDateViewModel.HandleCase(CommonResources.OfJuly),
                Id   = 7L
            });
            customListPickerItemList.Add(new CustomListPickerItem()
            {
                Name = FoundationDateViewModel.HandleCase(CommonResources.OfAugust),
                Id   = 8L
            });
            customListPickerItemList.Add(new CustomListPickerItem()
            {
                Name = FoundationDateViewModel.HandleCase(CommonResources.OfSeptember),
                Id   = 9L
            });
            customListPickerItemList.Add(new CustomListPickerItem()
            {
                Name = FoundationDateViewModel.HandleCase(CommonResources.OfOctober),
                Id   = 10L
            });
            customListPickerItemList.Add(new CustomListPickerItem()
            {
                Name = FoundationDateViewModel.HandleCase(CommonResources.OfNovember),
                Id   = 11L
            });
            customListPickerItemList.Add(new CustomListPickerItem()
            {
                Name = FoundationDateViewModel.HandleCase(CommonResources.OfDecember),
                Id   = 12L
            });
            this.AvailableMonths = customListPickerItemList;
            // ISSUE: explicit constructor call
            //base.\u002Ector();
            this.ParentViewModel = parentViewModel;
        }
        public void SaveChanges()
        {
            this.SetInProgress(true, "");
            this.IsFormEnabled = false;
            string str1 = this.CommonFieldsViewModel.Domain != this.CommonFieldsViewModel.CurrentDomain ? this.CommonFieldsViewModel.Domain : (string)null;

            if (str1 == "")
            {
                str1 = "club" + (object)this.CommunityId;
            }
            int  num1      = 0;
            bool?nullable1 = this.CommunityTypeSelectionViewModel.IsClosedSelected;
            bool flag1     = true;

            if ((nullable1.GetValueOrDefault() == flag1 ? (nullable1.HasValue ? 1 : 0) : 0) != 0)
            {
                num1 = 1;
            }
            nullable1 = this.CommunityTypeSelectionViewModel.IsPrivateSelected;
            bool flag2 = true;

            if ((nullable1.GetValueOrDefault() == flag2 ? (nullable1.HasValue ? 1 : 0) : 0) != 0)
            {
                num1 = 2;
            }
            int num2 = 1;

            nullable1 = this.AgeLimitsViewModel.From16Only;
            bool flag3 = true;

            if ((nullable1.GetValueOrDefault() == flag3 ? (nullable1.HasValue ? 1 : 0) : 0) != 0)
            {
                num2 = 2;
            }
            nullable1 = this.AgeLimitsViewModel.From18Only;
            bool flag4 = true;

            if ((nullable1.GetValueOrDefault() == flag4 ? (nullable1.HasValue ? 1 : 0) : 0) != 0)
            {
                num2 = 3;
            }
            string str2 = (string)null;

            if (this._information.Type == GroupType.PublicPage)
            {
                string str3 = this.FoundationDateViewModel.Day.Id.ToString();
                string str4 = this.FoundationDateViewModel.Month.Id.ToString();
                string str5 = this.FoundationDateViewModel.Year.Id.ToString();
                if (str3.Length == 1)
                {
                    str3 = "0" + str3;
                }
                if (str4.Length == 1)
                {
                    str4 = "0" + str4;
                }
                if (str5.Length == 1)
                {
                    str5 = "0000";
                }
                str2 = string.Format("{0}.{1}.{2}", (object)str3, (object)str4, (object)str5);
            }
            GroupPrivacy accessLevel = GroupPrivacy.Public;

            if (num1 == 1)
            {
                accessLevel = GroupPrivacy.Closed;
            }
            if (num1 == 2)
            {
                accessLevel = GroupPrivacy.Private;
            }
            string categoryName    = (string)null;
            string subcategoryName = (string)null;

            if (this.CommonFieldsViewModel.Category != null && this.CommonFieldsViewModel.Category.Id != 0L)
            {
                categoryName = this.CommonFieldsViewModel.Category.Name;
            }
            if (this.CommonFieldsViewModel.Subcategory != null && this.CommonFieldsViewModel.Subcategory.Id != 0L)
            {
                subcategoryName = this.CommonFieldsViewModel.Subcategory.Name;
            }
            long?    nullable2      = new long?();
            DateTime eventStartDate = new DateTime();
            DateTime dateTime       = new DateTime();

            if (this._information.Type == GroupType.Event)
            {
                nullable2 = new long?(this.EventOrganizerViewModel.Organizer.Id < 0L ? -this.EventOrganizerViewModel.Organizer.Id : 0L);
                DateTime startDate = this.EventDatesViewModel.StartDate;
                DateTime startTime = this.EventDatesViewModel.StartTime;
                eventStartDate = new DateTime(startDate.Year, startDate.Month, startDate.Day, startTime.Hour, startTime.Minute, 0, DateTimeKind.Local);
                DateTime finishDate = this.EventDatesViewModel.FinishDate;
                DateTime finishTime = this.EventDatesViewModel.FinishTime;
                dateTime = new DateTime(finishDate.Year, finishDate.Month, finishDate.Day, finishTime.Hour, finishTime.Minute, 0, DateTimeKind.Local);
            }
            GroupsService        current      = GroupsService.Current;
            long                 communityId  = this.CommunityId;
            string               name         = this.CommonFieldsViewModel.Name;
            string               description  = this.CommonFieldsViewModel.Description;
            long                 id           = this.CommonFieldsViewModel.Category.Id;
            CustomListPickerItem subcategory1 = this.CommonFieldsViewModel.Subcategory;
            long                 subcategory2 = subcategory1 != null ? subcategory1.Id : 0L;
            string               site         = this.CommonFieldsViewModel.Site;
            int    accessLevel1     = num1;
            string domain           = str1;
            int    ageLimits        = num2;
            string foundationDate   = str2;
            long?  eventOrganizerId = nullable2;
            string phone            = this.EventOrganizerViewModel.Phone;
            string email            = this.EventOrganizerViewModel.Email;
            int    unixTimestamp1   = Extensions.DateTimeToUnixTimestamp(eventStartDate.ToUniversalTime(), false);
            int    unixTimestamp2   = Extensions.DateTimeToUnixTimestamp(dateTime.ToUniversalTime(), false);
            Action <BackendResult <int, ResultCode> > callback = (Action <BackendResult <int, ResultCode> >)(result => Execute.ExecuteOnUIThread((Action)(() =>
            {
                if (result.ResultCode == ResultCode.Succeeded)
                {
                    EventAggregator.Current.Publish((object)new CommunityInformationChanged()
                    {
                        Id = this.CommunityId,
                        Name = this.CommonFieldsViewModel.Name,
                        Privacy = accessLevel,
                        CategoryName = categoryName,
                        SubcategoryName = subcategoryName,
                        EventStartDate = eventStartDate
                    });
                    Navigator.Current.GoBack();
                }
                else
                {
                    this.SetInProgress(false, "");
                    this.IsFormEnabled = true;
                    VKRequestsDispatcher.Error error = result.Error;
                    switch (error != null ? error.error_text : (string)null)
                    {
                    case null:
                        GenericInfoUC.ShowBasedOnResult((int)result.ResultCode, "", result.Error);
                        break;

                    default:
                        result.Error.error_text += ".";
                        goto case null;
                    }
                }
            })));

            current.SetCommunityInformation(communityId, name, description, id, subcategory2, site, accessLevel1, domain, ageLimits, foundationDate, eventOrganizerId, phone, email, unixTimestamp1, unixTimestamp2, callback);
        }