Exemplo n.º 1
0
        /// <summary>
        /// Constructs an DispatcherScheduler that schedules units of work on dispatcher.
        /// </summary>
        public DispatcherScheduler(System.Windows.Threading.Dispatcher dispatcher)
        {
            if (dispatcher == null)
                throw new ArgumentNullException("dispatcher");

            this.dispatcher = dispatcher;
        }
Exemplo n.º 2
0
 public MainContext()
 {
     foreach(var item in new DictionInfo().GetAllDictions())
         dictions.AddInUsingDictions(item);
     disp = Dispatcher.CurrentDispatcher;
     this.Initilize();
     popup.MenuClick += new EventHandler(popup_MenuClick);
 }
Exemplo n.º 3
0
 public S3DDataService()
     : base()
 {
     // this is bad.... this should not be used like a viewmodel... rewrite is in order
     _dispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher;
     Status.OperationDescription = "Idle";
     Status.PercentDone = 0;
 }
        public TestSerialViewModel()
        {
            thisdispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher;
            _SendCommand = new RelayCommand(DoSend);
            _SendRefresh = new RelayCommand(DoRefresh);

            _ComSource = System.IO.Ports.SerialPort.GetPortNames().ToList();
            RaisePropertyChanged("ComSource");
        }
Exemplo n.º 5
0
        public LibTorrentAlertsWatcher(Ragnar.Session session)
        {
            ses = session;
            alerts = ses.Alerts;

            main_thread_dispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher;

            watcher_thread = new System.Threading.Thread(monitor);
            watcher_thread.Priority = System.Threading.ThreadPriority.AboveNormal;
            watcher_thread.Start();
        }
Exemplo n.º 6
0
		public void PostFileContents(string url, IEnumerable<FileInfo> files, FilePostBehavior behavior, IDictionary<string, string> formData, System.Windows.Threading.Dispatcher dispatcher)
		{
			this.dispatcher = dispatcher;
			this.url = url;
			this.behavior = behavior;
			this.formData = formData;
			this.files = files;
			this.enumerator = files.GetEnumerator();
			OnFileSequenceProgressReport(0, 1);
			this.StartUpload();
		}
Exemplo n.º 7
0
		public void PostFileContents(string url, IEnumerable<FileInfo> files, FilePostBehavior behavior, IDictionary<string, string> formData, System.Windows.Threading.Dispatcher dispatcher)
		{
			this.dispatcher = dispatcher;
			this.url = url;
			this.behavior = behavior;
			this.formData = formData ?? new Dictionary<string, string>();
			this.enumerator = files.GetEnumerator();
			this.filesToTransfer = files.Count();
			this.filesTransferred = 0;

			if (enumerator.MoveNext())
				StartNextFile();
			else
				OnUploadCompleted(true, null);
		}
Exemplo n.º 8
0
		public FileSender(System.Windows.Threading.Dispatcher controlDispatcher)
		{
			FilePosition = 0;
			Steps = 0;
			CurrentStep = 0;
			FileLength = 0;
			ChunkRetryAttempts = 4;
			_CurrentWriteLength = 0;
			Token = Guid.Empty;
			_UIDispatcher = controlDispatcher;

			//default
			UriBuilder builder = new UriBuilder(Utility.BaseUrl);
			builder.Path = builder.Path.TrimEnd('/') + "/Services/FileReceiver.ashx";
			this.Uri = builder.Uri;
		}
        public ShaderAutoReload(String shaderFilename, GraphicsDevice graphicsDevice, List<EffectData.ShaderMacro> shaderMacros = null, double checkEvery_ms = 500.0)
        {
            this.shaderFilename = Path.GetFullPath(shaderFilename);
            this.graphicsDevice = graphicsDevice;
            this.shaderMacros = shaderMacros;
            ReloadShader();

            dispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher;

            watcher = new FileSystemWatcher();
            watcher.Path = Path.GetFullPath(Path.GetDirectoryName(shaderFilename));
            watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
               | NotifyFilters.FileName | NotifyFilters.DirectoryName;
            watcher.Changed += OnSourceFileChanged;
            watcher.Filter = "*.*"; // For unknown reason *.fx didn't work. The documentation says that it should be possible to set the specific file as filter http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher%28VS.71%29.aspx

            watcher.EnableRaisingEvents = true;
        }
Exemplo n.º 10
0
        /// <summary>
        /// 
        /// </summary>
        public SettingsViewModel()
        {
            dispatcher = Deployment.Current.Dispatcher;

            if (!DesignerProperties.IsInDesignTool)
            {
                this.Tag = StorageHelper.GetTag();
                this.State = StorageHelper.RequestCurrentStatus;
                this.ImagesCount = StorageHelper.CountImage;
            }

            ImageServiceModel.ImageDownloaded += (sender,e) =>
                {
                    dispatcher.BeginInvoke(() =>
                    {
                        this.ImagesCount++;
                    });

                };

            ImageServiceModel.BeginDownload += (sender, e) =>
                {
                    dispatcher.BeginInvoke(() =>
                    {
                        this.ImagesCount = 0;
                    });
                };

            ImageServiceModel.RequestStateChanged += (sender, e) =>
                {
                    dispatcher.BeginInvoke(() =>
                        {
                            this.State = e.Result;
                        });
                };

            ImageServiceModel.ProgressChanged += (sender, e) =>
                {
                    dispatcher.BeginInvoke(() =>
                        {
                            this.BytesDownloaded = e.Result;
                        });
                };
        }
Exemplo n.º 11
0
 public PinboardViewModel(System.Windows.Threading.Dispatcher Dispatcher, string ApiToken)
 {
     System.Diagnostics.Debug.WriteLine("ApiToken ==> " + ApiToken); // TODO
     this.Dispatcher = Dispatcher;
     Pinboard = new PinboardManager(ApiToken);
     BookmarkList = new ObservableCollection<PinboardBookmark>();
     Pinboard.GetRecentBookmarks(30).ContinueWith((task) =>
     {
         Dispatcher.Invoke(() =>
         {
             List<PinboardBookmark> Bookmarks = task.Result;
             foreach (PinboardBookmark Bookmark in Bookmarks)
             {
                 System.Diagnostics.Debug.WriteLine("Adding bookmark ==> " + Bookmark.Title);
                 BookmarkList.Add(Bookmark);
             }
         });
     });
 }
 public CRendererBackground(FrameworkElement frameWorkElement, DrawingVisual drawingViusal, Image defaultImage,
                            System.Windows.Threading.Dispatcher disp)
     : this(frameWorkElement, drawingViusal, disp)
 {
     _defaultImg = defaultImage;
 }
Exemplo n.º 13
0
        public static void Init(System.Windows.Controls.Panel parentControl, System.Windows.Threading.Dispatcher dispatcher)
        {
            if (!IsInited)
                SiteManagerCHR.Init();

            ParentControl = parentControl;
            Dispatcher = dispatcher;
        }
