public SpecialFolderButton(Environment.SpecialFolder sf) : base(GetDisplayName(sf)) { _sf = sf; if (string.IsNullOrEmpty(Path)) { throw new ArgumentException(); } base.Name = GetDisplayName(sf); base.ImageAlign = System.Drawing.ContentAlignment.TopCenter; base.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.SizeToFit; base.ImageTransparentColor = System.Drawing.Color.Magenta; base.AutoSize = true; base.Tag = _sf; base.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText; base.Image = ImageProvider.GetIcon(Path, true); }
/// <summary> /// Assigns an image provider for the specified item. /// </summary> /// <param name="item">Associated toolstrip item.</param> /// <param name="provider">Image provider.</param> /// <returns>Returns true when successful.</returns> public bool AssignImage(ToolStripItem item, ISEToolStripImageProvider provider) { if (item == null || provider == null) { throw new ArgumentException("One or more arguments were null references."); } if (ContainsImage(item)) { return(false); } ImageProvider.Add(item, provider); HasImagesChanged = true; if (!IsUpdatingImages) { RefreshItemImages(); } return(true); }
public Image _image( ImageProvider image = null, ImageErrorWidgetBuilder errorBuilder = null, ImageFrameBuilder frameBuilder = null ) { D.assert(image != null); return(new Image( image: image, errorBuilder: errorBuilder, frameBuilder: frameBuilder, width: width, height: height, fit: fit, alignment: alignment, repeat: repeat, matchTextDirection: matchTextDirection, gaplessPlayback: true )); }
public void Init() { _repository = new UserRepository(); _userIdentityRepository = new UserIdentityRepository(); _missionRepository = new MissionRepository(); _ratingRepository = new RatingRepository(); var imageProvider = new ImageProvider(); _imageService = new ImageService(imageProvider, _repository); _ratingService = new RatingService(_repository, _ratingRepository, true); _service = new UserService(_repository, _missionRepository, _ratingRepository, _appCountersService); _userIdentityService = new UserIdentityService(_userIdentityRepository); var principal = new ClaimsPrincipal(); principal.AddIdentity(new ClaimsIdentity(new[] { new Claim(ClaimTypes.Sid, "User1Id") })); _controller = new UserController(_service, _imageService, _ratingService, _userIdentityService) { User = principal }; }
private void pbPicture_DoubleClick(object sender, EventArgs e) { if (lvPictures.SelectedItems.Count > 0) { PictureInfo pi = lvPictures.SelectedItems[0].Tag as PictureInfo; if (pi != null) { OPMOpenFileDialog dlg = new OPMOpenFileDialog(); dlg.Filter = "All image files|*.bmp;*.jpg;*.jpeg;*.jpe;*.jfif;*.gif;*.tif;*.tiff;*.png;*.ico;||"; if (dlg.ShowDialog() == DialogResult.OK) { Image img = null; try { img = Image.FromFile(dlg.FileName); } catch { img = null; } if (img != null) { Bitmap bmp = new Bitmap(ImageProvider.ScaleImage(img, new Size(200, 200 * img.Size.Height / img.Size.Width), false)); pi.Picture = bmp; pi.MimeType = "image/" + PathUtils.GetExtension(dlg.FileName); pbPicture.Image = pi.Picture; pbPicture.SizeMode = PictureBoxSizeMode.Zoom; lvPictures.SelectedItems[0].SubItems[colImage.Index].Tag = new ExtendedSubItemDetail(pi.Picture, ""); } } } } }
public Switch( Key key = null, bool?value = null, ValueChanged <bool?> onChanged = null, Color activeColor = null, Color activeTrackColor = null, Color inactiveThumbColor = null, Color inactiveTrackColor = null, ImageProvider activeThumbImage = null, ImageErrorListener onActiveThumbImageError = null, ImageProvider inactiveThumbImage = null, ImageErrorListener onInactiveThumbImageError = null, MaterialTapTargetSize?materialTapTargetSize = null, DragStartBehavior dragStartBehavior = DragStartBehavior.start, Color focusColor = null, Color hoverColor = null, FocusNode focusNode = null, bool autofocus = false ) : this( key : key, value : value, onChanged : onChanged, activeColor : activeColor, activeTrackColor : activeTrackColor, inactiveThumbColor : inactiveThumbColor, inactiveTrackColor : inactiveTrackColor, activeThumbImage : activeThumbImage, onActiveThumbImageError : onActiveThumbImageError, inactiveThumbImage : inactiveThumbImage, onInactiveThumbImageError : onInactiveThumbImageError, materialTapTargetSize : materialTapTargetSize, switchType : _SwitchType.material, dragStartBehavior : dragStartBehavior, focusColor : focusColor, hoverColor : hoverColor, focusNode : focusNode, autofocus : autofocus ) { }
public FadeInImage( ImageProvider placeholder, ImageErrorWidgetBuilder placeholderErrorBuilder, ImageProvider image, ImageErrorWidgetBuilder imageErrorBuilder = null, TimeSpan?fadeOutDuration = null, Curve fadeOutCurve = null, TimeSpan?fadeInDuration = null, Curve fadeInCurve = null, float?width = null, float?height = null, BoxFit?fit = null, AlignmentGeometry alignment = null, ImageRepeat repeat = ImageRepeat.noRepeat, Key key = null, bool matchTextDirection = false ) : base(key) { D.assert(image != null); D.assert(fadeOutDuration != null); D.assert(fadeOutCurve != null); D.assert(fadeInDuration != null); D.assert(fadeInCurve != null); D.assert(alignment != null); this.placeholder = placeholder; this.placeholderErrorBuilder = placeholderErrorBuilder; this.image = image; this.imageErrorBuilder = imageErrorBuilder; this.width = width; this.height = height; this.fit = fit; this.fadeOutDuration = fadeOutDuration ?? TimeSpan.FromMilliseconds(300); this.fadeOutCurve = fadeOutCurve ?? Curves.easeOut; this.fadeInDuration = fadeInDuration ?? TimeSpan.FromMilliseconds(700); this.fadeInCurve = fadeInCurve ?? Curves.easeIn; this.alignment = alignment ?? Alignment.center; this.repeat = repeat; this.matchTextDirection = matchTextDirection; }
public async Task <IEnumerable <RemoteImageInfo> > GetImages(int[] siteNum, string[] sceneID, BaseItem item, CancellationToken cancellationToken) { var result = new List <RemoteImageInfo>(); if (sceneID == null) { return(result); } var provider = new ImageProvider(); var info = new Movie(); info.ProviderIds[Plugin.Instance.Name] = string.Join("#", sceneID); #if __EMBY__ result = (await provider.GetImages(info, new LibraryOptions(), cancellationToken).ConfigureAwait(false)).ToList(); #else result = (await provider.GetImages(info, cancellationToken).ConfigureAwait(false)).ToList(); #endif return(result); }
public SwitchListTile( Key key = null, bool?value = null, ValueChanged <bool?> onChanged = null, Color activeColor = null, Color activeTrackColor = null, Color inactiveThumbColor = null, Color inactiveTrackColor = null, ImageProvider activeThumbImage = null, ImageProvider inactiveThumbImage = null, Widget title = null, Widget subtitle = null, bool isThreeLine = false, bool?dense = null, EdgeInsetsGeometry contentPadding = null, Widget secondary = null, bool selected = false, _SwitchListTileType _switchListTileType = _SwitchListTileType.material ) : base(key: key) { D.assert(value != null); D.assert(!isThreeLine || subtitle != null); this.value = value.Value; this.onChanged = onChanged; this.activeColor = activeColor; this.activeTrackColor = activeTrackColor; this.inactiveThumbColor = inactiveThumbColor; this.inactiveTrackColor = inactiveTrackColor; this.activeThumbImage = activeThumbImage; this.inactiveThumbImage = inactiveThumbImage; this.title = title; this.subtitle = subtitle; this.isThreeLine = isThreeLine; this.dense = dense; this.contentPadding = contentPadding; this.secondary = secondary; this.selected = selected; this._switchListTileType = _switchListTileType; }
public IPromise precacheImage( ImageProvider provider, BuildContext context, Size size = null, ImageErrorListener onError = null ) { ImageConfiguration config = createLocalImageConfiguration(context, size: size); var completer = new Promise(); ImageStream stream = provider.resolve(config); void listener(ImageInfo image, bool sync) { completer.Resolve(); stream.removeListener(listener); } void errorListener(Exception exception) { completer.Resolve(); stream.removeListener(listener); if (onError != null) { onError(exception); } else { UIWidgetsError.reportError(new UIWidgetsErrorDetails( context: "image failed to precache", library: "image resource service", exception: exception, silent: true )); } } stream.addListener(listener, onError: errorListener); return(completer); }
public static ImageProvider _createImageProvider(AvatarImageType imageType, string _imagePath) { ImageProvider tmp_ImageProvider = null; switch (imageType) { case AvatarImageType.NetWork: tmp_ImageProvider = new NetworkImage(_imagePath); break; case AvatarImageType.Asset: tmp_ImageProvider = new AssetImage(_imagePath); break; case AvatarImageType.Memory: byte[] bytes = File.ReadAllBytes(_imagePath); tmp_ImageProvider = new MemoryImage(bytes: bytes); break; } return(tmp_ImageProvider); }
public static Future precacheImage( ImageProvider provider, BuildContext context, Size size = null, ImageErrorListener onError = null ) { var config = createLocalImageConfiguration(context: context, size: size); var completer = Completer.create(); var stream = provider.resolve(configuration: config); ImageStreamListener listener = null; listener = new ImageStreamListener( (image, sync) => { if (!completer.isCompleted) { completer.complete(); } SchedulerBinding.instance.addPostFrameCallback(timeStamp => { stream.removeListener(listener: listener); }); }, onError: error => { if (!completer.isCompleted) { completer.complete(); } stream.removeListener(listener: listener); UIWidgetsError.reportError(new UIWidgetsErrorDetails( context: new ErrorDescription("image failed to precache"), library: "image resource service", silent: true)); } ); stream.addListener(listener: listener); return(completer.future); }
public void ValidateDatabaseInput() { using (ImageProvider i = new ImageProvider()) { var stream = i.ImageStream().GetEnumerator(); stream.MoveNext(); Assert.That(stream.Current.Label, Is.EqualTo(5)); stream.MoveNext(); Assert.That(stream.Current.Label, Is.EqualTo(0)); stream.MoveNext(); Assert.That(stream.Current.Label, Is.EqualTo(4)); stream.MoveNext(); Assert.That(stream.Current.Label, Is.EqualTo(1)); stream.MoveNext(); Assert.That(stream.Current.Label, Is.EqualTo(9)); } }
public static SwitchListTile adaptive( Key key = null, bool?value = null, ValueChanged <bool?> onChanged = null, Color activeColor = null, Color activeTrackColor = null, Color inactiveThumbColor = null, Color inactiveTrackColor = null, ImageProvider activeThumbImage = null, ImageProvider inactiveThumbImage = null, Widget title = null, Widget subtitle = null, bool isThreeLine = false, bool?dense = null, EdgeInsets contentPadding = null, Widget secondary = null, bool selected = false) { return(new SwitchListTile( key: key, value: value, onChanged: onChanged, activeColor: activeColor, activeTrackColor: activeTrackColor, inactiveThumbColor: inactiveThumbColor, inactiveTrackColor: inactiveTrackColor, activeThumbImage: activeThumbImage, inactiveThumbImage: inactiveThumbImage, title: title, subtitle: subtitle, isThreeLine: isThreeLine, dense: dense, contentPadding: contentPadding, secondary: secondary, selected: selected, _switchListTileType: _SwitchListTileType.adaptive )); }
public static Ink image( Key key = null, EdgeInsetsGeometry padding = null, ImageProvider image = null, ImageErrorListener onImageError = null, ColorFilter colorFilter = null, BoxFit?fit = null, AlignmentGeometry alignment = null, Rect centerSlice = null, ImageRepeat repeat = ImageRepeat.noRepeat, float?width = null, float?height = null, Widget child = null ) { D.assert(padding == null || padding.isNonNegative); D.assert(image != null); alignment = alignment ?? Alignment.center; Decoration decoration = new BoxDecoration( image: new DecorationImage( image: image, onError: onImageError, colorFilter: colorFilter, fit: fit, alignment: alignment, centerSlice: centerSlice, repeat: repeat) ); return(new Ink( key: key, padding: padding, decoration: decoration, width: width, height: height, child: child)); }
public Task AddImage(ImageProvider image) { if (image == null) { return(TaskExtensions.CompletedTask); } var onlineImage = image as OnlineImage; if (onlineImage != null) { return(AddImage(onlineImage)); } var tagImage = image as TagImage; if (tagImage != null) { return(AddImage(tagImage)); } throw new ArgumentException(nameof(image)); }
public CircleAvatar( Key key = null, Widget child = null, Color backgroundColor = null, ImageProvider backgroundImage = null, ImageErrorListener onBackgroundImageError = null, Color foregroundColor = null, float?radius = null, float?minRadius = null, float?maxRadius = null ) : base(key: key) { D.assert(radius == null || (minRadius == null && maxRadius == null)); D.assert(backgroundImage != null || onBackgroundImageError == null); this.child = child; this.backgroundColor = backgroundColor; this.backgroundImage = backgroundImage; this.onBackgroundImageError = onBackgroundImageError; this.foregroundColor = foregroundColor; this.radius = radius; this.minRadius = minRadius; this.maxRadius = maxRadius; }
/// <summary> /// Initializes the system image list. /// </summary> private void InitImageList() { // setup the image list to hold the folder icons OPMShellTreeViewImageList = new System.Windows.Forms.ImageList(); OPMShellTreeViewImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit; OPMShellTreeViewImageList.ImageSize = new System.Drawing.Size(16, 16); OPMShellTreeViewImageList.TransparentColor = System.Drawing.Color.Gainsboro; // add the Desktop icon to the image list try { OPMShellTreeViewImageList.Images.Add(ImageProvider.GetDesktopIcon(false)); } catch { // Create a blank icon if the desktop icon fails for some reason Bitmap bmp = new Bitmap(16, 16); Image img = (Image)bmp; OPMShellTreeViewImageList.Images.Add((Image)img.Clone()); bmp.Dispose(); } this.ImageList = OPMShellTreeViewImageList; }
public void InitializeImageProvider() { try { if (!this.isInitImageProvider) { this.imageProvider = new ImageProvider(); //this.imageProvider.GrabErrorEvent += new ImageProvider.GrabErrorEventHandler(this.OnGrabErrorEventCallback); //this.imageProvider.DeviceRemovedEvent += new ImageProvider.DeviceRemovedEventHandler(this.OnDeviceRemovedEventCallback); //this.imageProvider.DeviceOpenedEvent += new ImageProvider.DeviceOpenedEventHandler(this.OnDeviceOpenedEventCallback); //this.imageProvider.DeviceClosedEvent += new ImageProvider.DeviceClosedEventHandler(this.OnDeviceClosedEventCallback); //this.imageProvider.GrabbingStartedEvent += new ImageProvider.GrabbingStartedEventHandler(this.OnGrabbingStartedEventCallback); //this.imageProvider.ImageReadyEvent += new ImageProvider.ImageReadyEventHandler(this.OnImageReadyEventCallback); //this.imageProvider.GrabbingStoppedEvent += new ImageProvider.GrabbingStoppedEventHandler(this.OnGrabbingStoppedEventCallback); this.isInitImageProvider = true; } } catch (Exception ex) { Pylon.Terminate(); throw ex; } }
/* Load a string node. */ private void LoadStringNode(string nodeName) { var nodeConf = Config.GetConfig(nodeName); if (nodeConf == null || string.IsNullOrWhiteSpace(nodeConf)) { return; } var node = ImageProvider.GetNodeFromDevice(nodeName); if (node.IsValid) { if (GenApi.NodeIsWritable(node)) { GenApi.NodeFromString(node, nodeConf); } } }
public Image( Key key = null, ImageProvider image = null, ImageFrameBuilder frameBuilder = null, ImageLoadingBuilder loadingBuilder = null, ImageErrorWidgetBuilder errorBuilder = null, float?width = null, float?height = null, Color color = null, BlendMode colorBlendMode = BlendMode.srcIn, BoxFit?fit = null, AlignmentGeometry alignment = null, ImageRepeat repeat = ImageRepeat.noRepeat, Rect centerSlice = null, bool matchTextDirection = false, bool gaplessPlayback = false, FilterQuality filterQuality = FilterQuality.low ) : base(key: key) { D.assert(image != null); this.image = image; this.frameBuilder = frameBuilder; this.loadingBuilder = loadingBuilder; this.errorBuilder = errorBuilder; this.width = width; this.height = height; this.color = color; this.colorBlendMode = colorBlendMode; this.fit = fit; this.alignment = alignment ?? Alignment.center; this.repeat = repeat; this.centerSlice = centerSlice; this.gaplessPlayback = gaplessPlayback; this.filterQuality = filterQuality; this.matchTextDirection = matchTextDirection; }
public void resolve(ImageProvider provider) { ImageStream oldImageStream = this._imageStream; Size size; if (this.widget.width != null && this.widget.height != null) { size = new Size((float)this.widget.width, (float)this.widget.height); } else { size = null; } this._imageStream = provider.resolve(ImageUtils.createLocalImageConfiguration(context: this.state.context, size: size)); D.assert(this._imageStream != null); if (this._imageStream.key != oldImageStream?.key) { oldImageStream?.removeListener(listener: this._handleImageChanged); this._imageStream.addListener(listener: this._handleImageChanged); } }
public Image GetImage(bool large) { Image img = null; if (mi != null) { if (mi.IsDVDVolume) { img = ImageProvider.GetShell32Icon(Shell32Icon.DvdDisk, large); } else { switch (mi.MediaType.ToUpperInvariant()) { case "URL": img = ImageProvider.GetShell32Icon(Shell32Icon.URL, large); break; case "CDA": img = ImageProvider.GetShell32Icon(Shell32Icon.CompactDisk, large); break; default: img = ImageProvider.GetIcon(mi.Path, large); break; } } } if (img == null) { img = ImageProvider.GetShell32Icon(Shell32Icon.BlankFile, large); } return(img); }
private async void Initialize() { this.BackColor = Color.FromArgb(124, 129, 125); rtbItemInfo.Location = new Point(cmbSelectedResult.Location.X, cmbSelectedResult.Location.Y + cmbSelectedResult.Height + 5); rtbItemInfo.Width = cmbSelectedResult.Width; pbxItemImage.Location = new Point(cmbSelectedResult.Location.X, cmbSelectedResult.Location.Y + cmbSelectedResult.Height + 5); pbxItemImage.Visible = false; lblWaitMessage.drawBorder(3, Color.DarkBlue); lblWaitMessage.Font = new System.Drawing.Font("Arial", 20, System.Drawing.FontStyle.Bold); lblWaitMessage.TextAlign = ContentAlignment.MiddleCenter; lblWaitMessage.Padding = new Padding(5); lblWaitMessage.Text = "Please Wait"; pnlControlsHolder.Visible = false; Control[] controlsToChangeSize = new Control[] { lblWaitMessage, rtbItemInfo, cmbSelectedResult }; _sizeChanger = new SizeChanger(this.Width, this.Height, controlsToChangeSize); var dimentions = _sizeChanger.ControlsForChangingSizeDimentions; this.MaximumSize = new Size(_sizeChanger.MainFormInitialWidth, _sizeChanger.MainFormInitialHeight); this.SizeChanged += (object sender, EventArgs e) => { _sizeChanger.Resize(this.Width, this.Height, out int resizeFacrorX, out int resizefactorY); lblWaitMessage.Width = dimentions[0][0] + resizeFacrorX; lblWaitMessage.drawBorder(3, Color.DarkBlue); cmbSelectedResult.Width = dimentions[2][0] + resizeFacrorX; rtbItemInfo.Width = dimentions[1][0] + resizeFacrorX; rtbItemInfo.Height = dimentions[1][1] + resizefactorY; }; Task tsk = _dao.SetConnectionStringAsync("The_very_important_Flight_Center_Project"); _converterToData = new TypeToDataConverter(_dao); Timer timer = new Timer(); timer.Interval = 10; int count = 0; timer.Tick += (object sender, EventArgs e) => { count++; lblWaitMessage.Text = $"Please Wait, -= {count} =-"; if (tsk.IsCompleted) { timer.Stop(); pnlControlsHolder.Visible = true; lblWaitMessage.Text = $"-= {count} =-"; } }; timer.Start(); await tsk; cmbTableNames.Items.AddRange(_dao.GetAllTableNames().ToArray()); pnlControlsHolder.Visible = true; cmbTableNames.SelectedIndexChanged += (object sender, EventArgs e) => { rtbItemInfo.Text = string.Empty; pbxItemImage.Visible = false; rtbItemInfo.Width = cmbSelectedResult.Width; rtbItemInfo.Location = new Point(cmbSelectedResult.Location.X, cmbSelectedResult.Location.Y + cmbSelectedResult.Height + 5); cmbSelectedResult.Text = string.Empty; cmbSelectedResult.Items.Clear(); }; btnGetAll.Click += async(object sender, EventArgs e) => { Timer locTimer = new Timer(); locTimer.Interval = 100; locTimer.Tick += (object currentSender, EventArgs ea) => { rtbItemInfo.Text += "* "; }; locTimer.Start(); cmbSelectedResult.Items.Clear(); btnGetAll.Enabled = false; cmbTableNames.Enabled = false; cmbSelectedResult.Enabled = false; if (cmbTableNames.SelectedItem == null) { SwitchDefaultFalling(locTimer); MessageBox.Show("Please select the type from the dropdown on the right"); return; } Assembly asm = this.GetType().Assembly; Type type = asm.GetType($"AirlineManagementSystemDatabasesAssistant.{((string)cmbTableNames.SelectedItem).SingularizeTableName()}"); if (type == null) { SwitchDefaultFalling(locTimer); MessageBox.Show("This table isn't related to the project"); return; } MethodInfo methodInfo = typeof(DAO).GetMethod(nameof(_dao.GetAll)); MethodInfo genericMethod = methodInfo.MakeGenericMethod(type); dynamic task = genericMethod.Invoke(_dao, null); var genericIEnumerable = await task; foreach (var s in genericIEnumerable as IEnumerable) { switch (s.GetType().Name) { case "AirlineCompany": var airlineData = await _converterToData.ConversionSelector(s as AirlineCompany, type) as AirlineCompanyData; cmbSelectedResult.Items.Add(airlineData); break; case "Country": var countryData = await _converterToData.ConversionSelector(s as Country, type) as CountryData; cmbSelectedResult.Items.Add(countryData); break; case "Customer": var customerData = await _converterToData.ConversionSelector(s as Customer, type) as CustomerData; cmbSelectedResult.Items.Add(customerData); break; case "Administrator": var adminData = await _converterToData.ConversionSelector(s as Administrator, type) as AdministratorData; cmbSelectedResult.Items.Add(adminData); break; case "Utility_class_User": string userKind = s.GetType().GetProperty("USER_KIND").GetValue(s) as string; switch (userKind) { case "Customer": var customerAsUserData = await _converterToData.ConversionSelector(s as Utility_class_User, type) as Utility_class_UserCustomerData; cmbSelectedResult.Items.Add(customerAsUserData); break; case "AirlineCompany": var airlineAsUserData = await _converterToData.ConversionSelector(s as Utility_class_User, type) as Utility_class_UserAirlineCompanyData; cmbSelectedResult.Items.Add(airlineAsUserData); break; case "Administrator": var adminAsUserData = await _converterToData.ConversionSelector(s as Utility_class_User, type) as Utility_class_UserAdministratorData; cmbSelectedResult.Items.Add(adminAsUserData); break; } break; default: SwitchDefaultFalling(locTimer); MessageBox.Show($"You currently can't retrive {s.GetType().Name.PluraliseNoun()}"); return; } } SwitchDefaultFalling(locTimer); cmbSelectedResult.Text = "Ready!"; }; cmbSelectedResult.SelectedIndexChanged += (object sender, EventArgs e) => { pbxItemImage.Visible = false; rtbItemInfo.Text = string.Empty; Bitmap selectedItemImage = null; if (cmbSelectedResult.SelectedItem.GetType().GetProperty("Image") != null) { selectedItemImage = (Bitmap)cmbSelectedResult.SelectedItem.GetType().GetProperty("Image").GetValue(cmbSelectedResult.SelectedItem); } if (selectedItemImage != null) { int resizeFactor = 256; if (selectedItemImage.Width <= resizeFactor) { pbxItemImage.Width = selectedItemImage.Width; pbxItemImage.Height = selectedItemImage.Height; } else { selectedItemImage = ImageProvider.ResizeImageProportionally(selectedItemImage, resizeFactor); pbxItemImage = Statics.ResizeControlProportionally(pbxItemImage, resizeFactor); } rtbItemInfo.Location = new Point(pbxItemImage.Location.X + pbxItemImage.Width + 5, cmbSelectedResult.Location.Y + cmbSelectedResult.Height + 5); rtbItemInfo.Width = cmbSelectedResult.Width - pbxItemImage.Width - 5; pbxItemImage.Image = selectedItemImage; pbxItemImage.Visible = true; } PropertyInfo[] selectedItemProperties = cmbSelectedResult.SelectedItem.GetType().GetProperties(); int n = selectedItemProperties[0].MetadataToken; Array.Sort(selectedItemProperties, new ComparerByNumericValuedProperty <PropertyInfo>("MetadataToken")); int n2 = selectedItemProperties[0].MetadataToken; for (int i = 0; i < selectedItemProperties.Length; i++) { if (selectedItemProperties[i].PropertyType == typeof(String) && selectedItemProperties[i].GetValue(cmbSelectedResult.SelectedItem) == null) { string selctedItemName = cmbSelectedResult.SelectedItem.GetType().Name; if (cmbSelectedResult.SelectedItem.GetType().Name.Contains("Data")) { selctedItemName = cmbSelectedResult.SelectedItem.GetType().Name.Replace("Data", ""); } selectedItemProperties[i].SetValue(cmbSelectedResult.SelectedItem, $"{selectedItemProperties[i].Name} don't exists or can't be retrived for this {selctedItemName}"); } //.OrderBy(x => x.MetadataToken).ToArray() if (selectedItemProperties[i].PropertyType != typeof(Customer) && selectedItemProperties[i].PropertyType != typeof(Administrator) && selectedItemProperties[i].PropertyType != typeof(AirlineCompany) && (selectedItemProperties[i].GetValue(cmbSelectedResult.SelectedItem) != null)) { if ((!selectedItemProperties[i].GetValue(cmbSelectedResult.SelectedItem).Equals("forInterfaceImplementation")) && (!selectedItemProperties[i].GetValue(cmbSelectedResult.SelectedItem).Equals(-111111L))) { if (selectedItemProperties[i].GetValue(cmbSelectedResult.SelectedItem) is Bitmap) { continue; } rtbItemInfo.Text += $" {selectedItemProperties[i].Name}: {selectedItemProperties[i].GetValue(cmbSelectedResult.SelectedItem)}" + Environment.NewLine; } } } }; rtbItemInfo.MouseDown += (object sender, MouseEventArgs e) => { if (e.Button == MouseButtons.Right) { CopyTextToClipboard(sender as RichTextBox, e); } }; rtbItemInfo.DoubleClick += (object sender, EventArgs e) => { if (!String.IsNullOrEmpty((sender as RichTextBox).SelectedText)) { Clipboard.SetText((sender as RichTextBox).SelectedText); } else { Clipboard.Clear(); } MenuItem mi = new MenuItem(Clipboard.GetText()); MenuItem[] mis = new MenuItem[] { mi }; ContextMenu cm = new ContextMenu(mis); cm.Show((sender as RichTextBox), new Point(0, 0)); }; }
/// <summary> /// Initializes and Opens the Pylon Image Provider to the Camera. /// </summary> /// <param name="maxExposure">Maximum Exposure.</param> public void Initialize(int maxExposure) { log.Info("Initializing camera on Index: " + Index + "..."); log.Info("Creating Buffermanager(" + Index + ")..."); ImageBuffers = new BufferManager(); ImageBuffers.Initialize(); log.Info("Buffermanager (" + Index + ") Created with " + ImageBuffers.ThreadCount + " threads."); log.Info("Initializing Worker threads on Cam(" + Index + ")..."); worker = new JobWorker(this, ImageBuffers); worker.Initialize(); log.Info("Worker Threads(" + Index + ") Created with " + worker.ThreadCount + " threads."); log.Info("Creating Image Providers(" + Index + ")..."); ImageProvider = new ImageProvider(); ImageProvider.ImageReadyAction = OnImageReadyHandler; //ImageProvider.ImageReadyEvent += OnImageReadyHandler; ImageProvider.DeviceRemovedEvent += OnDeviceRemovedHandler; log.Info("Image Provider(" + Index + ") created successfully."); log.Info("Opening the Basler(" + Index + ") device..."); Open(); log.Info("Basler(" + Index + ") is now open!"); /* Config part. */ log.Info("Loading config for '" + Name + "'..."); Config = new ConfigManager(Name); LoadConfigNodes( "Width", "Height", "OffsetX", "OffsetY" ); LoadFloatNodes( "Gain", "ExposureTime", "AutoTargetBrightness" ); LoadStringNode("ExposureAuto"); // Setting max Exposure. var node = ImageProvider.GetNodeFromDevice("AutoExposureTimeUpperLimit"); if (node.IsValid) { if (GenApi.NodeIsWritable(node)) { Pylon.DeviceSetFloatFeature(ImageProvider.m_hDevice, "AutoExposureTimeUpperLimit", maxExposure); } } log.Info("Loaded configurations for the camera '" + Name + "'."); /* Done config part. */ }
public async Task <ItemUpdateType> RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken) { var itemOfType = (TItemType)item; var updateType = ItemUpdateType.None; var requiresRefresh = false; var libraryOptions = LibraryManager.GetLibraryOptions(item); if (!requiresRefresh && libraryOptions.AutomaticRefreshIntervalDays > 0 && (DateTime.UtcNow - item.DateLastRefreshed).TotalDays >= libraryOptions.AutomaticRefreshIntervalDays) { requiresRefresh = true; } if (!requiresRefresh && refreshOptions.MetadataRefreshMode != MetadataRefreshMode.None) { // TODO: If this returns true, should we instead just change metadata refresh mode to Full? requiresRefresh = item.RequiresRefresh(); if (requiresRefresh) { Logger.LogDebug("Refreshing {0} {1} because item.RequiresRefresh() returned true", typeof(TItemType).Name, item.Path ?? item.Name); } } var localImagesFailed = false; var allImageProviders = ((ProviderManager)ProviderManager).GetImageProviders(item, refreshOptions).ToList(); // Start by validating images try { // Always validate images and check for new locally stored ones. if (ImageProvider.ValidateImages(item, allImageProviders.OfType <ILocalImageProvider>(), refreshOptions.DirectoryService)) { updateType |= ItemUpdateType.ImageUpdate; } } catch (Exception ex) { localImagesFailed = true; Logger.LogError(ex, "Error validating images for {0}", item.Path ?? item.Name ?? "Unknown name"); } var metadataResult = new MetadataResult <TItemType> { Item = itemOfType }; bool hasRefreshedMetadata = true; bool hasRefreshedImages = true; var isFirstRefresh = item.DateLastRefreshed == default; // Next run metadata providers if (refreshOptions.MetadataRefreshMode != MetadataRefreshMode.None) { var providers = GetProviders(item, libraryOptions, refreshOptions, isFirstRefresh, requiresRefresh) .ToList(); if (providers.Count > 0 || isFirstRefresh || requiresRefresh) { if (item.BeforeMetadataRefresh(refreshOptions.ReplaceAllMetadata)) { updateType |= ItemUpdateType.MetadataImport; } } if (providers.Count > 0) { var id = itemOfType.GetLookupInfo(); if (refreshOptions.SearchResult != null) { ApplySearchResult(id, refreshOptions.SearchResult); } // await FindIdentities(id, cancellationToken).ConfigureAwait(false); id.IsAutomated = refreshOptions.IsAutomated; var result = await RefreshWithProviders(metadataResult, id, refreshOptions, providers, ImageProvider, cancellationToken).ConfigureAwait(false); updateType |= result.UpdateType; if (result.Failures > 0) { hasRefreshedMetadata = false; } } } // Next run remote image providers, but only if local image providers didn't throw an exception if (!localImagesFailed && refreshOptions.ImageRefreshMode != MetadataRefreshMode.ValidationOnly) { var providers = GetNonLocalImageProviders(item, allImageProviders, refreshOptions).ToList(); if (providers.Count > 0) { var result = await ImageProvider.RefreshImages(itemOfType, libraryOptions, providers, refreshOptions, cancellationToken).ConfigureAwait(false); updateType |= result.UpdateType; if (result.Failures > 0) { hasRefreshedImages = false; } } } var beforeSaveResult = BeforeSave(itemOfType, isFirstRefresh || refreshOptions.ReplaceAllMetadata || refreshOptions.MetadataRefreshMode == MetadataRefreshMode.FullRefresh || requiresRefresh || refreshOptions.ForceSave, updateType); updateType |= beforeSaveResult; // Save if changes were made, or it's never been saved before if (refreshOptions.ForceSave || updateType > ItemUpdateType.None || isFirstRefresh || refreshOptions.ReplaceAllMetadata || requiresRefresh) { if (item.IsFileProtocol) { var file = TryGetFile(item.Path, refreshOptions.DirectoryService); if (file != null) { item.DateModified = file.LastWriteTimeUtc; } } // If any of these properties are set then make sure the updateType is not None, just to force everything to save if (refreshOptions.ForceSave || refreshOptions.ReplaceAllMetadata) { updateType |= ItemUpdateType.MetadataDownload; } if (hasRefreshedMetadata && hasRefreshedImages) { item.DateLastRefreshed = DateTime.UtcNow; } else { item.DateLastRefreshed = default; } // Save to database await SaveItemAsync(metadataResult, updateType, cancellationToken).ConfigureAwait(false); } await AfterMetadataRefresh(itemOfType, refreshOptions, cancellationToken).ConfigureAwait(false); return(updateType); }
public override void paint(PaintingContext context, Offset offset) { Canvas canvas = context.canvas; bool isEnabled = this.onChanged != null; float currentValue = this.position.value; float visualPosition = currentValue; Color trackColor = isEnabled ? Color.lerp(this.inactiveTrackColor, this.activeTrackColor, currentValue) : this.inactiveTrackColor; Color thumbColor = isEnabled ? Color.lerp(this.inactiveColor, this.activeColor, currentValue) : this.inactiveColor; ImageProvider thumbImage = isEnabled ? (currentValue < 0.5 ? this.inactiveThumbImage : this.activeThumbImage) : this.inactiveThumbImage; // Paint the track Paint paint = new Paint { color = trackColor }; float trackHorizontalPadding = Constants.kRadialReactionRadius - Switch._kTrackRadius; Rect trackRect = Rect.fromLTWH( offset.dx + trackHorizontalPadding, offset.dy + (this.size.height - Switch._kTrackHeight) / 2.0f, this.size.width - 2.0f * trackHorizontalPadding, Switch._kTrackHeight ); RRect trackRRect = RRect.fromRectAndRadius(trackRect, Radius.circular(Switch._kTrackRadius)); canvas.drawRRect(trackRRect, paint); Offset thumbPosition = new Offset( Constants.kRadialReactionRadius + visualPosition * this._trackInnerLength, this.size.height / 2.0f ); this.paintRadialReaction(canvas, offset, thumbPosition); try { this._isPainting = true; BoxPainter thumbPainter; if (this._cachedThumbPainter == null || thumbColor != this._cachedThumbColor || thumbImage != this._cachedThumbImage) { this._cachedThumbColor = thumbColor; this._cachedThumbImage = thumbImage; this._cachedThumbPainter = this._createDefaultThumbDecoration(thumbColor, thumbImage) .createBoxPainter(this._handleDecorationChanged); } thumbPainter = this._cachedThumbPainter; float inset = 1.0f - (currentValue - 0.5f).abs() * 2.0f; float radius = Switch._kThumbRadius - inset; thumbPainter.paint( canvas, thumbPosition + offset - new Offset(radius, radius), this.configuration.copyWith(size: Size.fromRadius(radius)) ); } finally { this._isPainting = false; } }
public FileImageProviderFactory(string filename) { _provider = new FileImageProvider(filename); }
public MainContentAdminService(ISettingStore settingStore, MainPageContentProvider mainPageContentProvider, ImageProvider imageProvider) { _settingStore = settingStore; _mainPageContentProvider = mainPageContentProvider; _imageProvider = imageProvider; }
public Statistics(LogList logList, ImageProvider imageProvider) { var refreshButton = new Button { Text = "Refresh statistics for current filter" }; BeginVertical(new Padding(5)); { BeginHorizontal(); { Add(null, true); Add(refreshButton); Add(null, true); } EndHorizontal(); } EndVertical(); BeginVertical(); { BeginHorizontal(); { BeginGroup("Profession counts", new Padding(5), new Size(5, 5), xscale: true); { foreach (var profession in GameData.Professions.Select(x => x.profession)) { professionCountLabels[profession] = new Label { Text = "Unknown" }; BeginHorizontal(); { var imageView = new ImageView { Image = imageProvider.GetTinyProfessionIcon(profession) }; Add(imageView); Add(professionCountLabels[profession]); } EndHorizontal(); } Add(null); } EndGroup(); BeginGroup("Specialization counts", xscale: true); { // Core specializations (no elite) BeginHorizontal(); { BeginVertical(new Padding(5), new Size(5, 5)); { foreach (var profession in GameData.Professions.Select(x => x.profession)) { specializationCoreCountLabels[profession] = new Label { Text = "Unknown" }; BeginHorizontal(); { var imageView = new ImageView { Image = imageProvider.GetTinyProfessionIcon(profession) }; Add(imageView); Add(specializationCoreCountLabels[profession]); } EndHorizontal(); } Add(null); } EndVertical(); // Heart of Thorns elite specializations BeginVertical(new Padding(5), new Size(5, 5)); { foreach (var specialization in GameData.Professions.Select(x => x.hot)) { specializationEliteCountLabels[specialization] = new Label { Text = "Unknown" }; BeginHorizontal(); { var imageView = new ImageView { Image = imageProvider.GetTinyProfessionIcon(specialization) }; Add(imageView); Add(specializationEliteCountLabels[specialization]); } EndHorizontal(); } Add(null); } EndVertical(); // Path of Fire elite specializations BeginVertical(new Padding(5), new Size(5, 5)); { foreach (var specialization in GameData.Professions.Select(x => x.pof)) { specializationEliteCountLabels[specialization] = new Label { Text = "Unknown" }; BeginHorizontal(); { var imageView = new ImageView { Image = imageProvider.GetTinyProfessionIcon(specialization) }; Add(imageView); Add(specializationEliteCountLabels[specialization]); } EndHorizontal(); } Add(null); } EndVertical(); } EndHorizontal(); } EndGroup(); } EndHorizontal(); } EndVertical(); AddSeparateRow(null); refreshButton.Click += (sender, args) => { var professionCounts = new Dictionary <Profession, int>(); var specializationCoreCounts = new Dictionary <Profession, int>(); var specializationEliteCounts = new Dictionary <EliteSpecialization, int>(); int logCount = 0; foreach (Profession profession in Enum.GetValues(typeof(Profession))) { professionCounts[profession] = 0; specializationCoreCounts[profession] = 0; } foreach (EliteSpecialization specialization in Enum.GetValues(typeof(EliteSpecialization))) { specializationEliteCounts[specialization] = 0; } foreach (var log in logList.DataStore) { if (log.ParsingStatus != ParsingStatus.Parsed) { continue; } foreach (var player in log.Players) { professionCounts[player.Profession]++; if (player.EliteSpecialization == EliteSpecialization.None) { specializationCoreCounts[player.Profession]++; } else { specializationEliteCounts[player.EliteSpecialization]++; } } logCount++; } foreach (var pair in professionCountLabels) { var profession = pair.Key; var label = pair.Value; var count = professionCounts[profession]; label.Text = $"{count} ({count / (float) logCount:0.00} on average)"; } foreach (var pair in specializationCoreCountLabels) { var profession = pair.Key; var label = pair.Value; var count = specializationCoreCounts[profession]; label.Text = $"{count}"; } foreach (var pair in specializationEliteCountLabels) { var specialization = pair.Key; var label = pair.Value; var count = specializationEliteCounts[specialization]; label.Text = $"{count}"; } }; }
/// <summary> /// Creates the incoming and outgoing media handlers such as microphone or speaker /// </summary> private void CreateMediaHandlers() { MediaHandlerFactory factory = new MediaHandlerFactory(); activeAudioCallListener = factory.CreateSoftPhoneCallListener(); activeVideoCallListener = factory.CreateSoftPhoneVideoCallListener(); phoneCallAudioReceiver = activeAudioCallListener.GetComponent("AudiReceiver") as PhoneCallAudioReceiver; phoneCallAudioSender = activeAudioCallListener.GetComponent("AudioSender") as PhoneCallAudioSender; phonecallVideoSender = activeVideoCallListener.GetComponent("VideoSender") as PhoneCallVideoSender; phonecallVideoReceiver = activeVideoCallListener.GetComponent("VideoReceiver") as PhoneCallVideoReceiver; mediaConnector = activeAudioCallListener.MediaConnector; microphone = activeAudioCallListener.GetComponent("Microphone") as Microphone; if (microphone != null) { microphone.LevelChanged += (Microphone_LevelChanged); } speaker = activeAudioCallListener.GetComponent("Speaker") as Speaker; if (speaker != null) { speaker.LevelChanged += (Speaker_LevelChanged); } incomingDataMixer = activeAudioCallListener.GetComponent("SpeakerMixer") as AudioMixerMediaHandler; camera = activeVideoCallListener.GetComponent("WebCamera") as WebCamera; remoteImageHandler = activeVideoCallListener.GetComponent("RemoteImageHandler") as ImageProvider<Image>; localImageHandler = activeVideoCallListener.GetComponent("LocalImageHandler") as ImageProvider<Image>; AudioProcessor = activeAudioCallListener.GetComponent("AudioProcessor") as AudioQualityEnhancer; outgoingDataMixer = activeAudioCallListener.GetComponent("OutGoingDataMixer") as AudioMixerMediaHandler; RecordDataMixer = activeAudioCallListener.GetComponent("RecordDataMixer") as AudioMixerMediaHandler; dtmfEventWavePlayer = activeAudioCallListener.GetComponent("DTMF") as DtmfEventWavePlayer; ringtoneWavePlayer = activeAudioCallListener.GetComponent("Ringtones") as PhoneCallStateWavePlayer; Stream basicRing = Assembly.GetExecutingAssembly().GetManifestResourceStream( "OzekiDemoSoftphone.Resources.basic_ring.wav" ); ringtoneWavePlayer.UpdateIncomingStateStream(CallState.Ringing, @"..\..\Resources\basic_ring.wav"); ringtoneWavePlayer.UpdateOutgoingStateStream(CallState.Ringing, @"..\..\Resources\ringback.wav"); }
private void _threadStart(object sender, TextChangedEventArgs e) { try { var text = _textBox.Text; var tuple = e == null ? sender as ReadableTuple <int> : _tab._listView.SelectedItem as ReadableTuple <int>; byte[] data = _tab.ProjectDatabase.MetaGrf.GetData(EncodingService.FromAnyToDisplayEncoding(GrfPath.Combine(_grfPath, text) + _ext)); if (tuple != null) { if (e != null) { _redirect = tuple.GetIntNoThrow(ServerMobAttributes.Sprite); } if (_redirect > 0) { var db = _tab.GetMetaTable <int>(ServerDbs.Mobs); tuple = db.TryGetTuple(_redirect); _redirect = 0; if (tuple != null) { var val = tuple.GetValue <string>(ServerMobAttributes.ClientSprite); data = _tab.ProjectDatabase.MetaGrf.GetData(EncodingService.FromAnyToDisplayEncoding(GrfPath.Combine(_grfPath, val) + _ext)); } } } if (data != null) { if (_ext == ".spr") { try { var image = Spr.GetFirstImage(data); if (image != null) { _wrapper.Image = image; _wrapper.Image.MakePinkTransparent(); _wrapper.Image.MakeFirstPixelTransparent(); _image.BeginDispatch(delegate { var bitmap = _wrapper.Image.Cast <BitmapSource>(); _image.Tag = text; _image.Source = bitmap; }); } else { _cancelImage(); } } catch { _cancelImage(); } } else { _wrapper.Image = ImageProvider.GetImage(data, _ext); _wrapper.Image.MakePinkTransparent(); _wrapper.Image.MakeFirstPixelTransparent(); _image.BeginDispatch(delegate { var bitmap = _wrapper.Image.Cast <BitmapSource>(); _image.Tag = text; _image.Source = bitmap; }); } } else { _cancelImage(); } } catch (Exception err) { _cancelImage(); ErrorHandler.HandleException(err); } }
public virtual void Cleanup(ImageProvider provider) { }
public FrontImageProviderFactory(Image image) { _provider = new FrontImageProvider(image); }