Exemplo n.º 1
0
        /// <summary>
        /// Retrieve all the time zone definitions for the specified locale and to return only the <c>Display Name</c> attribute.
        /// <para>
        /// For more information look at https://msdn.microsoft.com/en-us/library/microsoft.crm.sdk.messages.getalltimezoneswithdisplaynamerequest(v=crm.8).aspx
        /// </para>
        /// </summary>
        /// <param name="localeId">
        /// <see cref="LocaleId"/> info.
        /// For more information look at https://msdn.microsoft.com/en-us/library/ms912047(WinEmbedded.10).aspx
        /// </param>
        /// <returns>
        /// <see cref="EntityCollection"/> for <c>Timezone</c> data
        /// </returns>
        public EntityCollection GetAllTimezoneData(LocaleId localeId)
        {
            GetAllTimeZonesWithDisplayNameRequest request = new GetAllTimeZonesWithDisplayNameRequest()
            {
                LocaleId = (int)localeId
            };

            var serviceResponse = (GetAllTimeZonesWithDisplayNameResponse)this.OrganizationService.Execute(request);

            return(serviceResponse.EntityCollection);
        }
Exemplo n.º 2
0
        public LocaleId GetLocale()
        {
            LocaleId result = LocaleId.English;

            if (Java.Util.Locale.Default.ToString().ToLower().Contains("de"))
            {
                result = LocaleId.German;
            }

            return(result);
        }
            /// <summary>
            /// Returns a hash code for the instantce.
            /// </summary>
            public override int GetHashCode()
            {
                int hash = LocaleId.GetHashCode();

                if (NodeId != null)
                {
                    hash ^= NodeId.GetHashCode();
                }

                return(hash);
            }