Exemplo n.º 14
0
 private WpfDispatcher(WindowsDispatcher windowsDispatcher)
 {
     _windowsDispatcher = windowsDispatcher ?? throw new ArgumentNullException(nameof(windowsDispatcher));
 }
        public static InfoWindow Create(string title, string text, string image_url, string action_name, Action action, string sound_file = null, Brush box_brush = null, Brush button_brush = null)
        {
            InfoWindow w = null;

            if (text.Length > Settings.View.InfoToastMaxTextLength)
            {
                text = text.Remove(Settings.View.InfoToastMaxTextLength, text.Length - Settings.View.InfoToastMaxTextLength) + "<...>";
            }

            Action a = () =>
            {
                w = new InfoWindow(title, text, image_url, action_name, action);
                w.SetAppearance(box_brush, button_brush);
                WindowInteropHelper h = new WindowInteropHelper(w);
                h.EnsureHandle();
                w.Show();
                ThreadRoutines.StartTry(() =>
                {
                    Thread.Sleep(Settings.View.InfoToastLifeTimeInSecs * 1000);
                    w.Dispatcher.BeginInvoke((Action)(() => { w.Close(); }));
                });
                if (string.IsNullOrWhiteSpace(sound_file))
                {
                    sound_file = Settings.View.InfoSoundFile;
                }
                sound_file = PathRoutines.GetAbsolutePath(sound_file);
                SoundPlayer sp = new SoundPlayer(sound_file);
                sp.Play();
            };

            lock (ws)
            {
                if (dispatcher == null)
                {//!!!the following code does not work in static constructor because creates a deadlock!!!
                    dispatcher_t = ThreadRoutines.StartTry(() =>
                    {
                        if (invisible_owner_w == null)
                        {//this window is used to hide notification windows from Alt+Tab panel
                            invisible_owner_w               = new Window();
                            invisible_owner_w.Width         = 0;
                            invisible_owner_w.Height        = 0;
                            invisible_owner_w.WindowStyle   = WindowStyle.ToolWindow;
                            invisible_owner_w.ShowInTaskbar = false;
                            invisible_owner_w.Show();
                            invisible_owner_w.Hide();
                        }

                        if (dispatcher == null)
                        {
                            //dispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher;
                            dispatcher = System.Windows.Threading.Dispatcher.FromThread(Thread.CurrentThread);
                            System.Windows.Threading.Dispatcher.Run();
                        }
                    }, null, null, true, ApartmentState.STA);
                    if (!SleepRoutines.WaitForCondition(() => { return(dispatcher != null); }, 3000))
                    {
                        throw new Exception("Could not get dispatcher.");
                    }
                }
            }
            dispatcher.Invoke(a);
            return(w);
        }
Exemplo n.º 16
0
 public static void Init(System.Windows.Threading.Dispatcher dispatcher)
 {
     wpf = dispatcher;
 }
Exemplo n.º 17
0
 public TimeChartViewModel(IEnumerable <KeyValuePair <DateTime, double> > series, string name, System.Windows.Threading.Dispatcher dispatcher) : this()
 {
     dispatcher.Invoke(() =>
     {
         var line = SeriesCollection.GetLineOrNew(name);
         foreach (var _ in series)
         {
             line.Values.Add(new DateTimePoint
             {
                 DateTime = _.Key,
                 Value    = _.Value,
             });
         }
     });
 }
        private UIElement Visualize(object obj)
        {
            // Create top level table grid
            Grid tableGrid = new Grid();
            dispatcher = tableGrid.Dispatcher;

            Grid.SetIsSharedSizeScope(tableGrid, true);
            tableGrid.RowDefinitions.Add(new RowDefinition()
            {
                Height = new GridLength(1, GridUnitType.Auto),
            });

            // Create table header
            TreeViewItem header = new TreeViewItem();
            Grid headerGrid = CreateTreeItemGrid(0);
            TextBlock name = new TextBlock();
            name.Text = "Name";
            name.FontWeight = FontWeights.Bold;
            Grid.SetColumn(name, NameColumnIndex);
            headerGrid.Children.Add(name);
            TextBlock value = new TextBlock();
            value.Text = "Value";
            value.FontWeight = FontWeights.Bold;
            Grid.SetColumn(value, ValueColumnIndex);
            headerGrid.Children.Add(value);
            TextBlock type = new TextBlock();
            type.Text = "Type";
            type.FontWeight = FontWeights.Bold;
            Grid.SetColumn(type, TypeColumnIndex);
            headerGrid.Children.Add(type);
            emptyListItem = new TreeViewItem();
            emptyListItem.Padding = new Thickness(0);
            emptyListItem.Focusable = false;
            Grid.SetColumn(emptyListItem, 1);
            emptyListItem.Focusable = false;
            headerGrid.Children.Add(emptyListItem);
            header.Focusable = false;
            header.Header = headerGrid;

            // Create table tree
            TreeView tree = new TreeView();
            IResultTreeItem resultTreeItem = ResultTreeItem.Create(obj, obj.GetType(), "result", null, this);

            tree.PreviewKeyDown += Tree_PreviewKeyDown;
            tree.Items.Add(header);
            tree.Items.Add(CreateTreeItem(resultTreeItem, 0));
            ((TreeViewItem)tree.Items[1]).IsSelected = true;
            tableGrid.Children.Add(tree);
            return tableGrid;
        }
Exemplo n.º 19
0
 public Dispatcher(System.Windows.Threading.Dispatcher wpfDispatcher)
 {
     _wpfDispatcher = wpfDispatcher;
 }
