Esempio n. 1
0
 private void CheckBox_Checked(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrEmpty(this.mGroup))
     {
         if (this.IsThreeState)
         {
             if (CustomCheckbox.dictInterminentTags[this.mGroup].Item3.Count > 0)
             {
                 foreach (ToggleButton toggleButton in CustomCheckbox.dictInterminentTags[this.mGroup].Item3.ToArray())
                 {
                     toggleButton.IsChecked = new bool?(true);
                 }
             }
         }
         else
         {
             CustomCheckbox.dictInterminentTags[this.mGroup].Item2.Add(this);
             CustomCheckbox.dictInterminentTags[this.mGroup].Item3.Remove(this);
             if (CustomCheckbox.dictInterminentTags[this.mGroup].Item3.Count == 0)
             {
                 CustomCheckbox.dictInterminentTags[this.mGroup].Item1.IsChecked = new bool?(true);
             }
             else
             {
                 CustomCheckbox.dictInterminentTags[this.mGroup].Item1.SetInterminate();
             }
         }
     }
     if (this.Image == null)
     {
         return;
     }
     CustomPictureBox.SetBitmapImage(this.Image, "check_box_checked", false);
 }
Esempio n. 2
0
 private void CheckBox_MouseEnter(object sender, MouseEventArgs e)
 {
     if (!this.IsChecked.HasValue || this.IsChecked.Value)
     {
         return;
     }
     CustomPictureBox.SetBitmapImage(this.Image, "check_box_hover", false);
 }
Esempio n. 3
0
 public void SetDefaultImage()
 {
     try
     {
         CustomPictureBox.SetBitmapImage((Image)this, this.ImageName, this.IsFullImagePath);
     }
     catch
     {
     }
 }
