/// <summary>
        /// Sets the defaults for all accessibility AppContext switches.
        /// </summary>
        /// <remarks>
        /// Only call this method from within AppContextDefaultValues.PopulateDefaultValuesPartial.
        /// This ensures defaults are set only under the lock from AppContextDefaultValues.
        /// </remarks>
        /// <param name="targetFrameworkVersion"></param>
        internal static void SetSwitchDefaults(int targetFrameworkVersion)
        {
            if (Interlocked.CompareExchange(ref s_DefaultsSet, 1, 0) == 0)
            {
// The AppContext analyzer expects an enclosing statement like this
// switch (platformIdentifier) {
//        case ".NETFramework": ...
// }
// The caller of this method has such a statement, but the analyzer isn't aware so we have to disable this warning here.
#pragma warning disable BCL0012

                if (targetFrameworkVersion <= 40700)
                {
                    LocalAppContext.DefineSwitchDefault(UseLegacyAccessibilityFeaturesSwitchName, true);
                }

                if (targetFrameworkVersion <= 40701)
                {
                    LocalAppContext.DefineSwitchDefault(UseLegacyAccessibilityFeatures2SwitchName, true);
                }

                if (targetFrameworkVersion <= 40702)
                {
                    LocalAppContext.DefineSwitchDefault(UseLegacyAccessibilityFeatures3SwitchName, true);
                    LocalAppContext.DefineSwitchDefault(UseLegacyToolTipDisplaySwitchName, true);
                    LocalAppContext.DefineSwitchDefault(ItemsControlDoesNotSupportAutomationSwitchName, true);
                }

#pragma warning restore BCL0012
            }
        }
        public static void SetDefaultsLessOrEqual_46()
        {
#pragma warning disable BCL0012
            // Define the switches that should be true for 4.6 or less, false for 4.6.1+.
            LocalAppContext.DefineSwitchDefault(DisableMultipleDNSEntriesInSANCertificateString, true);
#pragma warning restore BCL0012
        }
Beispiel #3
0
        public static void SetDefaultsLessOrEqual_46()
        {
#pragma warning disable BCL0012 //disable warning about AppContextDefaults not following the recommended pattern
            // Define the switches that should be true for 4.6 or less, false for 4.6.1+.
            LocalAppContext.DefineSwitchDefault(UseLegacyRegExTimeoutString, true);
#pragma warning restore BCL0012
        }
        public static void SetDefaultsLessOrEqual_452()
        {
#pragma warning disable BCL0012
            // Define the switches that should be true for 4.5.2 or less, false for 4.6+.
            LocalAppContext.DefineSwitchDefault(DisableExplicitConnectionCloseHeaderString, true);
#pragma warning restore BCL0012
        }
        public static void SetDefaultsLessOrEqual_452()
        {
#pragma warning disable BCL0012
            // Define the switches that should be true for 4.5.2 or less, false for 4.6+.
            LocalAppContext.DefineSwitchDefault(EnableCachedEmptyDefaultAuthorizationContextString, true);
#pragma warning restore BCL0012
        }
        public static void SetDefaultsLessOrEqual_461()
        {
#pragma warning disable BCL0012
            // Define the switches that should be true for 4.6.1 or less, false for 4.6.2+.
            LocalAppContext.DefineSwitchDefault(DisableCngCertificatesString, true);
#pragma warning restore BCL0012
        }
        public MainWindowViewModel()
        {
            // mainWindow = window;
            db = new LocalAppContext();
            try
            {
                var church = db.Churches.FirstOrDefault();
                if (church == null)
                {
                    db.Churches.Add(new Church
                    {
                        Name    = "Default",
                        Email   = "*****@*****.**",
                        Phone   = "00000",
                        Address = "#Self",
                    });
                }

                var users = db.Users.FirstOrDefault();
                if (users == null)
                {
                    db.Users.Add(new User
                    {
                        FirstName = "default",
                        LastName  = "",
                        Password  = "******"
                    });
                }

                var setting = db.Settings.FirstOrDefault();
                if (setting == null)
                {
                    db.Settings.Add(new Setting()
                    {
                        MaxGroupNumber = 5,
                        MaxClassNumber = int.MaxValue,
                    });
                }

                var masterPassword = db.MasterPasswords.FirstOrDefault();
                if (masterPassword == null)
                {
                    db.MasterPasswords.Add(new MasterPassword()
                    {
                        Password = "******"
                    });
                }


                db.SaveChanges();
            }
            catch { }


            LoadChurches();
            LoginCommand         = new RelayCommand(Login_E, Login_C);
            CurrentPage          = ApplicationPage.Login;
            _CurrentPageChanged += CurrentPage_Changed;
        }
        public SettingsViewModel()
        {
            db      = DashBoardViewModel.db;
            setting = db.Settings.FirstOrDefault();

            MaxGroupNumber = setting.MaxGroupNumber == int.MaxValue ? "Unlimited" : setting.MaxGroupNumber.ToString();
            MaxClassNumber = setting.MaxClassNumber == int.MaxValue ? "Unlimited" : setting.MaxClassNumber.ToString();
        }
 public MasterPasswordWindow(DashBoardPages page, bool isPage = true)
 {
     InitializeComponent();
     db        = new LocalAppContext();
     passWord  = GetPassword();
     IsPage    = isPage;
     this.page = page;
 }