Exemplo n.º 20
0
 public Dispatcher(System.Windows.Threading.Dispatcher dispatcher)
 {
     _dispatcher = dispatcher;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ChallengeHandler"/> class.
 /// </summary>
 /// <param name="dispatcher">The Dispatcher for the application</param>
 public ChallengeHandler(System.Windows.Threading.Dispatcher dispatcher)
 {
     _dispatcher = dispatcher;
 }
Exemplo n.º 22
0
 public static void SetDefaultFactory(System.Windows.Threading.Dispatcher dispatcher)
 {
     SetDefaultFactory(new WpfDispatcherBackend(dispatcher));
 }
Exemplo n.º 23
0
 public static PromiseFactory CreateFactory(System.Windows.Threading.Dispatcher dispatcher)
 {
     return(new PromiseFactory(dispatcher));
 }
Exemplo n.º 24
0
 public MainThreadInvoker(System.Windows.Threading.Dispatcher mainThreadDispatcher)
 {
     this.mainThreadDispatcher = mainThreadDispatcher;
 }
Exemplo n.º 25
0
 public DomainStatisticsItem(System.Windows.Threading.Dispatcher collectionDispatcher)
 {
     _childItems = new ObservableCollection <DomainStatisticsItemBase>(collectionDispatcher);
 }
Exemplo n.º 26
0
        // To use Loaded event put Loaded="WindowLoaded" attribute in root element of .xaml file.
        // private void WindowLoaded(object sender, EventArgs e) {}

        // When user clicks button, display capabilities in panel
        private void Button1Click(object sender, RoutedEventArgs e)
        {
            // Clear the textbox if they clicked once before
            textbox1.Clear();

            // Find out if we have more than one tablet device
            int count = Tablet.TabletDevices.Count;

            if (count == 1)
            {
                textbox1.AppendText("There is one tablet device\n");
            }
            else
            {
                textbox1.AppendText("There are " + count + " tablet devices\n");
            }

            // <Snippet7>
            // Get the current tablet device, if it exists
            TabletDevice myCurrentTabletDevice = Tablet.CurrentTabletDevice;

            // </Snippet7>

            if (null != myCurrentTabletDevice)
            {
                textbox1.AppendText("INFO: Got the current tablet device\n");
            }
            else
            {
                textbox1.AppendText("INFO: Cannot get the current tablet device\n");
            }

            // <Snippet15>
            // Get the TabletDevice objects
            TabletDeviceCollection myTabletDeviceCollection = Tablet.TabletDevices;

            // <Snippet24>
            // Display the types of TabletDevices
            foreach (TabletDevice td in myTabletDeviceCollection)
            {
                Console.WriteLine(td.Type);
            }
            // </Snippet24>
            // </Snippet15>

            // Store them in an array of strings
            // <Snippet16>
            // Get the number of tablet devices
            int numTabletDevices = myTabletDeviceCollection.Count;

            // </Snippet16>

            // <Snippet19>
            string[] myTabletDeviceNamesArray = new string[numTabletDevices];

            for (int i = 0; i < numTabletDevices; i++)
            {
                myTabletDeviceNamesArray[i] = myTabletDeviceCollection[i].Name;
            }
            // </Snippet19>

            bool gotCurrentTabletDevice = false;

            // Display a list of tablet device names
            for (int i = 0; i < numTabletDevices; i++)
            {
                TabletDevice theTD = myTabletDeviceCollection[i];

                textbox1.AppendText("TabletDevice[" + i + "].Name == \"" + theTD.Name + "\"");

                // Is this one the current TabletDevice?
                if (theTD == myCurrentTabletDevice)
                {
                    textbox1.AppendText(" (current tablet device)\n\n");

                    gotCurrentTabletDevice = true;
                }
                else
                {
                    textbox1.AppendText("\n\n");
                }
            }

            if (!gotCurrentTabletDevice)
            {
                textbox1.AppendText("No match for current tablet device\n\n");
            }


            // <Snippet17>
            // Is the collection thread safe?
            if (!myTabletDeviceCollection.IsSynchronized)
            {
                // If not, use SyncRoot to lock access
                lock (myTabletDeviceCollection.SyncRoot)
                {
                    // work with collection
                }
            }
            // </Snippet17>

            TabletDevice[] myTabletDeviceArray = new TabletDevice[100];
            int            index = 0;

            // <Snippet18>
            // Copy the collection to array of tablet devices starting at position index
            myTabletDeviceCollection.CopyTo(myTabletDeviceArray, index);
            // </Snippet18>

            // <Snippet3>
            // Get the first tablet device
            TabletDevice myTabletDevice = Tablet.TabletDevices[0];

            // </Snippet3>

            // If tablet device exists, display its capabilities
            if (null != myTabletDevice)
            {
                textbox1.AppendText("TABLET\n\n");
                textbox1.AppendText("Properties\n\n");

                // Display the tablet device properties

                // <Snippet4>
                PresentationSource myPresentationSource = myTabletDevice.ActiveSource;

                if (null != myPresentationSource)
                {
                    textbox1.AppendText("ActiveSource.RootVisual: " + myPresentationSource.RootVisual.ToString() + "\n");
                }
                else
                {
                    textbox1.AppendText("ActiveSource: null\n");
                }
                // </Snippet4>

                // <Snippet5>
                System.Windows.Threading.Dispatcher myDispatcher = myTabletDevice.Dispatcher;

                if (null != myDispatcher)
                {
                    textbox1.AppendText("Dispatcher: " + myDispatcher.ToString() + "\n");
                }
                else
                {
                    textbox1.AppendText("Dispatcher: null\n");
                }
                // </Snippet5>

                // <Snippet8>
                textbox1.AppendText("Id: " + myTabletDevice.Id + "\n");
                // </Snippet8>

                // <Snippet9>
                textbox1.AppendText("Name: " + myTabletDevice.Name + "\n");
                // </Snippet9>

                // <Snippet10>
                textbox1.AppendText("ProductId: " + myTabletDevice.ProductId + "\n");
                // </Snippet10>

                // <Snippet11>
                // Get the StylusDevice objects.
                StylusDeviceCollection myStylusDeviceCollection = myTabletDevice.StylusDevices;

                // Get the names of all of the of StylusDevice objects.
                string[] myStylusDeviceNames = new string[myStylusDeviceCollection.Count];

                for (int i = 0; i < myStylusDeviceCollection.Count; i++)
                {
                    myStylusDeviceNames[i] = myStylusDeviceCollection[i].Name;
                }
                // </Snippet11>

                // Or store them in an array of strings

                // <Snippet20>
                // Get the number of stylus devices
                int numStylusDevices = myStylusDeviceCollection.Count;
                // </Snippet20>

                // <Snippet21>
                string[] myStylusDeviceNamesArray = new string[numStylusDevices];

                for (int i = 0; i < numStylusDevices; i++)
                {
                    myStylusDeviceNamesArray[i] = myStylusDeviceCollection[i].Name;
                }
                // </Snippet21>

                // <Snippet22>
                // Is the collection thread safe?
                //if (!myStylusDeviceCollection.IsSynchronized)
                //{
                //    // If not, use SyncRoot to lock access
                //    lock (myStylusDeviceCollection.SyncRoot)
                //    {
                //        // work with collection
                //    }
                //}
                // </Snippet22>

                StylusDevice[] myStylusDeviceArray = new StylusDevice[100];
                index = 0;

                // <Snippet23>
                // Copy the collection to array of stylus devices starting at position index
                myStylusDeviceCollection.CopyTo(myStylusDeviceArray, index);
                // </Snippet23>

                for (int i = 0; i < myStylusDeviceCollection.Count; i++)
                {
                    textbox1.AppendText("StylusDevice[" + i + "] name: " + myStylusDeviceCollection[i].Name + "\n");
                }

                // <Snippet12>
                //StylusPointDescription myStylusPointDescription = myTabletDevice.StylusPacketDescription;
                // </Snippet12>

                //if (null != myStylusPointDescription)
                //{
                //    textbox1.AppendText("StylusPointDescription\n");
                //    textbox1.AppendText("    Number of buttons: " + myStylusPointDescription.ButtonCount + "\n");

                //    // Buttons
                //    for (int k = 0; k < myTabletDevice.StylusPacketDescription.ButtonCount; k++)
                //    {
                //        textbox1.AppendText("        Button[" + k + "] GUID: " + myStylusPointDescription.GetButton(k).ToString() + "\n");
                //    }

                //    textbox1.AppendText("    Packet size: " + myStylusPointDescription.PacketSize + "\n");
                //    textbox1.AppendText("    Number of values: " + myStylusPointDescription.ValueCount + "\n");

                //    // Stylus metrics
                //    ReadOnlyCollection<StylusPointPropertyInfo> myStylusPointProperties =
                //                                    myStylusPointDescription.GetStylusPointProperties();

                //    // If metrics exist, display them
                //    if (null != myStylusPointProperties)
                //    {
                //        for (int j = 0; j < myStylusPointProperties.Length; j++)
                //        {
                //            textbox1.AppendText("    Metric[" + j + "]\n");
                //            textbox1.AppendText("        Name:       " + GetPacketValueName(myStylusPointProperties[j].Guid) + "\n");
                //            textbox1.AppendText("        Guid:       " + myStylusPointProperties[j].Id.ToString() + "\n");
                //            textbox1.AppendText("        Min:        " + myStylusPointProperties[j].Minimum.ToString() + "\n");
                //            textbox1.AppendText("        Max:        " + myStylusPointProperties[j].Maximum.ToString() + "\n");
                //            textbox1.AppendText("        Unit:       " + myStylusPointProperties[j].Unit.ToString() + "\n");
                //            textbox1.AppendText("        Resolution: " + myStylusPointProperties[j].Resolution.ToString() + "\n");
                //            textbox1.AppendText("\n");
                //        }
                //    }
                //}
                //else
                //{
                //    textbox1.AppendText("StylusPacketDescription: null\n");
                //}

                // <Snippet13>
                if (null != myTabletDevice.Target)
                {
                    textbox1.AppendText("Target: " + myTabletDevice.Target.GetType().Name + "\n");
                }
                else
                {
                    textbox1.AppendText("Target: null\n");
                }
                // </Snippet13>

                // <Snippet2>
                // Get the type of tablet device
                TabletDeviceType myTabletDeviceType = myTabletDevice.Type;

                // Display the type of tablet device
                textbox1.AppendText("Type: ");

                switch (myTabletDeviceType)
                {
                case TabletDeviceType.Stylus:
                    textbox1.AppendText("Stylus\n");
                    break;

                default:     // TabletDeviceType.Touch:
                    textbox1.AppendText("Touch Pad\n");
                    break;
                }
                // </Snippet2>

                // Show output from TabletDevice.ToString()
                // <Snippet14>
                textbox1.AppendText("\n\nTablet Device:" + myTabletDevice.ToString() + "\n\n");
                // </Snippet14>

                textbox1.AppendText("\n");


                // <Snippet1>
                // Get the capabilities of the current tablet device
                TabletHardwareCapabilities myHWCaps = myTabletDevice.TabletHardwareCapabilities;
                // </Snippet1>


                // <Snippet26>
                if ((Tablet.CurrentTabletDevice.TabletHardwareCapabilities
                     & TabletHardwareCapabilities.SupportsPressure) ==
                    TabletHardwareCapabilities.SupportsPressure)
                {
                    textbox1.AppendText("The tablet can detect the pressure of the teblet pen.");
                }
                // </Snippet26>

                textbox1.AppendText("\n");

                //// Get the current stylus, if it exists:
                //StylusDevice myStylusDevice = myTabletDevice.StylusDevices[0];

                //// If stylus exists, print its properties
                //if (null != myStylusDevice)
                //{
                //    textbox1.AppendText("STYLUS\n\n");

                //    textbox1.AppendText("ActiveSource: " + GetStringOrNull(myStylusDevice.ActiveSource) + "\n");
                //    textbox1.AppendText("Captured: " + GetStringOrNull(myStylusDevice.Captured) + "\n");
                //    textbox1.AppendText("DirectlyOver: " + GetStringOrNull(myStylusDevice.DirectlyOver) + "\n");
                //    textbox1.AppendText("Dispatcher: " + GetStringOrNull(myStylusDevice.Dispatcher) + "\n");
                //    textbox1.AppendText("ID: " + GetStringOrNull(myStylusDevice.Id) + "\n");
                //    textbox1.AppendText("InAir: " + GetStringOrNull(myStylusDevice.InAir) + "\n");
                //    textbox1.AppendText("InRange: " + GetStringOrNull(myStylusDevice.InRange) + "\n");
                //    textbox1.AppendText("Inverted: " + GetStringOrNull(myStylusDevice.Inverted) + "\n");
                //    textbox1.AppendText("Name: " + GetStringOrNull(myStylusDevice.Name) + "\n");
                //    textbox1.AppendText("PacketCount: " + GetStringOrNull(myStylusDevice.GetPackets(null).PacketCount) + "\n");
                //    textbox1.AppendText("Tablet Device: " + GetStringOrNull(myStylusDevice.TabletDevice.Name) + "\n");
                //    textbox1.AppendText("Tablet Position: " + GetStringOrNull(myStylusDevice.GetPosition(null)) + "\n");
                //    textbox1.AppendText("Target: " + GetStringOrNull(myStylusDevice.Target) + "\n");
                //}
            }
        }
Exemplo n.º 27
0
        void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Mainwindow.setglass();

             Mainwindow.Left = o3o.Properties.Settings.Default.LastWindowPosition.X;
             Mainwindow.Top = o3o.Properties.Settings.Default.LastWindowPosition.Y;

             Mainwindow.SettingsAmountOfTweetsTextb.Text = o3o.Properties.Settings.Default.amountOfTWeetsToDisplay.ToString();
            loadsounds();

            if (o3o.Properties.Settings.Default.use_system_color == true)
            {
                Mainwindow.checkBox1.IsChecked = true;
            }

            if (UsrDB.load() == false || UsrDB.Users.Count == 0)
                UsrDB.CreateUser();
            Mainwindow.UserSelectionMenuCurrentName.Header = UsrDB.Users[0].UserDetails.ScreenName;

            Mainwindow.DisplaysComboBox.SelectedIndex = o3o.Properties.Settings.Default.DisplayIndex;
            int dex;
            int upperBound = Displays.GetUpperBound(0);
            for (dex = 0; dex <= upperBound; dex++)
            {
                if (Displays[dex].Primary)
                {
                    Mainwindow.DisplaysComboBox.Items.Add(dex + ": " + Displays[dex].DeviceName + " Width:" + Displays[dex].Bounds.Width.ToString() + " Height:" + Displays[dex].Bounds.Height.ToString() + " (primary)");
                }
                else
                {
                    string entry = dex + ": " + Displays[dex].DeviceName + " Width:" + Displays[dex].Bounds.Width.ToString() + " Height:" + Displays[dex].Bounds.Height.ToString();
                    System.Windows.Point primaryscreen = new System.Windows.Point(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y);
                    if (Displays[dex].Bounds.X < primaryscreen.X)
                    {
                        if (Displays[dex].Bounds.Y > primaryscreen.Y)
                        {
                            entry = entry + " (Bottom Left)";
                        }
                        else if (Displays[dex].Bounds.Y < primaryscreen.Y)
                        {
                            entry = entry + " (Top Left)";
                        }
                        else
                        {
                            entry = entry + " (Left)";
                        }
                    }
                    else if (Displays[dex].Bounds.X > primaryscreen.X)
                    {
                        if (Displays[dex].Bounds.Y > primaryscreen.Y)
                        {
                            entry = entry + " (Bottom Right)";
                        }
                        else if (Displays[dex].Bounds.Y < primaryscreen.Y)
                        {
                            entry = entry + " (Top Right)";
                        }
                        else
                        {
                            entry = entry + " (Right)";
                        }
                    }
                    else if (Displays[dex].Bounds.X == primaryscreen.X)
                    {
                        if (Displays[dex].Bounds.Y < primaryscreen.Y)
                        {
                            entry = entry + " (Bottom)";
                        }
                        else if (Displays[dex].Bounds.Y > primaryscreen.Y)
                        {
                            entry = entry + " (Top)";
                        }
                        else
                        {
                            entry = entry + " (What?)";
                        }
                    }
                    Mainwindow.DisplaysComboBox.Items.Add(entry);
                }

            }
                maindispatcher = this.Dispatcher;
                foreach (UserDatabase.User usr in UsrDB.Users)
                {
                    usr.tweetStack.NewTweet += new TweetStack.newtweetDel(o3o_NewTweet);
                    usr.tweetStack.DMReceived += new TweetStack.DMReceivedDel(o3o_NewDM);
                    usr.tweetStack.TweetDeleted +=new TweetStack.TweetDeletedDel(o3o_TweetDeleted);
                }

                UpdateUserMenu(UsrDB);
        }
        public InteractiveCollectionViewModel(IEnumerable <T> enumerable, string childrenpath, IObservable <bool> ischecked, IObservable <bool> expand, System.Windows.Threading.Dispatcher dispatcher = null, Func <T, IConvertible> getkey = null, string title = null)
        {
            var xx = enumerable.Select
                         (s =>
            {
                var so = new SEObject <T>(s, childrenpath, ischecked, expand, dispatcher, getkey?.Invoke(s));

                return((IContain <T>)so);
            }).ToList();

            foreach (var so in xx)
            {
                this.ReactToChanges((SEObject <T>)so);
                (so as SEObject <T>).OnPropertyChangeWithSource <SEObject <T>, KeyValuePair <T, InteractionArgs> >(nameof(SEObject <T> .ChildChanged)).Subscribe(_ =>
                {
                    ChildSubject.OnNext(_.Item2);
                });
            }

            _items = new ReadOnlyObservableCollection <IContain <T> >(new ObservableCollection <IContain <T> >(xx));

            ischecked.DelaySubscription(TimeSpan.FromSeconds(0.5)).Take(1).Subscribe(_ =>
            {
                foreach (var x in xx)
                {
                    (x as SEObject <T>).IsChecked = _;
                }
            });

            Title = title;
        }
        public EditorNavigationDropdownBar(IVsCodeWindow codeWindow, IVsEditorAdaptersFactoryService editorAdaptersFactory, IEnumerable<IEditorNavigationSource> sources, IBufferGraphFactoryService bufferGraphFactoryService, IJavaEditorNavigationTypeRegistryService editorNavigationTypeRegistryService)
        {
            Contract.Requires<ArgumentNullException>(codeWindow != null, "codeWindow");
            Contract.Requires<ArgumentNullException>(editorAdaptersFactory != null, "editorAdaptersFactory");
            Contract.Requires<ArgumentNullException>(sources != null, "sources");
            Contract.Requires<ArgumentNullException>(bufferGraphFactoryService != null, "bufferGraphFactoryService");
            Contract.Requires<ArgumentNullException>(editorNavigationTypeRegistryService != null, "editorNavigationTypeRegistryService");

            this._codeWindow = codeWindow;
            this._editorAdaptersFactory = editorAdaptersFactory;
            this._sources = sources;
            this._bufferGraphFactoryService = bufferGraphFactoryService;
            this._editorNavigationTypeRegistryService = editorNavigationTypeRegistryService;
            this._currentTextView = editorAdaptersFactory.GetWpfTextView(codeWindow.GetLastActiveView());
            this._dispatcher = this._currentTextView.VisualElement.Dispatcher;
            this._imageList = new ImageList()
                {
                    ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit
                };

            _navigationControls =
                this._sources
                .SelectMany(source => source.GetNavigationTypes())
                .Distinct()
                //.OrderBy(...)
                .Select(type => Tuple.Create(type, new List<IEditorNavigationTarget>()))
                .ToArray();

            _selectedItem = new IEditorNavigationTarget[_navigationControls.Length];

            if (this._navigationControls.Length == 0)
            {
                return;
            }

            IConnectionPointContainer connectionPointContainer = codeWindow as IConnectionPointContainer;
            if (connectionPointContainer != null)
            {
                Guid textViewEventsGuid = typeof(IVsCodeWindowEvents).GUID;
                IConnectionPoint connectionPoint;
                connectionPointContainer.FindConnectionPoint(ref textViewEventsGuid, out connectionPoint);
                if (connectionPoint != null)
                    connectionPoint.Advise(this, out _codeWindowEventsCookie);
            }

            IVsTextView primaryView = codeWindow.GetPrimaryView();
            if (primaryView != null)
                ((IVsCodeWindowEvents)this).OnNewView(primaryView);

            IVsTextView secondaryView = codeWindow.GetSecondaryView();
            if (secondaryView != null)
                ((IVsCodeWindowEvents)this).OnNewView(secondaryView);

            foreach (var source in this._sources)
            {
                source.NavigationTargetsChanged += WeakEvents.AsWeak(OnNavigationTargetsChanged, eh => source.NavigationTargetsChanged -= eh);
                UpdateNavigationTargets(source);
            }

            _currentTextView.Caret.PositionChanged += OnCaretPositionChanged;
        }
