예제 #1
0
        private void typeFactory_HttpSucess(object sender, HttpFactoryArgs <List <TypeInfo> > args)
        {
            var selectGroup = new ChannelTypeGroup();

            selectGroup.GroupName  = "已固定";
            selectGroup.ItemsGroup = new ObservableCollection <ChannelTypeItem>();

            var unSelectGroup = new ChannelTypeGroup();

            unSelectGroup.GroupName  = "未固定";
            unSelectGroup.ItemsGroup = new ObservableCollection <ChannelTypeItem>();

            _allViewModel.Groups.Add(selectGroup);
            _allViewModel.Groups.Add(unSelectGroup);

            var roamingValue = DataStoreUtils.GetRoamingSettingValue(_channelTypeSettingKey) as string;

            if (string.IsNullOrEmpty(roamingValue))
            {
                roamingValue = string.Join("/", args.Result.Take(ColNumber * 2).Select(v => v.TypeId.ToString()));
            }
            var firstLaunch = DataStoreUtils.GetLocalSettingValue(_channelTypeSettingKey) as string;

            if (string.IsNullOrEmpty(firstLaunch))
            {
                if (!roamingValue.Contains("75099"))
                {
                    roamingValue = roamingValue.Insert(0, "75099/");
                    roamingValue = roamingValue.Remove(roamingValue.LastIndexOf('/'));
                }
                if (!roamingValue.Contains(LiveTypeId.ToString()))
                {
                    roamingValue = roamingValue.Insert(0, string.Format("{0}/", LiveTypeId.ToString()));
                    roamingValue = roamingValue.Remove(roamingValue.LastIndexOf('/'));
                }
                DataStoreUtils.AddLocalSettingValue(_channelTypeSettingKey, "1");
                DataStoreUtils.AddRoamingSettingValue(_channelTypeSettingKey, roamingValue);
            }

            _isReorder = false;

            var selectValues = roamingValue.Split('/');

            foreach (var type in args.Result)
            {
                ProcessViewModel(selectValues, type.TypeId, type.Name);
            }
            foreach (var type in _localTypes)
            {
                ProcessViewModel(selectValues, type.TypeId, type.TypeName);
            }
            foreach (var selected in selectValues)
            {
                var item = _allViewModel.Groups[0].ItemsGroup.FirstOrDefault(v => v.TypeId == Convert.ToInt32(selected));
                if (item != null)
                {
                    _selectedViewModel.Add(item);
                }
            }
        }
예제 #2
0
        private void typeFactory_HttpSucess(object sender, HttpFactoryArgs <List <TypeInfo> > args)
        {
            var roamingValue = DataStoreUtils.GetLocalSettingValue(_channelTypeSettingKey) as string;

            if (string.IsNullOrEmpty(roamingValue))
            {
                roamingValue = string.Join("/", args.Result.Take(12).Select(v => v.TypeId.ToString()));
            }
            var firstLaunch = DataStoreUtils.GetLocalSettingValue(_channelTypeSettingKey) as string;

            if (string.IsNullOrEmpty(firstLaunch))
            {
                if (!roamingValue.Contains("75099"))
                {
                    roamingValue = roamingValue.Insert(0, "75099/");
                    roamingValue = roamingValue.Remove(roamingValue.LastIndexOf('/'));
                }
                //if (!roamingValue.Contains(LiveTypeId.ToString()))
                //{
                //    roamingValue = roamingValue.Insert(0, string.Format("{0}/", LiveTypeId.ToString()));
                //    roamingValue = roamingValue.Remove(roamingValue.LastIndexOf('/'));
                //}
                DataStoreUtils.AddLocalSettingValue(_channelTypeSettingKey, "1");
                DataStoreUtils.AddLocalSettingValue(_channelTypeSettingKey, roamingValue);
            }

            var selectValues = roamingValue.Split('/');

            foreach (var type in args.Result)
            {
                ProcessViewModel(selectValues, type.TypeId, type.Name);
            }
            foreach (var type in _localTypes)
            {
                ProcessViewModel(selectValues, type.TypeId, type.TypeName);
            }
            foreach (var selected in selectValues)
            {
                var item = _allViewModel[0].FirstOrDefault(v => v.TypeId == Convert.ToInt32(selected));
                if (item != null)
                {
                    _selectedViewModel.Add(item);
                }
            }
        }
예제 #3
0
        private void SetVolumeState(double value)
        {
            xMaxVolumeButton.Visibility = xMinVolumeButton.Visibility = xMuteVolumeButton.Visibility = xNormalVolumeButton.Visibility = Visibility.Collapsed;
            if (value > 0.66)
            {
                xMaxVolumeButton.Visibility = Visibility.Visible;
            }
            else if (value <= 0.66 && value > 0.33)
            {
                xNormalVolumeButton.Visibility = Visibility.Visible;
            }
            else if (value <= 0.33 && value > 0.005)
            {
                xMinVolumeButton.Visibility = Visibility.Visible;
            }
            else if (value <= 0.005)
            {
                xMuteVolumeButton.Visibility = Visibility.Visible;
            }

            DataStoreUtils.AddLocalSettingValue(Utils.Constants.VolumeSettingKey, value);
        }
예제 #4
0
        private void SaveRoaming()
        {
            var roamingValue = string.Join("/", _selectedViewModel.Select(v => v.TypeId.ToString()));

            DataStoreUtils.AddLocalSettingValue(_channelTypeSettingKey, roamingValue);
        }