Пример #1
0
        private void CurrentWeekNumber_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ApplicationDataContainer localSettings = ApplicationData.get_Current().get_LocalSettings();

            ((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 num;

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

            ((IDictionary <string, object>)values)[index] = (object)local;
        }
Пример #2
0
        private void getTermAndWeekInfo()
        {
            ApplicationDataContainer localSettings = ApplicationData.get_Current().get_LocalSettings();
            StringBuilder            stringBuilder = new StringBuilder();

            stringBuilder.Append("你好 ^.^,今天是" + this.getDayOfWeek() + ",");
            if (((IDictionary <string, object>)localSettings.get_Values()).ContainsKey("season"))
            {
                stringBuilder.Append(((IDictionary <string, object>)localSettings.get_Values())["season"].ToString() + "学期");
            }
            if (((IDictionary <string, object>)localSettings.get_Values()).ContainsKey("weekNumber") && ((IDictionary <string, object>)localSettings.get_Values()).ContainsKey("weekDate"))
            {
                int num = Math.Abs((int)((IDictionary <string, object>)localSettings.get_Values())["weekNumber"] + (DateTime.Today.DayOfYear - (int)((IDictionary <string, object>)localSettings.get_Values())["weekDate"]) / 7) % 8 + 1;
                stringBuilder.Append("第" + num.ToString() + "周");
            }
            this.TermAndWeekInfomation.put_Text(stringBuilder.ToString());
        }
Пример #3
0
        private void SettingGrid_Tapped(object sender, TappedRoutedEventArgs e)
        {
            this.changePanel(4);
            int month = DateTime.Now.Month;

            if (month >= 2 && month <= 8)
            {
                ((ContentControl)this.FirstTerm).put_Content((object)"春");
                ((ContentControl)this.SecondTerm).put_Content((object)"夏");
            }
            else
            {
                ((ContentControl)this.FirstTerm).put_Content((object)"秋");
                ((ContentControl)this.SecondTerm).put_Content((object)"冬");
            }
            ApplicationDataContainer localSettings = ApplicationData.get_Current().get_LocalSettings();

            if (((IDictionary <string, object>)localSettings.get_Values()).ContainsKey("userName") && ((IDictionary <string, object>)localSettings.get_Values()).ContainsKey("password"))
            {
                this.UserName.put_Text(((IDictionary <string, object>)localSettings.get_Values())["userName"].ToString());
                this.MyPasswordBox.put_Password(((IDictionary <string, object>)localSettings.get_Values())["password"].ToString());
                ((ContentControl)this.SaveButton).put_Content((object)"删除");
            }
            if (((IDictionary <string, object>)localSettings.get_Values()).ContainsKey("season"))
            {
                string str = ((IDictionary <string, object>)localSettings.get_Values())["season"].ToString();
                ((Selector)this.Season).put_SelectedIndex(str == "春" || str == "秋" ? 0 : 1);
            }
            if (!((IDictionary <string, object>)localSettings.get_Values()).ContainsKey("weekNumber") || !((IDictionary <string, object>)localSettings.get_Values()).ContainsKey("weekDate"))
            {
                return;
            }
            int num = (int)((IDictionary <string, object>)localSettings.get_Values())["weekDate"];

            ((Selector)this.CurrentWeekNumber).put_SelectedIndex(Math.Abs((int)((IDictionary <string, object>)localSettings.get_Values())["weekNumber"] + (DateTime.Today.DayOfYear - num) / 7) % 8);
        }
Пример #4
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)"确认");
            }
        }