Exemplo n.º 30
0
 /// <summary>
 /// 用在其上创建了 System.Windows.Threading.Dispatcher 的线程的指定参数异步执行指定委托。
 /// </summary>
 /// <param name="dispatcher"></param>
 /// <param name="a">对采用 args 中指定参数的方法的委托,该委托将被推送到 System.Windows.Threading.Dispatcher 事件队列中。</param>
 /// <returns></returns>
 public static System.Windows.Threading.DispatcherOperation BeginInvoke(this System.Windows.Threading.Dispatcher dispatcher, Action a)
 {
     return(dispatcher.BeginInvoke(a, null));
 }
Exemplo n.º 31
0
 public DispatcherScheduler(System.Windows.Threading.Dispatcher dispatcher)
 {
 }
Exemplo n.º 32
0
 /// <summary>
 /// WpfDispatcher constructor.
 /// </summary>
 /// <param name="uiThread">The UI thread.</param>
 public Dispatcher(Thread uiThread)
 {
     // Initialization.
     _Dispatcher = System.Windows.Threading.Dispatcher.FromThread(uiThread);
 }
Exemplo n.º 33
0
 public ChatUser(string name, System.Windows.Threading.Dispatcher UIDispatcher)
 {
     this.name = name;
     this.UIDispatcher = UIDispatcher;
 }
