/// <summary> /// Converts the <see cref="sourceValue" /> parameter to the <see cref="destinationType" /> parameter using <see cref="formatProvider" /// /> and <see cref="ignoreCase" /> /// </summary> /// <param name="sourceValue">the value to convert into an instance of <see cref="ImageStatus" />.</param> /// <returns> /// an instance of <see cref="ImageStatus" />, or <c>null</c> if there is no suitable conversion. /// </returns> public static object ConvertFrom(dynamic sourceValue) { if (null == sourceValue) { return(null); } try { ImageStatus.FromJsonString(typeof(string) == sourceValue.GetType() ? sourceValue : sourceValue.ToJsonString()); } catch { // Unable to use JSON pattern } try { return(new ImageStatus { ApiVersion = sourceValue.ApiVersion, Code = sourceValue.Code, Kind = sourceValue.Kind, MessageList = sourceValue.MessageList, State = sourceValue.State, }); } catch { } return(null); }
/// <inheritdoc cref="ComputeApi.WaitForImageStatusAsync{TImage,TStatus}" /> /// <exception cref="InvalidOperationException">When this instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception> public async Task WaitForStatus(ImageStatus status, TimeSpan?refreshDelay = null, TimeSpan?timeout = null, IProgress <bool> progress = null, CancellationToken cancellationToken = default(CancellationToken)) { var owner = this.GetOwnerOrThrow <ComputeApi>(); var result = await owner.WaitForImageStatusAsync <Image, ImageStatus>(Id, status, refreshDelay, timeout, progress, cancellationToken).ConfigureAwait(false); result.CopyProperties(this); }
private void ImageHandling(String item, ImageStatus status) { List <Image> relevantImages = ItemToImage(item); switch (status) { case ImageStatus.UnAchieved: foreach (var image in relevantImages) { image.gameObject.SetActive(false); } break; case ImageStatus.JustAchieved: foreach (var image in relevantImages) { image.gameObject.SetActive(true); //image.CrossFadeAlpha(1.0f,3f,false); var imgAlpha = image.color; imgAlpha.a = 1.0f; image.DOFade(1.0f, 3f).OnComplete(() => image.color = imgAlpha); } stringsToUpdate.Add(item); break; case ImageStatus.Achieved: foreach (var image in relevantImages) { image.gameObject.SetActive(true); } break; } }
protected override void OnCellPainting(DataGridViewCellPaintingEventArgs e) { if (!this.DesignMode && DataSource != null && e.RowIndex > -1 && ((IList)DataSource).Count > 0) { object rowObject = Rows[e.RowIndex].DataBoundItem; if (e.ColumnIndex == -1 && m_imageStatusDelegate != null) { ImageStatus imageStatus = m_imageStatusDelegate(rowObject); if (imageStatus != null) { PaintImageInCell(imageStatus, e); } } if (e.ColumnIndex > -1 && m_backColorDelegate != null) { Color color = m_backColorDelegate(rowObject); e.CellStyle.BackColor = color; } } base.OnCellPainting(e); }
public void UpdateItemStatus(string type, ImageStatus achieved) { switch (type) { case "Brick": schematicProgress[brick] = achieved; break; case "Shell": schematicProgress[shell] = achieved; break; case "Jewel": schematicProgress[jewel] = achieved; break; case "ChargedJewel": schematicProgress[chargedJewel] = achieved; break; case "Golem": schematicProgress[golem] = achieved; break; } }
public UpdateData(EventType eventType, string message, string imageName, ImageStatus imageStatus) { this.EventType = eventType; this.Message = message; this.ImageName = imageName; this.ImageStatus = imageStatus; }
public void SetImageStatus(ImageStatus imageStatus) { string iconName = string.Empty; string bMPName = string.Empty; switch (imageStatus) { case ImageStatus.Running: iconName = RunningIconName; bMPName = RunningBMPName; break; case ImageStatus.Stopped: iconName = StoppedIconName; bMPName = StoppedBMPName; break; case ImageStatus.Unavailable: iconName = UnavailableIconName; bMPName = UnavailableBMPName; break; } Icon icon = new Icon(this.GetType().Assembly.GetManifestResourceStream(iconName)); _trayIcon.Icon = icon; if (_mainFormIsShowing == true) { Bitmap bitmap = new Bitmap(this.GetType().Assembly.GetManifestResourceStream(bMPName)); bitmap.MakeTransparent(System.Drawing.Color.White); _mainForm.ServerStatusPicture.Image = bitmap; } }
void OnReceivedItemTexture(ImageStatus statusMsg, Texture2D texture) { if (statusMsg != ImageStatus.Error) { UpdateTexture(texture); } }
public void Update(ImageEntry entry, ImageStatus status) { lock (myLock) { var image = this.DbContext.Image.Single(x => x.Id == entry.Id); image.Status = status; this.DbContext.SaveChanges(); } }
public ImageDisplayInformation([NotNull] string name, [NotNull] ImageValue image, [CanBeNull] TransformValue transform) { Name = name; Content = image; Transform = transform; layer = 0; displayMatrix = Matrix4x4.identity; status = ImageStatus.Unavailable; }
private static ImageStatus Clone(ImageStatus status, StageStatus?newOverallStatusValue) => new ImageStatus { OnboardingRequestId = status.OnboardingRequestId, QueueTime = status.QueueTime, SourceRepository = status.SourceRepository, TargetRepository = status.TargetRepository, Tag = status.Tag, OverallStatus = newOverallStatusValue ?? status.OverallStatus };
public SourceImage( string key, FileInfo file, DateTime lastModified, ImageStatus status) { this.Key = key; this.File = file; this.LastModified = lastModified; this.Status = status; }
public ReadPagePair(int leftPageIndex, int rightPageIndex, string leftImgPath, string rightImgPath, string _leftPageId, string _rightPageId, int PDFdpi) { this.PDFdpi = PDFdpi; this.leftPageIndex = leftPageIndex; this.rightPageIndex = rightPageIndex; imgStatus = ImageStatus.SMALLIMAGE; leftImagePath = leftImgPath; rightImagePath = rightImgPath; leftPageId = _leftPageId; rightPageId = _rightPageId; }
public StudyImage(int id, string imageUID, ImageStatus status, Machine machine, Detector detector, string analyseMethod, DateTime analyseTime) { this.id = id; this.imageUID = imageUID; this.status = status; this.machine = machine; this.detector = detector; this.analyseMethod = analyseMethod; #warning Needs to be changed this.analyseTime = DateTime.Now; }
// Guess the image's disk geometry based on its size protected internal bool MatchGeometry() { mSectorSize = (ushort)512; if (mIsHardDisk) { mStatus = ImageStatus.DiskLoaded; if (MatchGeometryMBR()) { return(true); } if (MatchGeometryDOS()) { return(true); } return(false); } else { mCylinders = (ushort)(0); mHeads = (ushort)(0); mSectors = (ushort)(0); for (int i = 0; i <= (int)((double)geometryTable.Length / 4 - 1); i++) { if (mFileLength == (ulong)geometryTable[i, 3]) { mCylinders = (ushort)(geometryTable[i, 0]); mHeads = (ushort)(geometryTable[i, 1]); mSectors = (ushort)(geometryTable[i, 2]); return(true); } } // Cheap trick to handle images with garbage at the end of the image file (such as the copyright crap inserted by DiskImage) for (int i = 0; i <= (int)((double)geometryTable.Length / 4 - 1); i++) { if (Math.Abs((int)mFileLength - geometryTable[i, 3]) <= 512) { mCylinders = (ushort)(geometryTable[i, 0]); mHeads = (ushort)(geometryTable[i, 1]); mSectors = (ushort)(geometryTable[i, 2]); return(true); } } return(false); } }
//public UISprite itemImageSprite; //protected virtual void OnEnable() //{ // if (itemID != 0) SP.OnStoreListLoaded += OnStoreListLoaded; //} //protected virtual void OnDisable() //{ // if (itemID != 0) SP.OnStoreListLoaded -= OnStoreListLoaded; //} //protected virtual void OnStoreListLoaded(List<StoreItem> storeList) //{ // SetItemData(SP.GetStoreItem(itemID)); //} void OnReceivedItemTexture(ImageStatus imageStatus, Texture2D texture) { if (gameObject == null) { return; } RawImage uiTexture = gameObject.GetComponentInChildren <RawImage>(); uiTexture.texture = texture; //if (loader != null) NGUITools.SetActive(loader, false); //TweenAlpha.Begin(uiTexture.cachedGameObject, 0.3f, 1).from = 0; }
public async Task <bool> UpdateImageStatus(Guid imageId, ImageStatus imageStatus) { try { await _connection.ExecuteAsync("UPDATE [dbo].[Images] SET [Status] = @Status WHERE [Id] = @Id", new { Id = imageId, Status = imageStatus }); return(true); } catch (Exception) { } return(false); }
private void PaintImageInCell(ImageStatus imageStatus, DataGridViewCellPaintingEventArgs e) { e.PaintBackground(e.ClipBounds, true); Rectangle r = Rectangle.Inflate(e.CellBounds, -4, -2); e.Graphics.DrawImage(imageStatus.Image, r); if (!string.IsNullOrEmpty(imageStatus.Status)) { Rows[e.RowIndex].Cells[0].ToolTipText = imageStatus.Status; } e.Handled = true; }
static private string StatusStr(ImageStatus Status) { //Takes the status flags and returns a list of //the enabled ones as a string. System.String Txt = ""; if (Status == ImageStatus.Empty) { Txt = "Empty"; } if ((Status & ImageStatus.Opened) > 0) { Txt = Txt + "Opened "; } if ((Status & ImageStatus.Defined) > 0) { Txt = Txt + "Defined "; } if ((Status & ImageStatus.Decoding) > 0) { Txt = Txt + "Decoding "; } if ((Status & ImageStatus.Decoded) > 0) { Txt = Txt + "Decoded "; } if ((Status & ImageStatus.Canceled) > 0) { Txt = Txt + "Canceled "; } if ((Status & ImageStatus.Error) > 0) { Txt = Txt + "Error "; } if ((Status & ImageStatus.ImageProcessed) > 0) { Txt = Txt + "ImageProcessed "; } if ((Status & ImageStatus.ImageProcessing) > 0) { Txt = Txt + "ImageProcessing "; } if ((Status & ImageStatus.Wait) > 0) { Txt = Txt + "Wait "; } return(Txt.Trim()); }
private void OpenImage(bool mountInReadOnlyMode, bool isHardDisk) { mReadOnly = mountInReadOnlyMode; try { if (mReadOnly) { file = new System.IO.FileStream(mFileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite); } else { file = new System.IO.FileStream(mFileName, System.IO.FileMode.Open, System.IO.FileAccess.ReadWrite, System.IO.FileShare.ReadWrite); } mFileLength = (ulong)file.Length; mIsHardDisk = isHardDisk; if (isHardDisk) { mHardDiskCount++; } if (MatchGeometry()) { mStatus = ImageStatus.DiskLoaded; } else { mStatus = ImageStatus.UnsupportedImageFormat; } } catch (UnauthorizedAccessException) { if (mountInReadOnlyMode) { mStatus = ImageStatus.UnsupportedImageFormat; } else { OpenImage(true, isHardDisk); } } catch (Exception) { mStatus = ImageStatus.UnsupportedImageFormat; } }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { JeedomSL.Pluggin.Eqlogic myObj = null; if (Tag != null) { myObj = Tag as JeedomSL.Pluggin.Eqlogic; LatencyValue.Text = myObj.cmds.Where(f => f.logicalId.Equals("latency")).FirstOrDefault().state + "ms"; Binding tmpBinding = new Binding() { Converter = new StatusToImagePathConverter() }; tmpBinding.Source = myObj.cmds.Where(f => f.logicalId.Equals("ping")).FirstOrDefault().state; ImageStatus.SetBinding(Image.SourceProperty, tmpBinding); } }
public void Close() { try { if (mStatus == ImageStatus.DiskLoaded) { file.Close(); } } catch { } finally { mStatus = ImageStatus.NoDisk; } }
private ImageStatus GetFrecStatusImage(object frecObject) { Frec frec = (Frec)frecObject; if (frec.IsFailed) { String message = "Error : " + frec.Response; return(ImageStatus.Create(Resources.breakpoint, message)); } else if (frec.HasIllegalCharacters) { String message = "Responce has xml illegal characters : " + String.Join <int>(";", frec.IllegalCharacters); return(ImageStatus.Create(Resources.cube_molecule, message)); } return(null); }
public static ImageStatus GetWarnTypeImageDelegate(object item) { ISupportWarnTypes supportFailed = item as ISupportWarnTypes; if (supportFailed != null) { if (supportFailed.IsErrType) { return(ImageStatus.Create(Resources.breakpoint)); } else if (supportFailed.IsWrnType) { return(ImageStatus.Create(Resources.warning)); } } return(null); }
public DiskImage(string fileName, bool mountInReadOnlyMode = false, bool isHardDisk = false) { mFileName = X8086.FixPath(fileName); mCylinders = (ushort)(0); mHeads = (ushort)(0); mSectors = (ushort)(0); mFileLength = 0; if (!System.IO.File.Exists(mFileName)) { mStatus = ImageStatus.DiskImageNotFound; } else { OpenImage(mountInReadOnlyMode, isHardDisk); } X8086.Notify("DiskImage '{0}': {1}", X8086.NotificationReasons.Info, mFileName, mStatus.ToString()); }
private static string GetStatusString(ImageStatus status) { string[] statusParts = { "Downloading...", "", "", "" }; switch (status) { case ImageStatus.Skipped: statusParts[1] = "Skipped"; break; case ImageStatus.Downloaded: statusParts[1] = "Done"; statusParts[2] = "Saving..."; break; case ImageStatus.Saved: statusParts[1] = "Done"; statusParts[2] = "Saving..."; statusParts[3] = "Done"; break; default: break; } return string.Format("{0,-16}{1,-6}{2,-11}{3,-6}", statusParts); }
private bool ShouldProcessImageStatus(ImageStatus imageStatus, DigestInfo digestInfo) => // Find the image statuses that are associated with the repo indicated in the image info. This filter is needed // because MCR's webhook responds to all image pushes in the ACR, even those to staging locations. A queue time filter // is needed in order to filter out onboarding requests from a previous ingestion of the same digests. imageStatus.TargetRepository == digestInfo.Repo && imageStatus.QueueTime >= Options.MinimumQueueTime;
private async Task <string> GetFailedStatusAsync(IMcrStatusClient statusClient, string digest, ImageStatus imageStatus) { ImageResultDetailed result = await statusClient.GetImageResultDetailedAsync(digest, imageStatus.OnboardingRequestId); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"Failure for '{GetQualifiedDigest(imageStatus.TargetRepository, digest)}':"); stringBuilder.AppendLine($"\tID: {imageStatus.OnboardingRequestId}"); stringBuilder.AppendLine($"\tTag: {imageStatus.Tag}"); stringBuilder.AppendLine($"\tCommit digest: {result.CommitDigest}"); stringBuilder.Append(result.Substatus.ToString("\t")); return(stringBuilder.ToString()); }
/// <inheritdoc cref="ComputeService.WaitForImageStatusAsync" /> public static void WaitForImageStatus(this ComputeService service, Identifier imageId, ImageStatus status, TimeSpan? refreshDelay = null, TimeSpan? timeout = null, IProgress<bool> progress = null) { service.WaitForImageStatusAsync(imageId, status, refreshDelay, timeout, progress).ForceSynchronous(); }
public void imageChange(ImageStatus status) { Image tempImage; if (status == ImageStatus.clicked) tempImage = imageClicked; else if (status == ImageStatus.unclicked) tempImage = imageUnclicked; else if (status == ImageStatus.hover) tempImage = imageHover; else return; button.Image = tempImage; button.Height = tempImage.Height; button.Width = tempImage.Width; button.Top = imageClicked.Height - tempImage.Height; this.status = status; }
/// <inheritdoc cref="ComputeApi.WaitForImageStatusAsync{TImage,TStatus}" /> /// <exception cref="InvalidOperationException">When this instance was not constructed by the <see cref="ComputeService"/>, as it is missing the appropriate internal state to execute service calls.</exception> public async Task WaitForStatus(ImageStatus status, TimeSpan? refreshDelay = null, TimeSpan? timeout = null, IProgress<bool> progress = null, CancellationToken cancellationToken = default(CancellationToken)) { var owner = this.GetOwnerOrThrow<ComputeApi>(); var result = await owner.WaitForImageStatusAsync<Image, ImageStatus>(Id, status, refreshDelay, timeout, progress, cancellationToken).ConfigureAwait(false); result.CopyProperties(this); }
public bool OnImageTransferStatusChanged(ImageStatus imageStatus) { if (!this.imagesDownloading.ContainsKey(imageStatus.Id)) { return false; } List<ImageEx> list = this.imagesDownloading[imageStatus.Id]; if ((imageStatus.Status == C2CImageTransferTags.ImageStatus.IS_Recv_Suc) && File.Exists(imageStatus.Path)) { TXLog.TXLogImage("图片下载 成功" + imageStatus.Path); foreach (ImageEx ex in list) { ex.Source = imageStatus.Path; DisabledImageClickStyle(ex); } } else { TXLog.TXLogImage("图片下载 失败" + imageStatus.Path); foreach (ImageEx ex2 in list) { ex2.Source = CoreMessenger.Instance.GetAppPath(KernelWrapper.APP_PATH_TYPE.APP_PATH_DATA) + "errorBmp.gif"; DisabledImageClickStyle(ex2); } } if (base.CaretPosition.Parent != null) { TXLog.TXLogImage("InputBox.CaretPosition.Parent Type : " + base.CaretPosition.Parent.GetType().Name); } else { TXLog.TXLogImage("InputBox.CaretPosition.Parent == NULL"); } if (base.CaretPosition.Parent is FrameworkElement) { (base.CaretPosition.Parent as FrameworkElement).BringIntoView(); } else { base.ScrollToEnd(); } this.imagesDownloading.Remove(imageStatus.Id); return true; }
void OnReceivedIngredientImage(ImageStatus status, Texture2D texture) { ingredientImage.texture = texture; }
/// <summary> /// <para> /// Verifies that all of the container images currently loaded on nodes are specified in the /// container manifest. Any images that aren't in the manifest need to be preloaded info the /// node image. This is used to ensure that pods started by third-party operators are also /// included in the cluster manifest, ensuing that our node images are self-contained for a /// better setup experience as well as air-gapped clusters. /// </para> /// <para> /// Details about any issues will be written to STDOUT. /// </para> /// </summary> /// <param name="clusterLogin">Specifies the target cluster login.</param> /// <param name="k8s">Specifies the cluster's Kubernertes client.</param> /// <param name="details">Optionally specifies that status should be written to STDOUT when there's no errors.</param> /// <returns><c>true</c> when there are no problems, <c>false</c> otherwise.</returns> /// <remarks> /// <para> /// neonKUBE clusters deploy all required images to CRI-O running on all cluster /// nodes as well as the local Harbor registry. This not only improves the cluster /// setup experience but also makes air gapped cluster possible. /// </para> /// </remarks> public static async Task <bool> CheckNodeContainerImagesAsync(ClusterLogin clusterLogin, IKubernetes k8s, bool details = false) { Covenant.Requires <ArgumentNullException>(clusterLogin != null, nameof(clusterLogin)); Covenant.Requires <ArgumentNullException>(k8s != null, nameof(k8s)); Console.WriteLine(); Console.WriteLine("==============================================================================="); Console.WriteLine("Checking local container images..."); var manifestImages = new HashSet <string>(StringComparer.InvariantCultureIgnoreCase); foreach (var image in KubeSetup.ClusterManifest.ContainerImages) { manifestImages.Add(image.SourceRef); } var nodes = await k8s.ListNodeAsync(); var images = new Dictionary <string, ImageStatus>(StringComparer.InvariantCultureIgnoreCase); var sbImageNames = new StringBuilder(); foreach (var node in nodes.Items) { foreach (var image in node.Status.Images) { var found = false; foreach (var name in image.Names) { if (manifestImages.Contains(name)) { found = true; break; } } sbImageNames.Clear(); foreach (var name in image.Names.OrderBy(name => name, StringComparer.InvariantCultureIgnoreCase)) { sbImageNames.AppendWithSeparator(name, ", "); } var imageNames = sbImageNames.ToString(); var imageStatus = new ImageStatus() { ImageNames = imageNames, NotInManifest = !found }; images[imageStatus.ImageNames] = imageStatus; } } var badImageCount = images.Values.Count(image => image.NotInManifest); if (badImageCount > 0 || details) { if (badImageCount > 0) { Console.WriteLine(); Console.WriteLine($"ERROR: [{badImageCount}] images are being pulled from external registries:"); Console.WriteLine(); } else { Console.WriteLine(); } if (badImageCount > 0 || details) { foreach (var image in images.Values.OrderBy(image => image.ImageNames)) { var badImage = image.NotInManifest; var status = badImage ? "--> " : " "; if (badImage || details) { Console.WriteLine($"{status}{image.ImageNames}"); } } } } else { Console.WriteLine(); Console.WriteLine($"OK: All container images are present in the cluster registry."); } return(badImageCount == 0); }
/// <inheritdoc cref="ComputeService.WaitForImageStatusAsync" /> public static void WaitForImageStatus(this ComputeService service, Identifier imageId, ImageStatus status, TimeSpan?refreshDelay = null, TimeSpan?timeout = null, IProgress <bool> progress = null) { service.WaitForImageStatusAsync(imageId, status, refreshDelay, timeout, progress).ForceSynchronous(); }
private void UpdateImageStatus(string image, ImageStatus imageStatus) { UpdateSink(new UpdateData(EventType.ItemUpdate, image, imageStatus)); }
void OnReceivedRecipeItemImage(ImageStatus status, Texture2D img) { RecipeItemImage.texture = img; }
public UpdateData(EventType eventType, string imageName, ImageStatus imageStatus) : this(eventType, string.Empty, imageName, imageStatus) { }