private void CheckCanExecuteSearchCommands(DisplaySource item) { item.SelectedObservable.Subscribe(obj => { Model.LoadMoreCommand.RaiseCanExecuteChanged(); Model.SearchCommand.RaiseCanExecuteChanged(); }); }
private void SelectFreshData() { var _1 = AllSources as ObservableCollection <SkinGetterModel>; if (_1.IsNotNull()) { //排序 var _2 = from m in _1 orderby m.CardStatus descending, m.CreateTime descending select m; //分页 int t = CurrentPageIndex - 1; var _3 = _2.Skip((t * pagesize)).Take(pagesize); if (DisplaySource.IsNotNull()) { DisplaySource = null; } DisplaySource = new ObservableCollection <SkinGetterModel>(_3); AllPageTotal = (_1.Count() / pagesize) + 1; } }
private void AddTorrentSource(TorrentSource source, ITorrentDataSource dataSource, int startPage, string siteName) { var availableSite = new DisplaySource { Selected = true, SourceName = siteName, Source = source }; foreach (var sourceName in dataSource.GetSources()) { availableSite.SourceStates.Add(new SourceStateUI(sourceName, isAlive: false, selected: false)); } Model.Settings.AvailableSources.Add(availableSite); _torrentSourceDictionary.Add(source, new SourceInformation { DataSource = dataSource ?? throw new ArgumentNullException(nameof(dataSource)), CurrentPage = startPage, StartPage = startPage, LastPage = false });
public ImgViewModel() { IAModel = new ImageAnalyzerModel(); //IAModel.ImageFileName = "../Resources/Ha3.jpg"; //IAModel.NetImage = new BitmapImage(new Uri("C:/Users/JP/documents/visual studio 2012/Projects/WpfApplication2/WpfApplication2/Resources/Ha3.jpg")); dlgviewmodel = new DialogViewModel(); #region Attached a Listener aka callback function ///Register Commands QueryImageCmd = new QueryImage(this.QueryImageAction); StopQueryCmd = new StopQuery(this.StopQueryAction); //listener = new SubscribeAsString(Rimg, IAModel); listener = new SubscribeAsByteStream(DlgViewModel.ImgSrcObject, this); #endregion GPIO = new GenericTestCmd(this.GenericTestAction); string value = WpfApplication2.Properties.Resources.GreyBlackHotBrush.ToString(); mybrush = Application.Current.FindResource(value) as LinearGradientBrush; try { //hard coded console = new DisplaySource(mybrush.GradientStops.Cast <object>().ToList(), this.DisplaySourceOutput); } catch (ResourceReferenceKeyNotFoundException e) { Console.Out.WriteLineAsync("Resource Exception: " + e.Message); } /// Assuming this viewmodel is not being created by a background thread but a UI thread then give it a name Dispatcher.CurrentDispatcher.Thread.Name = "My App UI Thread"; _dispatcher = Dispatcher.CurrentDispatcher; }
public DisplayViewModel(DisplaySource model) { Model = model; Name = model.MonitorInformation.FriendlyName; WorkingArea = model.MonitorInformation.WorkArea; }
public void StartDisplay(Panel panel, IntPtr notifyWindow, DisplaySource dispSource, string filename) { int hr = 0; displaySource = dispSource; if (dispSource == DisplaySource.Clip) { if (filename == String.Empty) { return; } } try { graphBuilder = (IGraphBuilder) new FilterGraph(); // QueryInterface for DirectShow interfaces mediaControl = (IMediaControl)graphBuilder; mediaEventEx = (IMediaEventEx)graphBuilder; mediaSeeking = (IMediaSeeking)graphBuilder; mediaPosition = (IMediaPosition)graphBuilder; // Query for video interfaces, which may not be relevant for audio files videoWindow = graphBuilder as IVideoWindow; basicVideo = graphBuilder as IBasicVideo; // Query for audio interfaces, which may not be relevant for video-only files basicAudio = graphBuilder as IBasicAudio; if (displaySource == DisplaySource.Stream) { /// Find source filter /// string possibleTvTunerName = "Video Capture"; DsDevice[] vidInputDevices = GetVideoInputDevices(); for (int i = 0; i < vidInputDevices.Length; i++) { DsDevice possibleTvTuner = vidInputDevices[i]; // use first device if none defined if (videoInputDevicePath == "") { videoInputDevicePath = possibleTvTuner.DevicePath; } if (possibleTvTuner.DevicePath != videoInputDevicePath) { continue; } try { if (sourceFilter != null) { Marshal.ReleaseComObject(sourceFilter); sourceFilter = null; } //Create the filter for the selected video input device sourceFilter = CreateFilterFromPath(FilterCategory.VideoInputDevice, possibleTvTuner.DevicePath); possibleTvTunerName = possibleTvTuner.Name; videoInputDeviceName = possibleTvTuner.Name; if (sourceFilter == null) { return; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); //System.Diagnostics.Debug.WriteLine(ex.ToString()); } } /////////////////////////////////////////////////////////////////////////////////////////// captureGraphBuilder = (ICaptureGraphBuilder2) new CaptureGraphBuilder2(); // Attach the filter graph to the capture graph hr = captureGraphBuilder.SetFiltergraph(graphBuilder); DsError.ThrowExceptionForHR(hr); // Add Capture filter to our graph. hr = graphBuilder.AddFilter(sourceFilter, possibleTvTunerName /*"Video Capture"*/); DsError.ThrowExceptionForHR(hr); //// Init tuner/crossbar ////////////////////////////////////////////////////////////////// object o; tuner = null; crossbar = null; hr = captureGraphBuilder.FindInterface(FindDirection.UpstreamOnly, null, sourceFilter, typeof(IAMTVTuner).GUID, out o); //DsError.ThrowExceptionForHR(hr); if (hr >= 0) { tuner = (IAMTVTuner)o; o = null; hr = captureGraphBuilder.FindInterface(null, null, sourceFilter, typeof(IAMCrossbar).GUID, out o); DsError.ThrowExceptionForHR(hr); if (hr >= 0) { crossbar = (IAMCrossbar)o; //crossbar = (IBaseFilter)o; o = null; } usingCrossBar = true; } else { usingCrossBar = false; } /////////////////////////////////////////////////////////////////////////////////////////// // Render the preview pin on the video capture filter // Use this instead of this.graphBuilder.RenderFile hr = captureGraphBuilder.RenderStream(PinCategory.Preview, DirectShowLib.MediaType.Video, sourceFilter, null, null); DsError.ThrowExceptionForHR(hr); // If we are using tv tuner, force audio on..and set device input from tuner if (tuner != null) { if (videoInputDeviceSource == PhysicalConnectorType.Video_Tuner) { ChangeVideoInputSource(PhysicalConnectorType.Video_Tuner); ChangeAudioInputSource(PhysicalConnectorType.Audio_Tuner); } } // Now that the filter has been added to the graph and we have // rendered its stream, we can release this reference to the filter. // temp //Marshal.ReleaseComObject(sourceFilter); isAudioOnly = false; } else { // Have the graph builder construct its the appropriate graph automatically hr = graphBuilder.RenderFile(filename, null); DsError.ThrowExceptionForHR(hr); // Is this an audio-only file (no video component)? CheckVisibility(); } if (!isAudioOnly) { RenderToPanel(panel, notifyWindow); GetFrameStepInterface(); } else { /// Initialize the default player size and enable playback menu items /// <jefri> hr = InitPlayerWindow(); /// <jefri> DsError.ThrowExceptionForHR(hr); /// <jefri> EnablePlaybackMenu(true, MediaType.Audio); } currentPlaybackRate = 1.0; #if DEBUG rot = new DsROTEntry(this.graphBuilder); #endif // Run the graph to play the media hr = mediaControl.Run(); DsError.ThrowExceptionForHR(hr); currentState = PlayState.Running; // Every call to this method,volume level will be 0, // so inform client to adjust volume level // Raise event, so our client can take action for it if (PlayerStarted != null) { PlayerStarted(new EventArgs()); } } catch (COMException ce) { NotifyEventArgs args = new NotifyEventArgs(); args.Summary = "DirectShow Exception"; args.Source = ce.Source; args.Message = ce.Message; args.Exception = ce; OnNotifyError(args); } catch { NotifyEventArgs args = new NotifyEventArgs(); args.Summary = "DirectShow Exception"; args.Source = ""; args.Message = "An unrecoverable error has occurred."; args.Exception = null; OnNotifyError(args); } }
public bool Equals(DestinyInventoryItemDefinition input) { if (input == null) { return(false); } return (( DisplayProperties == input.DisplayProperties || (DisplayProperties != null && DisplayProperties.Equals(input.DisplayProperties)) ) && ( TooltipNotifications == input.TooltipNotifications || (TooltipNotifications != null && TooltipNotifications.SequenceEqual(input.TooltipNotifications)) ) && ( CollectibleHash == input.CollectibleHash || (CollectibleHash.Equals(input.CollectibleHash)) ) && ( IconWatermark == input.IconWatermark || (IconWatermark != null && IconWatermark.Equals(input.IconWatermark)) ) && ( IconWatermarkShelved == input.IconWatermarkShelved || (IconWatermarkShelved != null && IconWatermarkShelved.Equals(input.IconWatermarkShelved)) ) && ( SecondaryIcon == input.SecondaryIcon || (SecondaryIcon != null && SecondaryIcon.Equals(input.SecondaryIcon)) ) && ( SecondaryOverlay == input.SecondaryOverlay || (SecondaryOverlay != null && SecondaryOverlay.Equals(input.SecondaryOverlay)) ) && ( SecondarySpecial == input.SecondarySpecial || (SecondarySpecial != null && SecondarySpecial.Equals(input.SecondarySpecial)) ) && ( BackgroundColor == input.BackgroundColor || (BackgroundColor != null && BackgroundColor.Equals(input.BackgroundColor)) ) && ( Screenshot == input.Screenshot || (Screenshot != null && Screenshot.Equals(input.Screenshot)) ) && ( ItemTypeDisplayName == input.ItemTypeDisplayName || (ItemTypeDisplayName != null && ItemTypeDisplayName.Equals(input.ItemTypeDisplayName)) ) && ( FlavorText == input.FlavorText || (FlavorText != null && FlavorText.Equals(input.FlavorText)) ) && ( UiItemDisplayStyle == input.UiItemDisplayStyle || (UiItemDisplayStyle != null && UiItemDisplayStyle.Equals(input.UiItemDisplayStyle)) ) && ( ItemTypeAndTierDisplayName == input.ItemTypeAndTierDisplayName || (ItemTypeAndTierDisplayName != null && ItemTypeAndTierDisplayName.Equals(input.ItemTypeAndTierDisplayName)) ) && ( DisplaySource == input.DisplaySource || (DisplaySource != null && DisplaySource.Equals(input.DisplaySource)) ) && ( TooltipStyle == input.TooltipStyle || (TooltipStyle != null && TooltipStyle.Equals(input.TooltipStyle)) ) && ( Action == input.Action || (Action != null && Action.Equals(input.Action)) ) && ( Inventory == input.Inventory || (Inventory != null && Inventory.Equals(input.Inventory)) ) && ( SetData == input.SetData || (SetData != null && SetData.Equals(input.SetData)) ) && ( Stats == input.Stats || (Stats != null && Stats.Equals(input.Stats)) ) && ( EmblemObjectiveHash == input.EmblemObjectiveHash || (EmblemObjectiveHash.Equals(input.EmblemObjectiveHash)) ) && ( EquippingBlock == input.EquippingBlock || (EquippingBlock != null && EquippingBlock.Equals(input.EquippingBlock)) ) && ( TranslationBlock == input.TranslationBlock || (TranslationBlock != null && TranslationBlock.Equals(input.TranslationBlock)) ) && ( Preview == input.Preview || (Preview != null && Preview.Equals(input.Preview)) ) && ( Quality == input.Quality || (Quality != null && Quality.Equals(input.Quality)) ) && ( Value == input.Value || (Value != null && Value.Equals(input.Value)) ) && ( SourceData == input.SourceData || (SourceData != null && SourceData.Equals(input.SourceData)) ) && ( Objectives == input.Objectives || (Objectives != null && Objectives.Equals(input.Objectives)) ) && ( Metrics == input.Metrics || (Metrics != null && Metrics.Equals(input.Metrics)) ) && ( Plug == input.Plug || (Plug != null && Plug.Equals(input.Plug)) ) && ( Gearset == input.Gearset || (Gearset != null && Gearset.Equals(input.Gearset)) ) && ( Sack == input.Sack || (Sack != null && Sack.Equals(input.Sack)) ) && ( Sockets == input.Sockets || (Sockets != null && Sockets.Equals(input.Sockets)) ) && ( Summary == input.Summary || (Summary != null && Summary.Equals(input.Summary)) ) && ( TalentGrid == input.TalentGrid || (TalentGrid != null && TalentGrid.Equals(input.TalentGrid)) ) && ( InvestmentStats == input.InvestmentStats || (InvestmentStats != null && InvestmentStats.SequenceEqual(input.InvestmentStats)) ) && ( Perks == input.Perks || (Perks != null && Perks.SequenceEqual(input.Perks)) ) && ( LoreHash == input.LoreHash || (LoreHash.Equals(input.LoreHash)) ) && ( SummaryItemHash == input.SummaryItemHash || (SummaryItemHash.Equals(input.SummaryItemHash)) ) && ( Animations == input.Animations || (Animations != null && Animations.SequenceEqual(input.Animations)) ) && ( AllowActions == input.AllowActions || (AllowActions != null && AllowActions.Equals(input.AllowActions)) ) && ( Links == input.Links || (Links != null && Links.SequenceEqual(input.Links)) ) && ( DoesPostmasterPullHaveSideEffects == input.DoesPostmasterPullHaveSideEffects || (DoesPostmasterPullHaveSideEffects != null && DoesPostmasterPullHaveSideEffects.Equals(input.DoesPostmasterPullHaveSideEffects)) ) && ( NonTransferrable == input.NonTransferrable || (NonTransferrable != null && NonTransferrable.Equals(input.NonTransferrable)) ) && ( ItemCategoryHashes == input.ItemCategoryHashes || (ItemCategoryHashes != null && ItemCategoryHashes.SequenceEqual(input.ItemCategoryHashes)) ) && ( SpecialItemType == input.SpecialItemType || (SpecialItemType != null && SpecialItemType.Equals(input.SpecialItemType)) ) && ( ItemType == input.ItemType || (ItemType != null && ItemType.Equals(input.ItemType)) ) && ( ItemSubType == input.ItemSubType || (ItemSubType != null && ItemSubType.Equals(input.ItemSubType)) ) && ( ClassType == input.ClassType || (ClassType != null && ClassType.Equals(input.ClassType)) ) && ( BreakerType == input.BreakerType || (BreakerType != null && BreakerType.Equals(input.BreakerType)) ) && ( BreakerTypeHash == input.BreakerTypeHash || (BreakerTypeHash.Equals(input.BreakerTypeHash)) ) && ( Equippable == input.Equippable || (Equippable != null && Equippable.Equals(input.Equippable)) ) && ( DamageTypeHashes == input.DamageTypeHashes || (DamageTypeHashes != null && DamageTypeHashes.SequenceEqual(input.DamageTypeHashes)) ) && ( DamageTypes == input.DamageTypes || (DamageTypes != null && DamageTypes.SequenceEqual(input.DamageTypes)) ) && ( DefaultDamageType == input.DefaultDamageType || (DefaultDamageType != null && DefaultDamageType.Equals(input.DefaultDamageType)) ) && ( DefaultDamageTypeHash == input.DefaultDamageTypeHash || (DefaultDamageTypeHash.Equals(input.DefaultDamageTypeHash)) ) && ( SeasonHash == input.SeasonHash || (SeasonHash.Equals(input.SeasonHash)) ) && ( IsWrapper == input.IsWrapper || (IsWrapper != null && IsWrapper.Equals(input.IsWrapper)) ) && ( TraitIds == input.TraitIds || (TraitIds != null && TraitIds.SequenceEqual(input.TraitIds)) ) && ( TraitHashes == input.TraitHashes || (TraitHashes != null && TraitHashes.SequenceEqual(input.TraitHashes)) ) && ( Hash == input.Hash || (Hash.Equals(input.Hash)) ) && ( Index == input.Index || (Index.Equals(input.Index)) ) && ( Redacted == input.Redacted || (Redacted != null && Redacted.Equals(input.Redacted)) )); }