Exemplo n.º 34
0
 protected ViewModelSystemBase()
 {
     _UIDispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher;
 }
Exemplo n.º 35
0
 public ChatToServer(System.Windows.Threading.Dispatcher mainDispatcher)
 {
     this.mainDispatcher = mainDispatcher;
 }
Exemplo n.º 36
0
 public MobileBarcodeScanner(System.Windows.Threading.Dispatcher dispatcher) : base()
 {
     this.Dispatcher = dispatcher;
 }
Exemplo n.º 37
0
 public wpfSender(TextBox lStat, System.Windows.Threading.Dispatcher dispatcher)
 {
     dispatcher_ = dispatcher;  // use to send results action to main UI thread
     lStat_      = lStat;
 }
Exemplo n.º 38
0
        void Window_Loaded(object sender, RoutedEventArgs e)
        {
            changeUI(o3o.Properties.Settings.Default.Layout);
            if (this.CheckDwm())
            {
                this.SetAeroGlass();
            }

            this.Left = o3o.Properties.Settings.Default.LastWindowPosition.X;
            this.Top = o3o.Properties.Settings.Default.LastWindowPosition.Y;
            this.Height = o3o.Properties.Settings.Default.LastWindowHeight;

            this.TweetsDisplaySlider.Value = o3o.Properties.Settings.Default.amountOfTWeetsToDisplay;
            loadsounds();

            if (o3o.Properties.Settings.Default.use_system_color)
            {
                this.checkBox1.IsChecked = true;
            }

            if (o3o.Properties.Settings.Default.PlayNotificationSound)
            {
                this.SoundCheckBox.IsChecked = true;
            }

            if (o3o.Properties.Settings.Default.ShowNotificationPopup)
            {
                this.PopupCheckBox.IsChecked = true;
            }

            if (Properties.Settings.Default.TopMostNotify)
            {
                this.topmostcheckbox.IsChecked = true;
            }
            Color col = System.Windows.Media.Color.FromArgb(Properties.Settings.Default.system_color.A,Properties.Settings.Default.system_color.R,Properties.Settings.Default.system_color.G,Properties.Settings.Default.system_color.B);
            colorpicker.recContent.Fill = new SolidColorBrush(col);
            colorpicker.SelectedColor = col;
            if (UsrDB.load() == false || UsrDB.Users.Count == 0)
                UsrDB.CreateUser();
            if (UsrDB.Users[0].UserDetails != null)
            {
            this.UserSelectionMenuCurrentName.Header = UsrDB.Users[0].UserDetails.ScreenName;
            }
            else
            {
                UsrDB.WipeUsers();
                System.Windows.Application.Current.Shutdown();
            }

            #region displaystuff
            this.DisplaysComboBox.SelectedIndex = o3o.Properties.Settings.Default.DisplayIndex;
            int dex;
            int upperBound = Displays.GetUpperBound(0);
            for (dex = 0; dex <= upperBound; dex++)
            {
                if (Displays[dex].Primary)
                {
                    this.DisplaysComboBox.Items.Add(dex + ": " + Displays[dex].DeviceName + " Width:" + Displays[dex].Bounds.Width.ToString() + " Height:" + Displays[dex].Bounds.Height.ToString() + " (primary)");
                }
                else
                {
                    string entry = dex + ": " + Displays[dex].DeviceName + " Width:" + Displays[dex].Bounds.Width.ToString() + " Height:" + Displays[dex].Bounds.Height.ToString();
                    System.Windows.Point primaryscreen = new System.Windows.Point(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y);
                    if (Displays[dex].Bounds.X < primaryscreen.X)
                    {
                        if (Displays[dex].Bounds.Y > primaryscreen.Y)
                        {
                            entry = entry + " (Bottom Left)";
                        }
                        else if (Displays[dex].Bounds.Y < primaryscreen.Y)
                        {
                            entry = entry + " (Top Left)";
                        }
                        else
                        {
                            entry = entry + " (Left)";
                        }
                    }
                    else if (Displays[dex].Bounds.X > primaryscreen.X)
                    {
                        if (Displays[dex].Bounds.Y > primaryscreen.Y)
                        {
                            entry = entry + " (Bottom Right)";
                        }
                        else if (Displays[dex].Bounds.Y < primaryscreen.Y)
                        {
                            entry = entry + " (Top Right)";
                        }
                        else
                        {
                            entry = entry + " (Right)";
                        }
                    }
                    else if (Displays[dex].Bounds.X == primaryscreen.X)
                    {
                        if (Displays[dex].Bounds.Y < primaryscreen.Y)
                        {
                            entry = entry + " (Bottom)";
                        }
                        else if (Displays[dex].Bounds.Y > primaryscreen.Y)
                        {
                            entry = entry + " (Top)";
                        }
                        else
                        {
                            entry = entry + " (What?)";
                        }
                    }
                    this.DisplaysComboBox.Items.Add(entry);
                }

            }
            #endregion
            maindispatcher = this.Dispatcher;
            foreach (UserDatabase.User usr in UsrDB.Users)
            {
                usr.tweetStack.NewTweet += new TweetStack.newtweetDel(o3o_NewTweet);
                usr.tweetStack.DMReceived += new TweetStack.DMReceivedDel(o3o_NewDM);
                usr.tweetStack.TweetDeleted += new TweetStack.TweetDeletedDel(o3o_TweetDeleted);
                usr.tweetStack.clear += new TweetStack.clearTweetStack(o3o_clearTweetStack);
                usr.tweetStack.FetchTweets += new TweetStack.fetchTweets(o3o_FetchTweets);
                prefetch(usr);
            }

            UpdateUserMenu(UsrDB);

            _timer = new System.Timers.Timer(2000);
            _timer.Enabled = true;
            _timer.AutoReset = true;
            _timer.Elapsed += new System.Timers.ElapsedEventHandler(_timer_Elapsed);
            _timer.Start();
        }
