public MainWindow() { InitializeComponent(); // タイマーの初期設定 timer = new DispatcherTimer(DispatcherPriority.SystemIdle); timer.Interval = TimeSpan.FromSeconds(1); // 時計は1秒ごとに更新 timer.Tick += Timer_Tick; currentHour = DateTime.Now.Hour; timer.Start(); // ウィンドウの初期設定 settings = MainSettings.Default; if (settings.WindowLeft >= 0 && (settings.WindowLeft + Width) < SystemParameters.VirtualScreenWidth) { Left = settings.WindowLeft; } else { Left = (SystemParameters.VirtualScreenWidth - Width) / 2; } if (settings.WindowTop >= 0 && (settings.WindowTop + Height) < SystemParameters.VirtualScreenHeight) { Top = settings.WindowTop; } else { Top = (SystemParameters.VirtualScreenHeight - Height) / 2; } windowBackgroundColor.Opacity = settings.WindowOpacity == 0 ? 0.01 : settings.WindowOpacity; // 時刻初期化 DateTime time = DateTime.Now; clockTextBlock.Text = time.ToString(settings.TimeFormat); }
public SettingWindow() { InitializeComponent(); settings = MainSettings.Default; foreach (SettingsPropertyValue spv in settings.PropertyValues) { tmp.Add(spv.Name, spv.PropertyValue); } // スタートアップ登録チェックボックス初期化 if (System.IO.File.Exists(getShortcutPath())) { startupCheckBox.IsChecked = true; } timeFormatTextBox.Text = settings.TimeFormat; // ウィンドウの設定 clockBackgroundColorPicker.SelectedColor = (Color)ColorConverter.ConvertFromString(settings.WindowBackgroundColor); opacitySlider.Value = (int)(settings.WindowOpacity * 100); windowBorderCheckBox.IsChecked = (settings.OutlineBordorThickness.Left > 0) ? true : false; // フォント ICollectionView view = CollectionViewSource.GetDefaultView(Fonts.SystemFontFamilies); new FontFilter(view, this.fontFamilyTextBox); clockForegroundColorPicker.SelectedColor = (Color)ColorConverter.ConvertFromString(settings.ClockForegroundColor); fontFamilyListBox.SelectedItem = settings.FontFamily; fontStyleListBox.SelectedItem = settings.FontStyle; List <int> fontSizeList = new List <int>(20); for (int i = 4; i < 20 + 4; i++) { fontSizeList.Add(i * 2); } fontSizeListBox.ItemsSource = fontSizeList; fontSizeListBox.SelectedItem = settings.FontSize; // 音量 voiceVolumeSlider.Value = settings.VoiceVolume; }