Example #1
0
        /// <summary>
        /// v1.0.1 - Return AX setting updates
        /// </summary>
        /// <param name="beFields"></param>
        /// <returns></returns>
        public async Task <List <SettingDetails> > ReturnUpdatedSettings(List <SettingDetails> v_sdSettings)
        {
            List <SettingDetails> sdSettings = null;

            try
            {
                //WCF call requires observable collection instead of array.
                ObservableCollection <SettingDetails> ocSettings = new ObservableCollection <SettingDetails>(v_sdSettings);

                //Call function
                SettingsCheckResult scResult = await DependencyService.Get <IWcfExt116>().CheckForUpdatedSettingsAsync(
                    m_cCompanyName,
                    ocSettings,
                    Settings.p_sSetting_AuthID,
                    Session.Token);

                if (scResult != null)
                {
                    if (scResult.bSuccessfull == true)
                    {
                        sdSettings = new List <SettingDetails>(scResult.Settings);
                    }
                }

                return(sdSettings);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Example #2
0
        protected override MessageInteraction DetermineInteraction(SettingsCheckResult result)
        {
            bool withErrors  = !result.Result;
            var  withChanges = result.SettingsHaveChanged;

            if (!withChanges && !withErrors)
            {
                return(null);
            }

            if (withChanges && !withErrors)
            {
                return(null);
            }

            if (!withChanges && withErrors)
            {
                var title        = Translation.Settings;
                var text         = Translation.InvalidSettings;
                var buttons      = MessageOptions.YesNo;
                var userQuestion = Translation.WantToProceedAnyway;
                return(new MessageInteraction(text, title, buttons, MessageIcon.Warning, result.Result, userQuestion));
            }

            if (withChanges && withErrors)
            {
                var title        = Translation.Settings;
                var text         = Translation.InvalidSettingsWithUnsavedChanges;
                var buttons      = MessageOptions.YesNo;
                var userQuestion = Translation.WantToSaveAnyway;
                return(new MessageInteraction(text, title, buttons, MessageIcon.Warning, result.Result, userQuestion));
            }

            return(null);
        }
Example #3
0
        public async Task <SettingsCheckResult> CheckForUpdatedSettingsAsync(
            string v_sCompanyName,
            ObservableCollection <SettingDetails> v_svSettings,
            string v_sAuthID,
            string v_sToken)
        {
            m_wcfClient = new WcfExt116.ServiceClient();
            SettingsCheckResult result = new SettingsCheckResult();

            try
            {
                ObservableCollection <WcfExt116.SettingDetails> lSettingDetails = new ObservableCollection <WcfExt116.SettingDetails>();
                foreach (SettingDetails sd in v_svSettings)
                {
                    WcfExt116.SettingDetails oSD = new WcfExt116.SettingDetails();
                    oSD.LastUpdate   = sd.LastUpdate;
                    oSD.SettingName  = sd.SettingName;
                    oSD.SettingValue = sd.SettingValue;
                    lSettingDetails.Add(oSD);
                }
                WcfExt116.SettingsCheckResult sResult = await m_wcfClient.CheckForUpdatedSettingsAsync(
                    v_sCompanyName,
                    lSettingDetails,
                    v_sAuthID,
                    v_sToken);

                if (sResult.bSuccessfull == true)
                {
                    result.bSuccessfull = sResult.bSuccessfull;
                    result.Settings     = new ObservableCollection <SettingDetails>();
                    foreach (WcfExt116.SettingDetails o in sResult.Settings)
                    {
                        SettingDetails oSD = new SettingDetails();
                        oSD.LastUpdate   = o.LastUpdate;
                        oSD.SettingName  = o.SettingName;
                        oSD.SettingValue = o.SettingValue;
                        result.Settings.Add(oSD);
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        protected override MessageInteraction DetermineInteraction(SettingsCheckResult result)
        {
            bool withErrors  = !result.Result;
            var  withChanges = result.SettingsHaveChanged;

            if (!withChanges && !withErrors)
            {
                return(null);
            }

            if (withChanges && !withErrors)
            {
                var title = Translation.Settings;
                var text  = Translation.UnsavedChanges
                            + Environment.NewLine
                            + Translation.WantToSave
                            + Environment.NewLine
                            + Translation.ChooseNoToRevert;
                var buttons = MessageOptions.YesNoCancel;
                return(new MessageInteraction(text, title, buttons, MessageIcon.Question));
            }

            if (!withChanges && withErrors)
            {
                return(null);
            }

            if (withChanges && withErrors)
            {
                var title        = Translation.Settings;
                var text         = Translation.InvalidSettingsWithUnsavedChanges;
                var buttons      = MessageOptions.YesNoCancel;
                var userQuestion = Translation.WantToSaveAnyway
                                   + Environment.NewLine
                                   + Translation.ChooseNoToRevert;
                return(new MessageInteraction(text, title, buttons, MessageIcon.Warning, result.Result, userQuestion));
            }

            return(null);
        }
Example #5
0
 protected abstract MessageInteraction DetermineInteraction(SettingsCheckResult result);