Exemplo n.º 39
0
 internal static void RunOnContainerThread(System.Windows.Threading.Dispatcher target, Action action)
 {
     target.BeginInvoke(action);
 }
Exemplo n.º 40
0
 public PathingDataService()
     : base()
 {
     _dispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher;
 }
Exemplo n.º 41
0
 public static System.IObservable <TSource> SubscribeOn <TSource>(this System.IObservable <TSource> source, System.Windows.Threading.Dispatcher dispatcher)
 {
     throw null;
 }
Exemplo n.º 42
0
        private static void Main(string[] args)
        {
            //Log.Logger = new LoggerConfiguration()
            //    .Filter.ByIncludingOnly(Matching.WithProperty("Area", "Layout"))
            //    .MinimumLevel.Verbose()
            //    .WriteTo.Trace(outputTemplate: "[{Id:X8}] [{SourceContext}] {Message}")
            //    .CreateLogger();

            // The version of ReactiveUI currently included is for WPF and so expects a WPF
            // dispatcher. This makes sure it's initialized.
            System.Windows.Threading.Dispatcher foo = System.Windows.Threading.Dispatcher.CurrentDispatcher;

            App application = new App
            {
                DataTemplates = new DataTemplates
                {
                    new TreeDataTemplate <Node>(
                        x => new TextBlock {
                        Text = x.Name
                    },
                        x => x.Children,
                        x => true),
                },
            };

            TextBlock fps;

            var testCommand = ReactiveCommand.Create();

            testCommand.Subscribe(_ => System.Diagnostics.Debug.WriteLine("Test command executed."));

            Window window = new Window
            {
                Title         = "Perspex Test Application",
                SizeToContent = SizeToContent.WidthAndHeight,
                Content       = new Grid
                {
                    ColumnDefinitions = new ColumnDefinitions
                    {
                        new ColumnDefinition(1, GridUnitType.Star),
                        new ColumnDefinition(1, GridUnitType.Star),
                    },
                    RowDefinitions = new RowDefinitions
                    {
                        new RowDefinition(GridLength.Auto),
                        new RowDefinition(1, GridUnitType.Star),
                        new RowDefinition(GridLength.Auto),
                    },
                    Children = new Controls
                    {
                        new Menu
                        {
                            Items = new[]
                            {
                                new MenuItem
                                {
                                    Header = "_File",
                                    Items  = new[]
                                    {
                                        new MenuItem
                                        {
                                            Header = "_Open...",
                                            Icon   = new Image
                                            {
                                                Source = new Bitmap("github_icon.png"),
                                            },
                                        },
                                        new MenuItem
                                        {
                                            Header = "_Save",
                                            Items  = new[]
                                            {
                                                new MenuItem
                                                {
                                                    Header = "Sub Item _1",
                                                },
                                                new MenuItem
                                                {
                                                    Header = "Sub Item _2",
                                                },
                                            }
                                        },
                                        new MenuItem
                                        {
                                            Header = "Save _As",
                                            Items  = new[]
                                            {
                                                new MenuItem
                                                {
                                                    Header = "Sub Item _1",
                                                },
                                                new MenuItem
                                                {
                                                    Header = "Sub Item _2",
                                                },
                                            }
                                        },
                                        new MenuItem
                                        {
                                            Header  = "E_xit",
                                            Command = testCommand,
                                        },
                                    }
                                },
                                new MenuItem
                                {
                                    Header = "_Edit",
                                    Items  = new[]
                                    {
                                        new MenuItem
                                        {
                                            Header = "Cu_t",
                                        },
                                        new MenuItem
                                        {
                                            Header = "_Copy",
                                        },
                                        new MenuItem
                                        {
                                            Header = "_Paste",
                                        },
                                    }
                                }
                            },
                            [Grid.ColumnSpanProperty] = 2,
                        },
                        new TabControl
                        {
                            Items = new[]
                            {
                                ButtonsTab(),
                                TextTab(),
                                HtmlTab(),
                                ImagesTab(),
                                ListsTab(),
                                LayoutTab(),
                                AnimationsTab(),
                            },
                            Transition                = new PageSlide(TimeSpan.FromSeconds(0.25)),
                            [Grid.RowProperty]        = 1,
                            [Grid.ColumnSpanProperty] = 2,
                        },
                        (fps = new TextBlock
                        {
                            HorizontalAlignment = HorizontalAlignment.Left,
                            Margin = new Thickness(2),
                            [Grid.RowProperty] = 2,
                        }),
                        new TextBlock
                        {
                            Text = "Press F12 for Dev Tools",
                            HorizontalAlignment = HorizontalAlignment.Right,
                            Margin = new Thickness(2),
                            [Grid.ColumnProperty] = 1,
                            [Grid.RowProperty]    = 2,
                        },
                    }
                },
            };

            DevTools.Attach(window);

            //var renderer = ((IRenderRoot)window).Renderer;
            //var last = renderer.RenderCount;
            //DispatcherTimer.Run(() =>
            //{
            //    fps.Text = "FPS: " + (renderer.RenderCount - last);
            //    last = renderer.RenderCount;
            //    return true;
            //}, TimeSpan.FromSeconds(1));

            window.Show();
            Application.Current.Run(window);
        }