Beispiel #10
0
        public DashBoardViewModel()
        {
            PageChanged += DashBoardViewModel_PageChanged;

            try
            {
                db = MainWindowViewModel.db;

                //set the current Church as the first on in the Church list
                //Change this later

                if (MainWindowViewModel.selectedChurch != null)//currentChurch != null
                {
                    OpenChurches   = new RelayCommand(this.oChurches_E, this.Generic_C);
                    SelectedChurch = MainWindowViewModel.selectedChurch;
                    CurrentUser    = MainWindowViewModel.currentUser;
                    ChurchName     = SelectedChurch.Name;
                    AllPeople      = new ObservableCollection <Person>(SelectedChurch.People);
                    OpenClients    = new RelayCommand(_ => { OpenPage(DashBoardPages.PeoplePage); }, this.Generic_C);
                    OpenServices   = new RelayCommand(_ => { OpenPage(DashBoardPages.GroupsPage); }, this.Generic_C);
                    OpenFamilies   = new RelayCommand(_ => { OpenPage(DashBoardPages.FamilyPage); }, Generic_C);
                    OpenReports    = new RelayCommand(_ => { OpenPage(DashBoardPages.ReportsPage); }, Generic_C);
                    OpenAttendance = new RelayCommand(_ => { OpenPage(DashBoardPages.AttendancePage); }, Generic_C);

                    RefreshAllPeople = new RelayCommand(this.refreshCs_E, this.refreshCs_C);
                    LogoutCommand    = new RelayCommand(t =>
                    {
                        if (MessageBox.Show("Are you sure you want to log out of the Application", "Confirm Logout", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                        {
                            LoginPage.IsLoggedOut            = true;
                            MainWindowViewModel._CurrentPage = ApplicationPage.Login;
                        }
                    });
                    OpenUsers = new RelayCommand(oUsers_E, Generic_C);


                    //GetLogo(SelectedChurch.Logo);
                    Logo = SelectedChurch.Logo;
                }
                else
                {
                    MessageBox.Show("Please Select a Church", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    MainWindowViewModel.currentPage = ApplicationPage.Login;
                }
            }
            catch
            {
                // MessageBox.Show("");
            }
        }
Beispiel #11
0
        /// <summary>
        /// Sets the defaults for all accessibility AppContext switches.
        /// </summary>
        /// <remarks>
        /// Only call this method from within AppContextDefaultValues.PopulateDefaultValuesPartial.
        /// This ensures defaults are set only under the lock from AppContextDefaultValues.
        /// </remarks>
        /// <param name="targetFrameworkVersion"></param>
        internal static void SetSwitchDefaults(int targetFrameworkVersion)
        {
            if (Interlocked.CompareExchange(ref s_DefaultsSet, 1, 0) == 0)
            {
                if (targetFrameworkVersion <= 40700)
                {
                    LocalAppContext.DefineSwitchDefault(UseLegacyAccessibilityFeaturesSwitchName, true);
                }

                if (targetFrameworkVersion <= 40701)
                {
                    LocalAppContext.DefineSwitchDefault(UseLegacyAccessibilityFeatures2SwitchName, true);
                }
            }
        }
        static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version)
        {
            switch (platformIdentifier)
            {
            case ".NETFramework":
            {
                // All previous versions of that platform (up-to 4.7) will get the old behavior by default
                if (version <= 40700)
                {
                    LocalAppContext.DefineSwitchDefault(UseMD5ForDefaultHashAlgorithmSwitchString, true);
                }

                break;
            }
            }
        }
Beispiel #13
0
        static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version)
        {
            switch (platformIdentifier)
            {
            case ".NETCore":
            case ".NETFramework":
            {
                // All previous versions of that platform (up-to 4.6.2) will get the old behavior by default
                if (version <= 40602)
                {
                    LocalAppContext.DefineSwitchDefault("Switch.System.Activities.UseMD5ForWFDebugger", true);
                }

                break;
            }
            }
        }
Beispiel #14
0
        static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version)
        {
            switch (platformIdentifier)
            {
            case ".NETCore":
            case ".NETFramework":
            {
                // All previous versions of that platform (up thru 4.7.2) will get the old behavior by default
                if (version <= 40702)
                {
                    // This switch needs to be set in the MSBuild.Exe.Config that is used to build the project.
                    LocalAppContext.DefineSwitchDefault(@"Switch.System.Workflow.ComponentModel.UseLegacyHashForXomlFileChecksum", true);
                }

                break;
            }
            }
        }
        static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version)
        {
            switch (platformIdentifier)
            {
            case ".NETCore":
            case ".NETFramework":
            {
                // All previous versions of that platform (up thru 4.7.2) will get the old behavior by default
                if (version <= 40702)
                {
                    LocalAppContext.DefineSwitchDefault(@"Switch.System.Workflow.Runtime.UseLegacyHashForWorkflowDefinitionDispenserCacheKey", true);
                    LocalAppContext.DefineSwitchDefault(@"Switch.System.Workflow.Runtime.UseLegacyHashForSqlTrackingCacheKey", true);
                }

                break;
            }
            }
        }
 private static void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version)
 {
     if (platformIdentifier != ".NETCore" && platformIdentifier != ".NETFramework")
     {
         if (!(platformIdentifier == "WindowsPhone") && !(platformIdentifier == "WindowsPhoneApp"))
         {
             return;
         }
         if (version <= 80100)
         {
             LocalAppContext.DefineSwitchDefault("Switch.System.IO.Compression.ZipFile.UseBackslash", true);
         }
     }
     else if (version <= 40600)
     {
         LocalAppContext.DefineSwitchDefault("Switch.System.IO.Compression.ZipFile.UseBackslash", true);
         return;
     }
 }
        private async void DashBoardViewModel_BirthDayCountCountChanged(object sender, EventArgs e)
        {
            int tempNumber = 0;
            await Task.Run(() =>
            {
                try
                {
                    tempNumber = new LocalAppContext().People.Where(p => p.DateOfBirth.Day == DateTime.Now.Day && p.DateOfBirth.Month == DateTime.Now.Month).Count();
                }
                catch (Exception ex) { }
            });

            if (tempNumber != 0)
            {
                btnBirthDayNotification.Count = tempNumber.ToString();
            }
            else if (tempNumber == 0)
            {
                btnBirthDayNotification.Count = "";
            }
        }