Esempio n. 4
0
 public void SetDisabledImage()
 {
     try
     {
         if (this.IsFullImagePath)
         {
             return;
         }
         CustomPictureBox.SetBitmapImage((Image)this, this.DisabledImage, false);
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 5
0
 private void CheckBox_MouseLeave(object sender, MouseEventArgs e)
 {
     if (!this.IsChecked.HasValue)
     {
         CustomPictureBox.SetBitmapImage(this.Image, "check_box_Indeterminate", false);
     }
     else if (this.IsChecked.Value)
     {
         CustomPictureBox.SetBitmapImage(this.Image, "check_box_checked", false);
     }
     else
     {
         CustomPictureBox.SetBitmapImage(this.Image, "check_box", false);
     }
 }
Esempio n. 6
0
 private void CheckBox_Indeterminate(object sender, RoutedEventArgs e)
 {
     if (!this._mSetInterminate)
     {
         this.IsChecked = new bool?(false);
     }
     else
     {
         this._mSetInterminate = false;
         if (this.Image == null)
         {
             return;
         }
         CustomPictureBox.SetBitmapImage(this.Image, "check_box_Indeterminate", false);
     }
 }
Esempio n. 7
0
        private void CheckBox_Loaded(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode((DependencyObject)this))
            {
                return;
            }
            if (this.mOrientaion == Orientation.Vertical)
            {
                Grid.SetRowSpan((UIElement)this.Image, 1);
                this.colDefHorizontalLabel.Width = new GridLength(0.0);
                this.BottomLabel.Visibility      = Visibility.Visible;
            }
            if (this.mLabelVisibility == Visibility.Hidden)
            {
                this.CheckboxText.Visibility = Visibility.Hidden;
                this.BottomLabel.Visibility  = Visibility.Hidden;
            }
            if (this.Image == null)
            {
                return;
            }
            bool?isChecked = this.IsChecked;

            if (!isChecked.HasValue)
            {
                CustomPictureBox.SetBitmapImage(this.Image, "check_box__Indeterminate", false);
            }
            else
            {
                isChecked = this.IsChecked;
                if (isChecked.HasValue)
                {
                    isChecked = this.IsChecked;
                    if (isChecked.Value)
                    {
                        CustomPictureBox.SetBitmapImage(this.Image, "check_box_checked", false);
                        return;
                    }
                }
                CustomPictureBox.SetBitmapImage(this.Image, "check_box", false);
            }
        }
        private NotificationPopup(
            string imagePath,
            string title,
            string displayMsg,
            bool autoClose,
            int duration,
            MouseButtonEventHandler clickHandler,
            bool hideMute,
            string vmName,
            MouseButtonEventHandler buttonClickHandler = null,
            MouseButtonEventHandler closeButtonHandler = null,
            MouseButtonEventHandler muteButtonHandler  = null,
            bool showOnlyMute     = false,
            string buttonText     = "",
            string id             = "0",
            bool showOnlySettings = false,
            string package        = "")
        {
            this.InitializeComponent();
            this.SetProperties();
            this.Width                 = NotificationWindow.Instance.ActualWidth;
            this.mTimer.Tick          += new EventHandler(this.MyTimer_Tick);
            this.mTimer.Interval       = duration;
            this.Title                 = title;
            this.mLblContent.Text      = displayMsg;
            this.VmName                = vmName;
            this.PackageName           = package;
            this.AndroidNotificationId = id;
            if (clickHandler != null)
            {
                this.mPopup.MouseUp += clickHandler;
                this.mClickHandler   = clickHandler;
            }
            if (buttonClickHandler != null)
            {
                this.mButton.PreviewMouseLeftButtonUp += buttonClickHandler;
                this.mButton.Visibility = Visibility.Visible;
                if (!string.IsNullOrEmpty(buttonText))
                {
                    this.mButton.Content = (object)buttonText;
                }
            }
            if (hideMute)
            {
                this.mImgMute.Visibility     = Visibility.Hidden;
                this.mImgSettings.Visibility = Visibility.Hidden;
            }
            if (showOnlyMute)
            {
                this.mImgMute.Visibility     = Visibility.Visible;
                this.mImgSettings.Visibility = Visibility.Collapsed;
            }
            if (showOnlySettings)
            {
                this.mImgMute.Visibility     = Visibility.Collapsed;
                this.mImgSettings.Visibility = Visibility.Visible;
            }
            if (closeButtonHandler != null)
            {
                this.mImgDismiss.MouseLeftButtonUp += closeButtonHandler;
            }
            if (muteButtonHandler != null)
            {
                this.mOuterGridPopUp.PreviewMouseLeftButtonUp += muteButtonHandler;
            }
            this.AutoClose = autoClose;
            if (!NotificationWindow.Instance.AppNotificationCountDictForEachVM.ContainsKey(this.VmName))
            {
                NotificationWindow.Instance.AppNotificationCountDictForEachVM[this.VmName] = new Dictionary <string, int>();
            }
            if (!NotificationWindow.Instance.AppNotificationCountDictForEachVM[this.VmName].ContainsKey(this.Title))
            {
                NotificationWindow.Instance.AppNotificationCountDictForEachVM[this.VmName].Add(this.Title, 0);
            }
            NotificationWindow.Instance.AppNotificationCountDictForEachVM[this.VmName][this.Title]++;
            JsonParser jsonParser = new JsonParser(vmName);

            this.AppName = string.IsNullOrEmpty(jsonParser.GetAppNameFromPackage(this.PackageName)) ? title : jsonParser.GetAppNameFromPackage(this.PackageName);
            CustomPictureBox.SetBitmapImage(this.mImage, "bluestackslogo", false);
            if (!string.IsNullOrEmpty(imagePath))
            {
                CustomPictureBox.SetBitmapImage(this.mImage, imagePath, true);
            }
            else
            {
                try
                {
                    if (string.IsNullOrEmpty(this.AppName))
                    {
                        return;
                    }
                    AppInfo infoFromPackageName = jsonParser.GetAppInfoFromPackageName(this.PackageName);
                    Logger.Info("For notification {0}: AppName-{1} Package-{2}", (object)id, (object)this.AppName, (object)this.PackageName);
                    if (infoFromPackageName == null)
                    {
                        return;
                    }
                    Logger.Info("For notification {0}: ImageName-{1}", (object)id, (object)infoFromPackageName.Img);
                    if (!File.Exists(Path.Combine(RegistryStrings.GadgetDir, infoFromPackageName.Img)))
                    {
                        return;
                    }
                    CustomPictureBox.SetBitmapImage(this.mImage, Path.Combine(RegistryStrings.GadgetDir, infoFromPackageName.Img), true);
                }
                catch
                {
                    Logger.Error("Error loading app icon file");
                }
            }
        }