0

wp8 アプリにローカリゼーションを実装しようとしています。ユーザーがラジオボタンの1つを選択すると、2つのラジオボタン(アラビア語と英語)があり、ポップアップが表示され、[OK]を選択するとアプリの言語を変更したいと確信していますが、アプリの言語が変更された場合キャンセルを選択すると、言語に変更はありませんが、問題は、ユーザーがキャンセルを押してもラジオ ボタンが切り替わることです。

トグルが発生するのを止める方法は?

ここに私のXamlコードと、ラジオボタンがチェックされている場合にバインドされるコードがあります..

<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <StackPanel Orientation="Vertical" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20">
            <RadioButton  Content="English" Foreground="Black" FontSize="30" IsChecked="{Binding isenglishchecked,Mode=TwoWay, Source={StaticResource appSettings}}" Checked="RadioButton_Checked"/>
            <RadioButton  Content="Arabic" Foreground="Black" FontSize="30" IsChecked="{Binding isarabicchecked,Mode=TwoWay, Source={StaticResource appSettings}}" Checked="RadioButton_Checked"/>
        </StackPanel>
    </Grid>



 public bool isenglishchecked
        {
            get
            {
                return GetValueOrDefault<bool>(isenglishcheckedname, isenglishcheckedDefault);
            }
            set
            {
                var result = MessageBox.Show("This Will Change the Language of the App Do you Want to continue ?", "Language Change", MessageBoxButton.OKCancel);

                if (result == MessageBoxResult.OK)
                {
                    if (AddOrUpdateValue(isenglishcheckedname, value))
                    {
                        Save();
                        if (isenglishchecked)
                        {
                            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
                            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");

                            MainViewModel.stationnamelist = null;
                            Messenger.Default.Send<string>("mainpage", "tomainpage");
                            (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
                        }

                        else
                        {
                            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("ar-AE");
                            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ar-AE");

                            MainViewModel.stationnamelist = null;
                            Messenger.Default.Send<string>("mainpage", "tomainpage");
                            (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
                        }
                    }
                }
                else
                {
                    (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/Skins/SelectLanguage.xaml", UriKind.Relative));
                }
            }
        }

        public bool isarabicchecked
        {
            get
            {
                return GetValueOrDefault<bool>(isarabiccheckedname, isarabiccheckedDefault);
            }
            set
            {
                if (AddOrUpdateValue(isarabiccheckedname, value))
                {
                    Save();
                }
            }
        }
4

1 に答える 1