Esempio n. 1
0
        private void btnSettings_Click(object sender, RoutedEventArgs e)
        {
            WindowSettings frm = new WindowSettings();

            Session.IsSetColor = false;
            frm.ShowDialog();
            try
            {
                if (Session.IsSetColor)
                {
                    if (Session.IsBgColor)
                    {
                        bc = new BrushConverter();
                        this.Background = (Brush)bc.ConvertFrom(Session.BgColorCode);
                    }
                    else
                    {
                        bc = new BrushConverter();
                        this.Background = defaultBrush;
                        string bgColor = Session.SelectedBgPath;
                        if (bgColor.Contains("bg1.jpg"))
                        {
                            Image image = new Image();
                            image.Source         = new BitmapImage(ResourceAccessor.Get("images/bg/bg1.jpg"));
                            imgBrush.ImageSource = image.Source;
                        }
                        else if (bgColor.Contains("bg2.jpg"))
                        {
                            Image image = new Image();
                            image.Source         = new BitmapImage(ResourceAccessor.Get("images/bg/bg2.jpg"));
                            imgBrush.ImageSource = image.Source;
                        }
                        else if (bgColor.Contains("bg3.jpg"))
                        {
                            Image image = new Image();
                            image.Source         = new BitmapImage(ResourceAccessor.Get("images/bg/bg3.jpg"));
                            imgBrush.ImageSource = image.Source;
                        }
                    }

                    imgClose.Source = Session.IsButtonColorBlack ?
                                      new BitmapImage(ResourceAccessor.Get("images/icon/cancel-button.png"))
                          : imgClose.Source = new BitmapImage(ResourceAccessor.Get("images/icon/cancel-button-white.png"));
                    imgMinimize.Source      = Session.IsButtonColorBlack
                        ? new BitmapImage(ResourceAccessor.Get("images/icon/minimize.png"))
                        : imgMinimize.Source = new BitmapImage(ResourceAccessor.Get("images/icon/minimize-white.png"));

                    if (Session.IsButtonColorBlack)
                    {
                        if (WindowState == WindowState.Maximized)
                        {
                            imgMaximize.Source = new BitmapImage(ResourceAccessor.Get("images/icon/expand-button.png"));
                        }
                        else
                        {
                            imgMaximize.Source = new BitmapImage(ResourceAccessor.Get("images/icon/compress-square.png"));
                        }
                    }
                    else
                    {
                        if (WindowState == WindowState.Maximized)
                        {
                            imgMaximize.Source = new BitmapImage(ResourceAccessor.Get("images/icon/expand-button-white.png"));
                        }
                        else
                        {
                            imgMaximize.Source = new BitmapImage(ResourceAccessor.Get("images/icon/compress-square-white.png"));
                        }
                    }

                    imgReset.Source = Session.IsButtonColorBlack ?
                                      new BitmapImage(ResourceAccessor.Get("images/icon/reset.png"))
                      : imgReset.Source = new BitmapImage(ResourceAccessor.Get("images/icon/white-reset.png"));


                    if (Session.IsButtonColorBlack)
                    {
                        if (timerState == TimerState.Play)
                        {
                            imgPlayPause.Source = new BitmapImage(ResourceAccessor.Get("images/icon/play.png"));
                        }
                        else
                        {
                            imgPlayPause.Source = new BitmapImage(ResourceAccessor.Get("images/icon/pause.png"));
                        }
                    }
                    else
                    {
                        if (timerState == TimerState.Play)
                        {
                            imgPlayPause.Source = new BitmapImage(ResourceAccessor.Get("images/icon/white-play.png"));
                        }
                        else
                        {
                            imgPlayPause.Source = new BitmapImage(ResourceAccessor.Get("images/icon/white-pause.png"));
                        }
                    }

                    imgSetTimer.Source = Session.IsButtonColorBlack ?
                                         new BitmapImage(ResourceAccessor.Get("images/icon/set-timer.png"))
                      : imgSetTimer.Source = new BitmapImage(ResourceAccessor.Get("images/icon/white-set-timer.png"));
                }

                bc = new BrushConverter();
                lblRemainingTime.Foreground = (Brush)bc.ConvertFrom(Session.RemaniningTimeColorCode);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.Message);
            }
        }