コード例 #1
0
        void ReadData(SettingData data)
        {
            if (data.AmbientOn)
            {
                AmbientOpen.IsChecked = true;
            }
            else
            {
                AmbientClose.IsChecked = true;
            }

            if (data.ResolutionX == 1280 && data.ResolutionY == 720)
            {
                resolution1280_720.IsChecked = true;
            }
            else if (data.ResolutionX == 1024 && data.ResolutionY == 768)
            {
                resolution1024_768.IsChecked = true;
            }
            else if (data.ResolutionX == 800 && data.ResolutionY == 600)
            {
                resolution800_600.IsChecked = true;
            }

            IPBox.Text   = data.IP;
            PortBox.Text = data.Port;
        }
コード例 #2
0
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         SettingData d = GenerateData();
         Base.StorageManager.SaveData(d, @"Config.mstcos");
         Close();
     }
     catch
     {
         MessageBox.Show("设定未正确保存");
     }
 }
コード例 #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            SettingData data;

            try
            {
                data = Base.StorageManager.LoadData <SettingData>(@"Config.mstcos");
            }
            catch
            {
                data = new SettingData();
            }
            ReadData(data);
        }
コード例 #4
0
        SettingData GenerateData()
        {
            SettingData data = new SettingData();

            if (resolution1280_720.IsChecked.HasValue && resolution1280_720.IsChecked.Value == true)
            {
                data.ResolutionX = 1280;
                data.ResolutionY = 720;
            }
            else if (resolution1024_768.IsChecked.HasValue && resolution1024_768.IsChecked.Value == true)
            {
                data.ResolutionX = 1024;
                data.ResolutionY = 768;
            }
            else if (resolution800_600.IsChecked.HasValue && resolution800_600.IsChecked.Value == true)
            {
                data.ResolutionX = 800;
                data.ResolutionY = 600;
            }
            else
            {
                data.ResolutionX = 1280;
                data.ResolutionY = 720;
            }

            if (AmbientOpen.IsChecked.HasValue && AmbientOpen.IsChecked.Value == true)
            {
                data.AmbientOn = true;
            }
            else
            {
                data.AmbientOn = false;
            }

            data.IP   = IPBox.Text;
            data.Port = PortBox.Text;

            return(data);
        }
コード例 #5
0
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            SettingData data = new SettingData();

            ReadData(data);
        }