Beispiel #18
0
 static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version)
 {
     // When defining a new switch  you should add it to the last known version.
     // For instance, if you are adding a switch in .NET 4.6 (the release after 4.5.2) you should defined your switch
     // like this:
     //    if (version <= 40502) ...
     // This ensures that all previous versions of that platform (up-to 4.5.2) will get the old behavior by default
     // NOTE: When adding a default value for a switch please make sure that the default value is added to ALL of the existing platforms!
     // NOTE: When adding a new if statement for the version please ensure that ALL previous switches are enabled (ie. don't use else if)
     switch (platformIdentifier)
     {
     case ".NETCore":
     case ".NETFramework":
     {
         if (version <= 40700)
         {
             LocalAppContext.DefineSwitchDefault(LocalAppContextSwitches.DontThrowExceptionsOnStartName, true);
         }
         break;
     }
     }
 }
Beispiel #19
0
        /// <summary>
        /// Sets the defaults for all accessibility AppContext switches.
        /// </summary>
        /// <remarks>
        /// Only call this method from within AppContextDefaultValues.PopulateDefaultValuesPartial.
        /// This ensures defaults are set only under the lock from AppContextDefaultValues.
        /// </remarks>
        /// <param name="platformIdentifier"></param>
        /// <param name="targetFrameworkVersion"></param>
        internal static void SetSwitchDefaults(string platformIdentifier, int targetFrameworkVersion)
        {
            switch (platformIdentifier)
            {
            case ".NETFramework":
                if (Interlocked.CompareExchange(ref s_DefaultsSet, 1, 0) == 0)
                {
                    if (targetFrameworkVersion <= 40700)
                    {
                        LocalAppContext.DefineSwitchDefault(UseLegacyAccessibilityFeaturesSwitchName, true);
                    }

                    if (targetFrameworkVersion <= 40701)
                    {
                        LocalAppContext.DefineSwitchDefault(UseLegacyAccessibilityFeatures2SwitchName, true);
                    }

                    if (targetFrameworkVersion <= 40702)
                    {
                        LocalAppContext.DefineSwitchDefault(UseLegacyAccessibilityFeatures3SwitchName, true);
                        LocalAppContext.DefineSwitchDefault(UseLegacyToolTipDisplaySwitchName, true);
                        LocalAppContext.DefineSwitchDefault(ItemsControlDoesNotSupportAutomationSwitchName, true);
                    }
                }
                break;

            case ".NETCoreApp":
            {
                LocalAppContext.DefineSwitchDefault(UseLegacyAccessibilityFeaturesSwitchName, false);
                LocalAppContext.DefineSwitchDefault(UseLegacyAccessibilityFeatures2SwitchName, false);
                LocalAppContext.DefineSwitchDefault(UseLegacyAccessibilityFeatures3SwitchName, false);
                LocalAppContext.DefineSwitchDefault(UseLegacyToolTipDisplaySwitchName, false);
                LocalAppContext.DefineSwitchDefault(ItemsControlDoesNotSupportAutomationSwitchName, false);
            }
            break;
            }
        }
        static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version)
        {
            switch (platformIdentifier)
            {
                case ".NETCore":
                case ".NETFramework":
                    {
                        // All previous versions of that platform (up-to 4.6.2) will get the old behavior by default 
                        if (version <= 40602)
                        {
                            LocalAppContext.DefineSwitchDefault("Switch.System.Activities.UseMD5ForWFDebugger", true);
                        }

                        if (version <= 40702)
                        {
                            LocalAppContext.DefineSwitchDefault("Switch.System.Activities.UseSHA1HashForDebuggerSymbols", true);
                        }

                        // Switch.System.Activities.TerminateOnUnhandledExceptionDuringCancel is an opt-in quirk,
                        // so the default value is FALSE for all versions.
                        break;
                    }
            }
        }
        public bool generateReport(string period, Area area = null)
        {
            if (period != "TillDate")
            {
                if (HasErrors("report"))
                {
                    return(false);
                }
            }

            DateTime             ReportDate;
            ReportType           type;
            IEnumerable <Report> ReportedPeople = new List <Report>();

            setReportedPeople();

            if (area == null)
            {
                var collection = new ListCollectionView(new ObservableCollection <Report>(ReportedPeople));
                collection.GroupDescriptions.Add(new PropertyGroupDescription("Person.Group.Area"));
                Report = collection;
            }

            //Checks if the passed in Date conforms to the report to be generated
            bool IsInTime(DateTime Date)
            {
                bool allowed = false;

                switch (period)
                {
                case "Yearly":
                    type = ReportType.Yearly;
                    if (Date != null)
                    {
                        allowed = Date.Year == Year;
                    }
                    break;

                case "Monthly":
                    if (Date != null)
                    {
                        allowed = Date.Year == Year && Date.Month == Month;
                    }
                    type = ReportType.Monthly;
                    break;

                case "Halfly":
                    type = ReportType.Halfly;
                    if (Date != null)
                    {
                        if (Half == "1st")
                        {
                            allowed = Date.Year == Year && Date.Month > 0 && Date.Month <= 6;
                        }
                        else if (Half == "2nd")
                        {
                            allowed = Date.Year == Year && Date.Month > 6 && Date.Month <= 12;
                        }
                    }
                    break;

                case "Quarterly":
                    type = ReportType.Halfly;
                    if (Date != null)
                    {
                        if (Quarter == "1st")
                        {
                            allowed = Date.Year == Year && Date.Month > 0 && Date.Month <= 3;
                        }
                        else if (Quarter == "2nd")
                        {
                            allowed = Date.Year == Year && Date.Month > 3 && Date.Month <= 6;
                        }
                        else if (Quarter == "3rd")
                        {
                            allowed = Date.Year == Year && Date.Month > 6 && Date.Month <= 9;
                        }
                        else if (Quarter == "4th")
                        {
                            allowed = Date.Year == Year && Date.Month > 9 && Date.Month <= 12;
                        }
                    }
                    break;

                case "TillDate":
                    if (Date != null)
                    {
                        allowed = Date.Year >= 2015 && Date.Year <= DateTime.Now.Year;
                    }
                    break;

                default:
                    break;
                }
                return(allowed);
            }

            //Sets The Report to be displayed on the UI
            void setReportedPeople()
            {
                if (area != null)
                {
                    var rawReports = new LocalAppContext().Reports.ToList().Where(r => IsInTime(r.ReportDate) && r.Person.Group.Area.AreaId == area.AreaId && r.Person.Service == "Adults");

                    ReportedPeople = FlattenReports(rawReports, true);
                    PrintOut       = new ObservableCollection <Report>(ReportedPeople);
                }
                else
                {
                    var rawReports = db.Reports.ToList().Where(r => IsInTime(r.ReportDate) && r.Person.Group.Area.ZoneId == zone.ZoneId && r.Person.Service == "Adults");

                    ReportedPeople = FlattenReports(rawReports);
                }

                IEnumerable <Report> FlattenReports(IEnumerable <Report> Reports, bool isPrintOut = false)
                {
                    var reports = new List <Report>();

                    foreach (var report in Reports)
                    {
                        if (isPrintOut)
                        {
                            report.Remark = "";
                        }
                        //Check if a report of this person has already been added
                        var tempReport = reports.Where(r => r.PersonId == report.PersonId).FirstOrDefault();

                        if (tempReport == null)
                        {
                            reports.Add(report);
                        }
                        else
                        {
                            tempReport.Sundays += report.Sundays;
                            tempReport.Fridays += report.Fridays;
                            tempReport.Sundays += report.Sundays;
                            tempReport.Remark   = report.Remark;
                        }
                    }
                    return(reports.OrderBy(p => p, new CompareReportedPeople()));
                }
            }

            return(true);
        }
Beispiel #22
0
 public static void SetDefaultsLessOrEqual_46()
 {
     // Define the switches that should be true for 4.6 or less, false for 4.6.1+.
     LocalAppContext.DefineSwitchDefault(UseLegacyRegExTimeoutString, true);
 }