Esempio n. 1
0
        /// <summary>
        /// hdt
        /// </summary>
        /// <param name="propertyKey"></param>
        /// <returns></returns>
        static Task <string> GetRootDeviceInfoAsync(string propertyKey)
        {
            TaskAwaiter <PnpObject> awaiter;

            awaiter = WindowsRuntimeSystemExtensions.GetAwaiter <PnpObject>(PnpObject.CreateFromIdAsync(PnpObjectType.DeviceContainer, "{00000000-0000-0000-FFFF-FFFFFFFFFFFF}", new string[] { propertyKey }));
            PnpObject pnp = awaiter.GetResult();
            string    str = pnp.Properties[propertyKey].ToString();

            return(Task.FromResult <string>(str));
        }
Esempio n. 2
0
        /// <summary>
        /// hdt
        /// </summary>
        /// <param name="properties"></param>
        /// <returns></returns>
        static Task <PnpObject> GetHalDevice(params string[] properties)
        {
            PnpObject           result           = null;
            var                 actualProperties = Enumerable.Concat <string>(properties, new string[] { "{A45C254E-DF1C-4EFD-8020-67D146A850E0},10" });
            PnpObjectCollection objects          = WindowsRuntimeSystemExtensions.GetAwaiter <PnpObjectCollection>(PnpObject.FindAllAsync(PnpObjectType.Device, actualProperties, "System.Devices.ContainerId:=\"{00000000-0000-0000-FFFF-FFFFFFFFFFFF}\"")).GetResult();

            foreach (PnpObject obj in objects)
            {
                KeyValuePair <string, object> pair = Enumerable.Last <KeyValuePair <string, object> >((IEnumerable <KeyValuePair <string, object> >)obj.Properties);
                if ((pair.Value != null) && pair.Value.ToString().Equals("4d36e966-e325-11ce-bfc1-08002be10318"))
                {
                    result = obj;
                    break;
                }
            }
            return(Task.FromResult <PnpObject>(result));
        }
Esempio n. 3
0
        private async void SaveButton_Click(object sender, RoutedEventArgs e)
        {
            ApplicationDataContainer localsettings = ApplicationData.get_Current().get_LocalSettings();

            ((IDictionary <string, object>)localsettings.get_Values())["season"]     = ((ContentControl)((Selector)this.Season).get_SelectedItem()).get_Content();
            ((IDictionary <string, object>)localsettings.get_Values())["weekNumber"] = (object)((Selector)this.CurrentWeekNumber).get_SelectedIndex();
            IPropertySet values    = localsettings.get_Values();
            string       index     = "weekDate";
            DateTime     today     = DateTime.Today;
            int          dayOfYear = today.DayOfYear;

            today = DateTime.Today;
            int num1;

            if (today.DayOfWeek != DayOfWeek.Sunday)
            {
                today = DateTime.Today;
                num1  = (int)(today.DayOfWeek - 1);
            }
            else
            {
                num1 = 6;
            }
            // ISSUE: variable of a boxed type
            __Boxed <int> local = (ValueType)(dayOfYear - num1);

            ((IDictionary <string, object>)values)[index] = (object)local;
            if (((ContentControl)this.SaveButton).get_Content().ToString() == "确认")
            {
                if (this.UserName.get_Text() != "" && this.MyPasswordBox.get_Password() != "")
                {
                    ((IDictionary <string, object>)localsettings.get_Values())["userName"] = (object)this.UserName.get_Text();
                    ((IDictionary <string, object>)localsettings.get_Values())["password"] = (object)this.MyPasswordBox.get_Password();
                    ((ContentControl)this.SaveButton).put_Content((object)"删除");
                }
                else
                {
                    MessageDialog            message = new MessageDialog("不要卖萌,没有数据怎么确认~");
                    TaskAwaiter <IUICommand> awaiter = (TaskAwaiter <IUICommand>)WindowsRuntimeSystemExtensions.GetAwaiter <IUICommand>((IAsyncOperation <M0>)message.ShowAsync());
                    if (!awaiter.IsCompleted)
                    {
                        int num2;
                        // ISSUE: reference to a compiler-generated field
                        this.\u003C\u003E1__state = num2 = 0;
                        TaskAwaiter <IUICommand> taskAwaiter = awaiter;
                        // ISSUE: variable of a compiler-generated type
                        MainPage.\u003CSaveButton_Click\u003Ed__31 stateMachine = this;
                        // ISSUE: reference to a compiler-generated field
                        this.\u003C\u003Et__builder.AwaitUnsafeOnCompleted <TaskAwaiter <IUICommand>, MainPage.\u003CSaveButton_Click\u003Ed__31>(ref awaiter, ref stateMachine);
                    }
                    else
                    {
                        awaiter.GetResult();
                        awaiter = new TaskAwaiter <IUICommand>();
                        message = (MessageDialog)null;
                    }
                }
            }
            else
            {
                ((IDictionary <string, object>)localsettings.get_Values()).Remove("userName");
                ((IDictionary <string, object>)localsettings.get_Values()).Remove("password");
                await DataHelper.DeleteDatabaseAsync();

                this.UserName.put_Text("");
                this.MyPasswordBox.put_Password("");
                ((ContentControl)this.SaveButton).put_Content((object)"确认");
            }
        }