示例#1
0
        public void StartClicking()
        {
            threadStarted = true;
            List<ListBoxBinder> ls2 = new List<ListBoxBinder>();
            foreach (ListBoxBinder ls in colorModel.ListBind)
            {
                ListBoxBinder ls3 = new ListBoxBinder();
                ls3.Background = ls.Background;
                ls3.Foreground = ls.Foreground;
                ls3.Content = ls.Content;
                ls3.ListBoxBinders = ls.ListBoxBinders;
                ls2.Add(ls3);
            }
            //Application.Current.Dispatcher.Invoke((Action)(() =>
            //{
            //    CheckClickRequirement(ls2);
            //}));
            //Application.Current.Dispatcher.Invoke(new Action(() => { CheckClickRequirement(ls2); }), DispatcherPriority.ContextIdle, null);

            myThread = new System.Threading.Thread(delegate()
            {

                while (!killThread)
                {
                    CheckClickRequirement(ls2);
                }
                killThread = false;
                threadStarted = false;
                //colorModel.EditText = "SWAG";
            });
            myThread.IsBackground = true;
            myThread.Start();
        }
示例#2
0
 public void SetListBoxColor()
 {
     bool canAdd = true;
     MouseHook.stop();
     System.Drawing.Color color = GetPixelColor(MouseHook.X, MouseHook.Y); // This is your color to convert from
     System.Windows.Media.Color newColor = System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B);
     ListBoxBinder listBoxBinder = new ListBoxBinder();
     listBoxBinder.Foreground = new SolidColorBrush(newColor);
     listBoxBinder.Background = Brushes.White;
     listBoxBinder.Content = newColor.ToString();
     foreach (ListBoxBinder lb in colorModel.ListBind)
     {
         if (lb.Content == listBoxBinder.Content)
         {
             canAdd = false;
         }
     }
     if (canAdd)
     {
         colorModel.ListBind.Add(listBoxBinder);
     }
     colorViewModel.ListBind = null;
     colorModel.ListBind = colorModel.ListBind;
 }