Exemplo n.º 4
0
        public PageMain()
        {
            InitializeComponent();
            Debug.LogToFileMethod();

            NavigationPage.SetHasBackButton(this, false);
            NavigationPage.SetHasNavigationBar(this, false);

            // DependencyService decides if to use iOS or Android
            gpsProvider           = DependencyService.Get <IDeviceGps>();
            accelerometerProvider = DependencyService.Get <IDeviceAcceleromter>();
            soundProvider         = DependencyService.Get <IDeviceSound>();

            runModeProvider       = new RunModeAcceleration(accelerometerProvider, soundProvider);
            accelerometerRecorder = new AccelerometerRecorder(true); // true: use queue mode to limit recording size

            // on first start -> use device language -> update our settings
            // on next starts -> use our updated settings
            LocaleId deviceLanguage = DependencyService.Get <IDeviceLocale>().GetLocale();

            // set language, use system language as default
            Localization.isEnglish = Settings.GetValueOrDefault(Settings.Language, deviceLanguage == LocaleId.English);
            Settings.AddOrUpdateValue(Settings.Language, Localization.isEnglish);

            InitLayout();
            InitLocalisation();
            InitHelp();

            bool showDisclaimer = Settings.GetValueOrDefault(Settings.Disclaimer, true);
            bool showTipOfDay   = Settings.GetValueOrDefault(Settings.TipOfDay, true);

            if (showDisclaimer || showTipOfDay)
            {
                Device.StartTimer(TimeSpan.FromMilliseconds(50), () =>
                {
                    if (isStartUpNoteShown == false) // only show once
                    {
                        isStartUpNoteShown = true;

                        if (showDisclaimer)
                        {
                            Navigation.PushAsync(new PageText(PageText.ContentType.Disclaimer));
                        }
                        else
                        {
                            Navigation.PushAsync(new PageText(PageText.ContentType.TipOfDay));
                        }
                    }

                    return(false); // stop timer
                });
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Change AeSession properties
        /// </summary>
        private void ExecuteAeSessionProperties()
        {
            if (this.aeSession == null)
            {
                return;
            }

            Helper.LocaleId         localeId        = new LocaleId();
            Helper.CustomProperties propServiceColl = propertyGrid.SelectedObject as Helper.CustomProperties;
            if (propServiceColl == null)
            {
                return;
            }

            string strLocalId      = "";
            string strClassContext = "";
            string strClientName   = "";

            foreach (Helper.CustomProperty customProperty in propServiceColl.Properties)
            {
                if (customProperty == null)
                {
                    return;
                }
                if (customProperty.Name.Equals("Locale Id"))
                {
                    strLocalId = customProperty.DefaultValue.ToString();
                }
                else if (customProperty.Name.Equals("Client Name"))
                {
                    strClientName = customProperty.DefaultValue.ToString();
                }
                else if (customProperty.Name.Equals("DCOM Class Context"))
                {
                    strClassContext = customProperty.DefaultValue.ToString();
                }
            }

            //set item new values
            aeSession.LocaleId     = strLocalId;
            aeSession.ClientName   = strClientName;
            aeSession.ClassContext = GetClassContext(strClassContext);

            ExecutionOptions executionOptions = new ExecutionOptions();

            executionOptions.ExecutionType    = EnumExecutionType.ASYNCHRONOUS;
            executionOptions.ExecutionContext = 0;
            int[] results;
            aeSession.SetAttributesToServer(new EnumObjectAttribute[] { EnumObjectAttribute.AESESSION_ALL }, out results, executionOptions);
        }
Exemplo n.º 6
0
 public static extern HResult LoadRegTypeLib(
     ref Guid rguid,
     ushort wVerMajor,
     ushort wVerMinor,
     LocaleId lcid,
     out ITypeLib pptlib);
 /// <summary>
 /// Get locale with specified id.
 /// </summary>
 /// <param name="userContext">User context.</param>
 /// <param name="localeId">Locale id.</param>
 /// <returns>Locale with specified id.</returns>
 public virtual ILocale GetLocale(IUserContext userContext,
                                  LocaleId localeId)
 {
     return(GetLocale(userContext, (Int32)localeId));
 }
Exemplo n.º 8
0
        /// <summary>
        /// Change AeSubscription properties
        /// </summary>
        private void ExecuteAeSubscriptionProperties()
        {
            if (this.aeSubscription == null)
            {
                return;
            }

            Helper.LocaleId         localeId        = new LocaleId();
            Helper.CustomProperties propServiceColl = propertyGrid.SelectedObject as Helper.CustomProperties;
            if (propServiceColl == null)
            {
                return;
            }

            string strBufferTime = "";
            string strMaxSize    = "";

            foreach (Helper.CustomProperty customProperty in propServiceColl.Properties)
            {
                if (customProperty == null)
                {
                    return;
                }
                if (customProperty.Name.Equals("Buffer Time"))
                {
                    strBufferTime = customProperty.DefaultValue.ToString();
                }
                else if (customProperty.Name.Equals("Max Size"))
                {
                    strMaxSize = customProperty.DefaultValue.ToString();
                }
            }

            //set item new values
            uint bufferTime;

            uint.TryParse(strBufferTime, out bufferTime);
            aeSubscription.RequestedBufferTime = bufferTime;
            uint maxSize;

            uint.TryParse(strMaxSize, out maxSize);
            aeSubscription.RequestedMaxSize = maxSize;

            ExecutionOptions executionOptions = new ExecutionOptions();

            executionOptions.ExecutionType    = EnumExecutionType.ASYNCHRONOUS;
            executionOptions.ExecutionContext = 0;
            int[] results;
            aeSubscription.SetAttributesToServer(new EnumObjectAttribute[] { EnumObjectAttribute.AESUBSCRIPTION_ALL }, out results, executionOptions);
            //set opc version
            foreach (Helper.CustomProperty customProperty in propServiceColl.Properties)
            {
                if (customProperty == null)
                {
                    return;
                }
                if (customProperty.Name.Equals("Revised Buffer Time"))
                {
                    customProperty.DefaultValue = bufferTime;
                }
                else if (customProperty.Name.Equals("Revised Max Size"))
                {
                    customProperty.DefaultValue = maxSize;
                }
            }
            propertyGrid.SelectedObject = propServiceColl;
        }
Exemplo n.º 9
0
        /// <summary>
        /// Change DaSubscription properties
        /// </summary>
        private void ExecuteDaSubscriptionProperties()
        {
            if (this.daSubscription == null)
            {
                return;
            }

            Helper.LocaleId         localeId        = new LocaleId();
            Helper.CustomProperties propServiceColl = propertyGrid.SelectedObject as Helper.CustomProperties;
            if (propServiceColl == null)
            {
                return;
            }

            string strName          = "";
            string strUpdateRate    = "";
            string strLCID          = "";
            string strDeadBand      = "";
            string strKeepAliveTime = "";

            foreach (Helper.CustomProperty customProperty in propServiceColl.Properties)
            {
                if (customProperty == null)
                {
                    return;
                }
                if (customProperty.Name.Equals("Name"))
                {
                    strName = customProperty.DefaultValue.ToString();
                }
                else if (customProperty.Name.Equals("Update Rate(ms)"))
                {
                    strUpdateRate = customProperty.DefaultValue.ToString();
                }
                else if (customProperty.Name.Equals("Deadband"))
                {
                    strDeadBand = customProperty.DefaultValue.ToString();
                }
                else if (customProperty.Name.Equals("Locale Id"))
                {
                    strLCID = customProperty.DefaultValue.ToString();
                }
                else if (customProperty.Name.Equals("Keep Alive Time(ms)"))
                {
                    strKeepAliveTime = customProperty.DefaultValue.ToString();
                }
            }

            //set item new values
            daSubscription.Name = strName;
            uint updateRate;

            uint.TryParse(strUpdateRate, out updateRate);
            daSubscription.RequestedUpdateRate = updateRate;
            float deadBand;

            float.TryParse(strDeadBand, out deadBand);
            daSubscription.Deadband = deadBand;
            daSubscription.LocaleId = strLCID;
            uint keepAliveTime;

            uint.TryParse(strKeepAliveTime, out keepAliveTime);
            daSubscription.RequestedKeepAliveTime = keepAliveTime;

            ExecutionOptions executionOptions = new ExecutionOptions();

            executionOptions.ExecutionType    = EnumExecutionType.ASYNCHRONOUS;
            executionOptions.ExecutionContext = 0;
            int[] results;
            daSubscription.SetAttributesToServer(new EnumObjectAttribute[] { EnumObjectAttribute.DASUBSCRIPTION_ALL }, out results, executionOptions);
            //set opc version
            foreach (Helper.CustomProperty customProperty in propServiceColl.Properties)
            {
                if (customProperty == null)
                {
                    return;
                }
                if (customProperty.Name.Equals("Revised Update Rate(ms)"))
                {
                    customProperty.DefaultValue = updateRate;
                }
                else if (customProperty.Name.Equals("Revised Keep Alive Time(ms)"))
                {
                    customProperty.DefaultValue = keepAliveTime;
                }
            }
            propertyGrid.SelectedObject = propServiceColl;
        }
Exemplo n.º 10
0
 public bool Equals(LocaleId other) => other.RawValue == RawValue;