Exemplo n.º 43
0
 static SilverlightDispatcher()
 {
     dispatcher = System.Windows.Deployment.Current.Dispatcher;
 }
Exemplo n.º 44
0
		/// <summary>
		/// Initializes a new instance of the <see cref="InvokeableThread"/> class.
		/// </summary>
		/// <param name="name">The name of the thread to create.</param>
		/// <param name="priority">The thread priority this thread should be executed with.</param>
		/// <param name="dispatcherForReThrowingExceptions">The dispatcher for re throwing exceptions. Normally, you should use the dispatcher of the MainWindow.</param>
		public InvokeableThread(string name, System.Threading.ThreadPriority priority, System.Windows.Threading.Dispatcher dispatcherForReThrowingExceptions)
		{
			_dispatcherForReThrowingExceptions = dispatcherForReThrowingExceptions;
			Start(name, priority);
		}
Exemplo n.º 45
0
 public MapDataService()
     : base()
 {
     // this is bad.... this should not be used like a viewmodel... rewrite is in order
     _dispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher;
 }
Exemplo n.º 46
0
        public static void Start()
        {
            if (isStarted)
                return;
            isStarted = true;

            if (dispatcher == null)
            {
                dispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher;
            }

            //            IntPtr nextHook = IntPtr.Zero // COMMENTED BY CODEIT.RIGHT;
            //IntPtr dwThreadId = Win32.Threads.GetCurrentThreadId();
            IntPtr hModule = Marshal.GetHINSTANCE(System.Reflection.Assembly.GetEntryAssembly().GetModules()[0]);
            hHook = WinAPI.WindowHook.SetWindowsHookEx(WinAPI.WindowHook.HookType.WH_MOUSE_LL, hookProcPtr, hModule, 0);
            if (hHook == IntPtr.Zero)
            {
                // failed
                isStarted = false;
                ("MSHOOK: Hook Failed winerr=0x" + Marshal.GetLastWin32Error().ToString("X")).Log();
            }
        }
Exemplo n.º 47
0
 public DoorsDataService(MySqlConnection conn)
 {
     _connection = conn;
     _dispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher;
 }
Exemplo n.º 48
0
        void _manager_SwipeDetected(object sender, SwipeGestureRecognisedEventArgs e)
        {
            string text = "State: Swipe Detected of type" + e.DetectedGesture;
            System.Windows.Threading.Dispatcher pdDispatcher = lblState.Dispatcher;
            //create a new delegate for updating our progress text
            UpdateStatusTextDelegate update = new UpdateStatusTextDelegate(UpdateStatusText);
            //invoke the dispatcher and pass the percentage and max record count
            pdDispatcher.BeginInvoke(update, text);

            tabDispatcher = tabControl1.Dispatcher;
            UpdateTabControlDelegate updateTab = new UpdateTabControlDelegate(UpdateTabControl);
            tabDispatcher.BeginInvoke(updateTab, e.DetectedGesture);
        }
Exemplo n.º 49
0
        public void Show(IWaitIndicatorAppearance appearance, double left, double top, double width, double height)
        {
            CalledShowThreadId = Thread.CurrentThread.ManagedThreadId;
            CalledShowApartmentState = Thread.CurrentThread.GetApartmentState();
            CalledShowLeft = left;
            CalledShowTop = top;
            CalledShowWidth = width;
            CalledShowHeight = height;
            CalledShow = true;

            DispatcherInstance = new System.Windows.Controls.Control().Dispatcher;
        }
Exemplo n.º 50
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="dispatcher"></param>
 public void SetDispatcher(System.Windows.Threading.Dispatcher dispatcher)
 {
     this.BeginInvoke = action => dispatcher.BeginInvoke(action);
 }
Exemplo n.º 51
0
 public DispatcherWrapper ( System.Windows.Threading.Dispatcher dispatcher )
 {
     Contract.AssertNotNull ( ( ) => dispatcher, dispatcher );
     m_dispatcher = dispatcher;
 }
Exemplo n.º 52
0
 private UIDispatcher(WindowsDispatcher windowsDispatcher)
 {
     this.windowsDispatcher = windowsDispatcher;
 }
Exemplo n.º 53
0
        /// <summary>
        /// Initializes a new instance of <see cref="Dispatcher"/>
        /// </summary>
        /// <param name="systemDispatcher"></param>
		public Dispatcher(System.Windows.Threading.Dispatcher systemDispatcher)
		{
			_systemDispatcher = systemDispatcher;
		}
        public virtual InteractiveCollectionViewModel <object, IConvertible> React(/*string key,*/ string childrenpath, IEnumerable enumerable, IObservable <bool> ischecked, System.Reactive.Concurrency.DispatcherScheduler UI, System.Windows.Threading.Dispatcher dispatcher)
        {
            var sx = ObservableChangeSet.Create <object, IConvertible>(cache =>
            {
                foreach (var val in enumerable)
                {
                    cache.AddOrUpdate(val);
                }
                return(System.Reactive.Disposables.Disposable.Empty);
            }, GetKey);

            var kx = new InteractiveCollectionViewModel <object, IConvertible>(sx, ChildrenPath, ischecked, ExpandSubject.StartWith(Expand).DistinctUntilChanged());

            kx.GetChecked();
            kx.GetSelectedItem(ischecked).Subscribe(_ =>
            {
                Dispatcher.InvokeAsync(() => SelectedItem = _, System.Windows.Threading.DispatcherPriority.Background, default);
            });
            kx.SelectCheckedChildItems(ischecked, childrenpath).Subscribe(_ =>
            {
                Dispatcher.InvokeAsync(() => CheckedItems = _, System.Windows.Threading.DispatcherPriority.Background, default);
            });

            AllCheckedItems = kx.Checked;

            //kx.GetSelected().WithLatestFrom(ischecked,(a,b)=>new { a, b }).Subscribe(_=>
            //{
            //    if (@checked.Contains(_) || _.b==false)
            //    {
            //        this.Dispatcher.InvokeAsync(() => SelectedItem = _.a, System.Windows.Threading.DispatcherPriority.Background, default(System.Threading.CancellationToken));
            //        this.Dispatcher.InvokeAsync(() => CheckedItems = ReflectionHelper.RecursivePropValues(_.a, childrenpath).Cast<object>().Where(a => @checked.Contains(a)).ToList(), System.Windows.Threading.DispatcherPriority.Background, default(System.Threading.CancellationToken));
            //    }
            //});

            //kx.ChildSubject.Where(_=>_.Value.Interaction==Interaction.Select &&((int) _.Value.Value)>0).WithLatestFrom(ischecked, (a, b) => new { a, b }).Subscribe(_ =>
            //{
            //    if (@checked.Contains(_.a.Key) || _.b == false)
            //    {
            //        this.Dispatcher.InvokeAsync(() => SelectedItem = _.a.Key, System.Windows.Threading.DispatcherPriority.Background, default(System.Threading.CancellationToken));
            //        this.Dispatcher.InvokeAsync(() => CheckedItems = ReflectionHelper.RecursivePropValues(_.a.Key, childrenpath).Cast<object>().Where(a => @checked.Contains(a)).ToList(), System.Windows.Threading.DispatcherPriority.Background, default(System.Threading.CancellationToken));
            //    }
            //});

            //kx.ChildSubject.Where(_ => _.Value.Interaction == Interaction.Check).Subscribe(_ =>
            //{
            //    if (!((bool)_.Value.Value))
            //        if (@checked.Contains(_.Key))
            //        {
            //            @checked.Remove(_.Key);
            //            this.Dispatcher.InvokeAsync(() => SelectedItem = null, System.Windows.Threading.DispatcherPriority.Background, default(System.Threading.CancellationToken));
            //            this.Dispatcher.InvokeAsync(() => CheckedItems = null, System.Windows.Threading.DispatcherPriority.Background, default(System.Threading.CancellationToken));
            //        }

            //   else if (((bool)_.Value.Value))
            //            if (@unchecked.Contains(_.Key))
            //            {
            //                @unchecked.Remove(_.Key);
            //                this.Dispatcher.InvokeAsync(() => SelectedItem = _.Key, System.Windows.Threading.DispatcherPriority.Background, default(System.Threading.CancellationToken));
            //                this.Dispatcher.InvokeAsync(() => CheckedItems = ReflectionHelper.RecursivePropValues(_.Key, childrenpath).Cast<object>().Where(a => @checked.Contains(a)).ToList(), System.Windows.Threading.DispatcherPriority.Background, default(System.Threading.CancellationToken));
            //            }

            //});

            //kx.DoubleClicked.Subscribe(_ =>
            //{
            //    this.Dispatcher.InvokeAsync(() => DoubleClickedItem = _, System.Windows.Threading.DispatcherPriority.Background, default(System.Threading.CancellationToken));
            //});

            //SelectedItemSubject.Subscribe(_ =>

            //kx.Deleted.Subscribe(_ =>
            //{
            //    this.Dispatcher.InvokeAsync(() => Deleted = _, System.Windows.Threading.DispatcherPriority.Background, default(System.Threading.CancellationToken));
            //});
            return(kx);
        }
 public static System.Windows.UIElement GetLayoutExceptionElement(System.Windows.Threading.Dispatcher dispatcher)
 {
     return(default(System.Windows.UIElement));
 }
Exemplo n.º 56
0
 public BasicInvoker(TheInvoker invoker, Delegate targetDelegate)
     : this(invoker)
 {
     m_targetDelegate = targetDelegate;
 }
Exemplo n.º 57
0
 public wpfSender(TextBox lStat, System.Windows.Threading.Dispatcher dispatcher)
 {
     dispatcher_ = dispatcher;  // use to send results action to main UI thread
     lStat_ = lStat;
 }
        public EditorNavigationDropdownBar(IVsCodeWindow codeWindow, IVsEditorAdaptersFactoryService editorAdaptersFactory, IEnumerable <IEditorNavigationSource> sources, IBufferGraphFactoryService bufferGraphFactoryService, IJavaEditorNavigationTypeRegistryService editorNavigationTypeRegistryService)
        {
            Contract.Requires <ArgumentNullException>(codeWindow != null, "codeWindow");
            Contract.Requires <ArgumentNullException>(editorAdaptersFactory != null, "editorAdaptersFactory");
            Contract.Requires <ArgumentNullException>(sources != null, "sources");
            Contract.Requires <ArgumentNullException>(bufferGraphFactoryService != null, "bufferGraphFactoryService");
            Contract.Requires <ArgumentNullException>(editorNavigationTypeRegistryService != null, "editorNavigationTypeRegistryService");

            this._codeWindow            = codeWindow;
            this._editorAdaptersFactory = editorAdaptersFactory;
            this._sources = sources;
            this._bufferGraphFactoryService           = bufferGraphFactoryService;
            this._editorNavigationTypeRegistryService = editorNavigationTypeRegistryService;
            this._currentTextView = editorAdaptersFactory.GetWpfTextView(codeWindow.GetLastActiveView());
            this._dispatcher      = this._currentTextView.VisualElement.Dispatcher;
            this._imageList       = new ImageList()
            {
                ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit
            };

            _navigationControls =
                this._sources
                .SelectMany(source => source.GetNavigationTypes())
                .Distinct()
                //.OrderBy(...)
                .Select(type => Tuple.Create(type, new List <IEditorNavigationTarget>()))
                .ToArray();

            _selectedItem = new IEditorNavigationTarget[_navigationControls.Length];

            if (this._navigationControls.Length == 0)
            {
                return;
            }

            IConnectionPointContainer connectionPointContainer = codeWindow as IConnectionPointContainer;

            if (connectionPointContainer != null)
            {
                Guid             textViewEventsGuid = typeof(IVsCodeWindowEvents).GUID;
                IConnectionPoint connectionPoint;
                connectionPointContainer.FindConnectionPoint(ref textViewEventsGuid, out connectionPoint);
                if (connectionPoint != null)
                {
                    connectionPoint.Advise(this, out _codeWindowEventsCookie);
                }
            }

            IVsTextView primaryView = codeWindow.GetPrimaryView();

            if (primaryView != null)
            {
                ((IVsCodeWindowEvents)this).OnNewView(primaryView);
            }

            IVsTextView secondaryView = codeWindow.GetSecondaryView();

            if (secondaryView != null)
            {
                ((IVsCodeWindowEvents)this).OnNewView(secondaryView);
            }

            foreach (var source in this._sources)
            {
                source.NavigationTargetsChanged += WeakEvents.AsWeak(OnNavigationTargetsChanged, eh => source.NavigationTargetsChanged -= eh);
                UpdateNavigationTargets(source);
            }

            _currentTextView.Caret.PositionChanged += OnCaretPositionChanged;
        }
Exemplo n.º 59
0
 protected MainInstH264(System.Windows.Threading.Dispatcher dispatcher)
 {
     m_Dispatcher = dispatcher;
 }
 public DispatcherUI(System.Windows.Threading.Dispatcher ui = null)
 {
     Init(ui);
 }