public static String nomeCompletoLogo(Logo logo) { return(Path.Combine(Configurazione.UserConfigLumen.cartellaLoghi, logo.nomeFileLogo)); }
internal void SetConfiguration(Configuration <T> configuration) { _configuration = configuration; Customer.SetConfiguration(_configuration); Logo.SetConfiguration(_configuration); }
private void ani_Completed(object sender, EventArgs e) { Logo.BeginAnimation(UIElement.OpacityProperty, _ani); }
public void Insert() { SetUpTestData(); IBaseRepository<User> repo = InitializeRepo(); _mockLogo = repo.Add(_mockLogo); _mockLogo.Id.Should().NotBe(0); _mockLogo.Enabled.Should().BeTrue(); _mockLogo.ChartId.Should().NotBe(0); _logoId = (long)_mockLogo.Id; }
private void EraseImage() { Logo.Clear(); SavedSuccessfully = false; }
void Awake() { inst = this; }
public bool UpdateWhitelabel(Logo newlogo) { SqlConnection _connection = OneTapConnection.GetConnection; bool status = false; try { string result = ""; _connection.Open(); SqlCommand command = new SqlCommand("PROC_OneTap_UpdateOrSaveWhiteLabel"); command.Connection = _connection; command.CommandType = System.Data.CommandType.StoredProcedure; var param = new SqlParameter(); param.Direction = ParameterDirection.Input; param.ParameterName = "@pwhitelabelname"; param.Value = newlogo.WhiteLabelName; param.SqlDbType = SqlDbType.VarChar; command.Parameters.Add(param); var ChannelList = new SqlParameter(); ChannelList.Direction = ParameterDirection.Input; ChannelList.ParameterName = "@pwhitelabelid"; ChannelList.Value = newlogo.WLVID; ChannelList.SqlDbType = SqlDbType.Int; command.Parameters.Add(ChannelList); var outparam = new SqlParameter(); outparam.Direction = ParameterDirection.Output; outparam.ParameterName = "@retValue"; outparam.SqlDbType = SqlDbType.VarChar; outparam.Size = 20; command.Parameters.Add(outparam); command.ExecuteNonQuery(); result = (string)outparam.Value; status = result.ToLower().Equals("success"); _connection.Close(); } catch (Exception) { if (_connection.State != ConnectionState.Closed) { _connection.Close(); } //throw; status = false; } finally { if (_connection.State != ConnectionState.Closed) { _connection.Close(); } } return(status); }
public FadeOptions(Logo l) { logo = l; reset(); }
public FadeRotationOptions(Logo l, float pStart, float pEnd, float rot1, float rot2) : base(l, pStart, pEnd) { r1 = rot1; r2 = rot2; rDif = r2 - r1; }
public void setPrevious(Logo l) { previous = l; }
public FadeColorOptions(Logo l, float pStart, float pEnd, Color col1, Color col2) : base(l, pStart, pEnd) { c1 = col1; c2 = col2; }
public void setNext(Logo l) { next = l; }
public bool goNext(out Logo l) { l = next; return next != null; }
//public LogoMatch MatchLogo(List<IPoint> interestPoints,double width,double height,List<int> channelIds=null) //{ // LogoMatch match = new LogoMatch(); // var sourceLogos = CacheManager.Logos.Where(x => x.SourceImageWidth == width && x.SourceImageHeight == height).OrderByDescending(x => x.MatchCount).ToList(); // if (sourceLogos != null && channelIds != null) // { // sourceLogos = sourceLogos.Where(x => channelIds.Contains(x.ChannelId)).ToList(); // } // if (sourceLogos != null) // { // foreach (var logo in sourceLogos) // { // float padding = 2; // var points = interestPoints.Where(x => x.x >= (logo.Minx - padding) && x.y >= (logo.Miny - padding) && x.x <= (logo.Maxx + padding) && x.y <= (logo.Maxy + padding)).ToList(); // //Bitmap croppedImage=Logo.CloneBitmap(bmp,logo.X1,logo.Y1,logo.X2,logo.Y2); // //List<IPoint> points = GetImagePoints(croppedImage); // if (points.Count > 20 && points.Count >= logo.InterestPointsList.Count) // { // double ratio = Match(logo.InterestPointsList, points); // if (ratio > 0.7) // { // match.Ratio = ratio; // match.Logo = logo; // match.IsMatch = true; // break; // } // else // { // if (match.Ratio < ratio) // { // match.Logo = logo; // match.Ratio = ratio; // } // } // } // } // if (match.Ratio >= 0.20) // { // match.IsMatch = true; // } // } // return match; //} public Bitmap ExtractLogo(Bitmap bmp,Logo logo) { Bitmap croppedImage = Logo.CloneBitmap(bmp, logo.X1, logo.Y1, logo.X2, logo.Y2); return croppedImage; }
public VistaMenu() { OnLoad = ((state, target) => { if (count == 0) { foreach (var entity in Entities) { if (entity is ITransparent e) { e.Transparency = (PGPercent)0; } } } foreach (var entity in Entities) { if (entity is ITransparent e) { e.Transparency = (PGPercent)((float)e.Transparency + 0.02); } } count++; if (count >= 100) { count = 0; OnDraw = DefaultOnDraw; } }); OnDraw += OnLoad; var button1 = new Button("Continue", 0.05f, 0.3f, 0.1f); var button2 = new Button("New", 0.05f, 0.3f, 0.15f); var button3 = new Button("Load", 0.05f, 0.3f, 0.2f); var button4 = new Button("Settings", 0.05f, 0.3f, 0.25f); var bg = new Background(ResourceTextures.GetGlobalResource(ResourceTextures.Key.Background)); var title = new Title("Main Menu"); var logo = new Logo(ResourceTextures.GetGlobalResource(ResourceTextures.Key.Logo)); var field = new CenteredField(0.4f, 0.8f); AddEntity(bg); AddEntity(title); AddEntity(logo); AddEntity(field); AddEntity(button1).AsEventSink().WhenMousePressed = ((sender, args) => { var rectangle = button1.Field; var argument = (MouseButtonEventArgs)args; if (rectangle.Contains(argument.X, argument.Y)) { Engine.Vista = Engine.SP_Running; } }); AddEntity(button2).AsEventSink().WhenMousePressed = ((sender, args) => { var rectangle = button2.Field; var argument = (MouseButtonEventArgs)args; if (rectangle.Contains(argument.X, argument.Y)) { Engine.Vista = new VistaNotImplemented(); } }); AddEntity(button3).AsEventSink().WhenMousePressed = ((sender, args) => { var rectangle = button3.Field; var argument = (MouseButtonEventArgs)args; if (rectangle.Contains(argument.X, argument.Y)) { Engine.Vista = new VistaMenuLoad(); } }); AddEntity(button4).AsEventSink().WhenMousePressed = ((sender, args) => { var rectangle = button4.Field; var argument = (MouseButtonEventArgs)args; if (rectangle.Contains(argument.X, argument.Y)) { Engine.Vista = new VistaMenuSettings(); } }); }
public FadeSizeOptions(Logo l, float pStart, float pEnd, Vector2 siz1, Vector2 siz2) : base(l, pStart, pEnd) { s1 = siz1; s2 = siz2; }
//Elements on Navigation Bar are clickable // and lead to the corresponding pages public HomePage ClickOnLogo() { Logo.Click(); return(new HomePage(_driver)); }
public FadeTimelineOptions(Logo l, float pStart, float pEnd) : base(l) { setLast = false; pS = pStart; pE = pEnd; pDif = pE - pS; }
/// <summary> /// Event handler for orientation changes. /// Repositions UI elements depending on the orientation. /// </summary> /// <param name="sender">Sender of the event</param> /// <param name="r">Event arguments</param> private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e) { if (e.Orientation == PageOrientation.Landscape || e.Orientation == PageOrientation.LandscapeLeft || e.Orientation == PageOrientation.LandscapeRight) { Logo.SetValue(Grid.RowProperty, 1); Logo.SetValue(Grid.ColumnSpanProperty, 1); BoardGrid.SetValue(Grid.RowProperty, 0); BoardGrid.SetValue(Grid.ColumnProperty, 1); BoardGrid.SetValue(Grid.RowSpanProperty, 3); BoardGrid.SetValue(Grid.ColumnSpanProperty, 2); waitIndicator.SetValue(Grid.RowProperty, 0); waitIndicator.SetValue(Grid.ColumnProperty, 1); waitIndicator.SetValue(Grid.RowSpanProperty, 3); waitIndicator.SetValue(Grid.ColumnSpanProperty, 2); Statistics.SetValue(Grid.RowProperty, 1); Statistics.SetValue(Grid.RowSpanProperty, 2); Statistics.SetValue(Grid.ColumnSpanProperty, 1); if (e.Orientation == PageOrientation.LandscapeLeft) { LayoutRoot.Margin = new Thickness(0, 0, 72, 0); } if (e.Orientation == PageOrientation.LandscapeRight) { LayoutRoot.Margin = new Thickness(72, 0, 0, 0); } LayoutRoot.RowDefinitions[0].Height = new GridLength(90); LayoutRoot.RowDefinitions[1].Height = new GridLength(90); for (int t = 0; t < Statistics.ColumnDefinitions.Count; t++) { Statistics.ColumnDefinitions[t].Width = new GridLength(0); } Statistics.ColumnDefinitions[0].Width = new GridLength(10); Statistics.ColumnDefinitions[1].Width = new GridLength(35, GridUnitType.Star); Statistics.ColumnDefinitions[2].Width = new GridLength(65, GridUnitType.Star); Statistics.RowDefinitions[0].Height = new GridLength(10); Statistics.RowDefinitions[1].Height = new GridLength(100, GridUnitType.Star); Statistics.RowDefinitions[2].Height = new GridLength(100, GridUnitType.Star); Statistics.RowDefinitions[3].Height = new GridLength(100, GridUnitType.Star); Statistics.RowDefinitions[4].Height = new GridLength(10); Statistics.Height = 192; MovesImage.SetValue(Grid.ColumnProperty, 1); MovesImage.SetValue(Grid.RowProperty, 1); EmptyImage.SetValue(Grid.ColumnProperty, 1); EmptyImage.SetValue(Grid.RowProperty, 2); GameTimeImage.SetValue(Grid.ColumnProperty, 1); GameTimeImage.SetValue(Grid.RowProperty, 3); Moves.SetValue(Grid.ColumnProperty, 2); Moves.SetValue(Grid.RowProperty, 1); Empty.SetValue(Grid.ColumnProperty, 2); Empty.SetValue(Grid.RowProperty, 2); GameTime.SetValue(Grid.ColumnProperty, 2); GameTime.SetValue(Grid.RowProperty, 3); } else { Logo.SetValue(Grid.RowProperty, 0); Logo.SetValue(Grid.ColumnSpanProperty, 2); BoardGrid.SetValue(Grid.RowProperty, 1); BoardGrid.SetValue(Grid.ColumnProperty, 0); BoardGrid.SetValue(Grid.RowSpanProperty, 1); BoardGrid.SetValue(Grid.ColumnSpanProperty, 2); waitIndicator.SetValue(Grid.RowProperty, 1); waitIndicator.SetValue(Grid.ColumnProperty, 0); waitIndicator.SetValue(Grid.RowSpanProperty, 1); waitIndicator.SetValue(Grid.ColumnSpanProperty, 2); Statistics.SetValue(Grid.RowProperty, 3); Statistics.SetValue(Grid.RowSpanProperty, 1); Statistics.SetValue(Grid.ColumnSpanProperty, 2); LayoutRoot.Margin = new Thickness(0, 0, 0, 72); LayoutRoot.RowDefinitions[0].Height = new GridLength(120); LayoutRoot.RowDefinitions[1].Height = new GridLength(460); for (int t = 0; t < Statistics.RowDefinitions.Count; t++) { Statistics.RowDefinitions[t].Height = new GridLength(0); } Statistics.ColumnDefinitions[0].Width = new GridLength(18); Statistics.ColumnDefinitions[1].Width = new GridLength(60, GridUnitType.Star); Statistics.ColumnDefinitions[2].Width = new GridLength(75, GridUnitType.Star); Statistics.ColumnDefinitions[3].Width = new GridLength(60, GridUnitType.Star); Statistics.ColumnDefinitions[4].Width = new GridLength(75, GridUnitType.Star); Statistics.ColumnDefinitions[5].Width = new GridLength(60, GridUnitType.Star); Statistics.ColumnDefinitions[6].Width = new GridLength(90, GridUnitType.Star); Statistics.ColumnDefinitions[7].Width = new GridLength(18); Statistics.RowDefinitions[0].Height = new GridLength(100, GridUnitType.Star); Statistics.Height = 64; MovesImage.SetValue(Grid.ColumnProperty, 1); MovesImage.SetValue(Grid.RowProperty, 0); EmptyImage.SetValue(Grid.ColumnProperty, 3); EmptyImage.SetValue(Grid.RowProperty, 0); GameTimeImage.SetValue(Grid.ColumnProperty, 5); GameTimeImage.SetValue(Grid.RowProperty, 0); Moves.SetValue(Grid.ColumnProperty, 2); Moves.SetValue(Grid.RowProperty, 0); Empty.SetValue(Grid.ColumnProperty, 4); Empty.SetValue(Grid.RowProperty, 0); GameTime.SetValue(Grid.ColumnProperty, 6); GameTime.SetValue(Grid.RowProperty, 0); } }
public LogoList(params Logo[] l) { logos = new Logo[l.Length]; Array.Copy(l, logos, l.Length); current = logos[0]; for (int i = 0; i < logos.Length; i++) { logos[i].setNext((i < logos.Length - 1) ? logos[i + 1] : null); logos[i].setPrevious((i > 0) ? logos[i - 1] : null); } reset(); }
public DisplayedLogo(Logo logo_, UIObjectAnimator animator_, Vector2 index_) { logo = logo_; animator = animator_; index = index_; }
/// <summary> /// Invokes the function and returns results. /// </summary> /// <param name="logo">The <see cref="Logo"/> instance which provides execution contexts.</param> /// <param name="result">The execution result.</param> public void Invoke(Logo logo, out object result) { result = Execute(logo.CurrentProcedureScope); }
public void PrintLogo() { Console.WriteLine(Logo.GetLogo()); }
void ReleaseDesignerOutlets() { if (ContainerView != null) { ContainerView.Dispose(); ContainerView = null; } if (Domain != null) { Domain.Dispose(); Domain = null; } if (LoginButton != null) { LoginButton.Dispose(); LoginButton = null; } if (Logo != null) { Logo.Dispose(); Logo = null; } if (Password != null) { Password.Dispose(); Password = null; } if (ScrollView != null) { ScrollView.Dispose(); ScrollView = null; } if (User != null) { User.Dispose(); User = null; } if (StackView != null) { StackView.Dispose(); StackView = null; } if (TokenTextField != null) { TokenTextField.Dispose(); TokenTextField = null; } if (AuthenticationSelector != null) { AuthenticationSelector.Dispose(); AuthenticationSelector = null; } if (DescriptionLabel != null) { DescriptionLabel.Dispose(); DescriptionLabel = null; } }
public static string GetText() { return($"{Logo.ToString()}{Version.ToString()}"); }
public void ClickOnLogo() { Logo.Click(); }
private void InitializeFlashAnimation() { _ani.AutoReverse = true; _ani.Completed += ani_Completed; Logo.BeginAnimation(UIElement.OpacityProperty, _ani); }
public Layout(int LayoutID, int UserID, string BackgroundColor, string LayoutName, Logo logo) { this.LayoutID = LayoutID; this.UserID = UserID; this.BackgroundColor = BackgroundColor; this.LayoutName = LayoutName; this.logo = logo; }
public async Task <ScreenshotResult> Screenshot(string URL, string DirectoryPath, bool IncludeLogoWatermark, string WatermarkFilePath, Point CropStartPoint, Size CropSize, bool DoCropImage) { if (LoadedFine) { try { string ImagePath = DirectoryPath + "Screenshot-" + DateTime.UtcNow.Month.ToString() + "-" + DateTime.UtcNow.Day.ToString() + "-" + DateTime.UtcNow.Year.ToString() + "-" + DateTime.UtcNow.Hour.ToString() + "h" + DateTime.UtcNow.Minute.ToString() + "m" + DateTime.UtcNow.Second.ToString() + "s.png"; driver.Navigate() .GoToUrl(URL); Thread.Sleep(3000); var bytearray = driver.GetScreenshot().AsByteArray; //driver.Quit(); Bitmap bmp; using (var ms = new MemoryStream(bytearray)) { bmp = new Bitmap(ms); } Bitmap CroppedImage; if (DoCropImage) { Rectangle section = new Rectangle(CropStartPoint, CropSize); CroppedImage = CropImage(bmp, section); } else { CroppedImage = bmp; } if (IncludeLogoWatermark) { Bitmap Logo; if (WatermarkFilePath != "") { if (File.Exists(WatermarkFilePath)) { Logo = new Bitmap(WatermarkFilePath); } else { Logo = Properties.Resources.Watermark; } } else { Logo = Properties.Resources.Watermark; } Bitmap FinalLogo = ResizeBitmap(Logo, Logo.Width / 3, Logo.Height / 3); Graphics gCroppedImage = Graphics.FromImage(CroppedImage); gCroppedImage.DrawImage(FinalLogo, CroppedImage.Width / 2 - FinalLogo.Width / 2, 70, new Rectangle(0, 0, FinalLogo.Width, FinalLogo.Height), GraphicsUnit.Pixel); CroppedImage.Save(ImagePath, ImageFormat.Png); gCroppedImage.Dispose(); FinalLogo.Dispose(); Logo.Dispose(); } else { CroppedImage.Save(ImagePath, ImageFormat.Png); } CroppedImage.Dispose(); bmp.Dispose(); return(new ScreenshotResult(true, ImagePath)); } catch (Exception ex) { return(new ScreenshotResult(false, "")); } } else { return(new ScreenshotResult(false, "")); } }
public void Dispose() { Logo?.Dispose(); }
public void Update(Logo logo) { _logger.LogDebug("Updating Logo: {0}", JsonConvert.SerializeObject(logo)); _databaseContext.Logos.Update(logo); _databaseContext.SaveChanges(); }
internal static ProgramContext Initialize(ILoggerFactory loggerFactory, Config config) { var logger = loggerFactory.CreateLogger(nameof(Logic)); var mqttClients = new List <Mqtt>(); var logos = new List <Logo>(); logger.LogInformation($"MQTT broker at {config.MqttBrokerUri} using port {config.MqttBrokerPort}"); foreach (var logoConfig in config.Logos) { logger.LogInformation($"Logo PLC at {logoConfig.IpAddress}"); var logo = new Logo( loggerFactory.CreateLogger <Logo>(), logoConfig.IpAddress, logoConfig.MemoryRanges); logos.Add(logo); foreach (var mqttClientConfig in logoConfig.Mqtt) { logger.LogInformation($"- MQTT client {mqttClientConfig.ClientId}"); var mqttClient = new Mqtt( loggerFactory.CreateLogger <Mqtt>(), mqttClientConfig.ClientId, config.MqttBrokerUri, config.MqttBrokerPort, mqttClientConfig.CleanSession, config.MqttBrokerUsername, config.MqttBrokerPassword, mqttClientConfig.LastWill); mqttClients.Add(mqttClient); var mapper = new Mapper(loggerFactory, logo, mqttClient); foreach (var channel in mqttClientConfig.Channels) { var action = channel.GetActionAsEnum(); logger.LogInformation($"-- {action} {channel.Topic} {channel.GetQualityOfServiceAsEnum()} retain:{channel.Retain} logo: {channel.Type}@{channel.LogoAddress}"); switch (action) { case MqttChannelConfig.Actions.Publish: mapper.PublishOnChange( channel.Topic, channel.LogoAddress, channel.GetTypeAsEnum(), channel.Retain, channel.GetQualityOfServiceAsEnum().ToMqttNet()); break; case MqttChannelConfig.Actions.Subscribe: mapper.WriteLogoVariable( mqttClient.Subscribe( channel.Topic, channel.GetQualityOfServiceAsEnum().ToMqttNet()), channel.LogoAddress, channel.GetTypeAsEnum()); break; case MqttChannelConfig.Actions.SubscribePulse: mapper.PulseLogoVariable( mqttClient.Subscribe( channel.Topic, channel.GetQualityOfServiceAsEnum().ToMqttNet()), channel.LogoAddress, channel.GetTypeAsEnum(), channel.Duration); break; default: throw new ArgumentOutOfRangeException(); } } } } return(new ProgramContext( loggerFactory.CreateLogger <ProgramContext>(), logos.ToImmutableArray(), mqttClients.ToImmutableArray())); }
public static async Task <HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "api/Generate/Image")] HttpRequestMessage request, TraceWriter log, ExecutionContext context) { if (IsAuthenticated) { auth = request.GetAuthInfoAsync(log).Result; } log.Info("Is Authenticated: " + IsAuthenticated); //We can zip a bunch of them var generator = new UrlGenerator(new Uri(QrCodeUrl), 1); var guid = generator.Guids.First(); //Create Blob/Table references var wallPath = string.Format($"{guid.ToString("N")}/wall"); var wallblob = BlobStorage.GetBlob(Constants.BlobContainerNames.Wall, wallPath); var contents = new WallEntity(new Message() { Text = Constants.Default.Wall.WelcomeMessage, Username = Constants.Default.Wall.User }); var json = JsonConvert.SerializeObject(contents); wallblob.UploadText(json); if (IsAuthenticated) { var name = auth.GetClaim(ClaimTypes.Name).Value; var nameId = auth.GetClaim(ClaimTypes.NameIdentifier).Value; var user = new Users(name, nameId); TableStorage.Insert(Constants.TableNames.Users, user); var trackedWall = new Tracked(nameId, guid.ToString("N")); TableStorage.Insert(Constants.TableNames.Tracked, trackedWall); } var urls = generator.ToUri(); var bitmap = new QrCode().GenerateImage(urls.First(), 10); var ms = new MemoryStream(); bitmap.Save(ms, ImageFormat.Png); var logoPath = context.FunctionAppDirectory + logoLocation; var footerPath = context.FunctionAppDirectory + footerLocation; var logo = new Logo(logoPath); var footer = new Logo(footerPath); ms.Position = 0; var qrCodeWithLogo = logo.Image.AppendImage(Image.FromStream(ms), 10, 10); ms.Position = 0; var footerImage = qrCodeWithLogo.AppendImage(footer.Image, 0, 0); var result = footerImage.WriteText(guid.ToString("N").Substring(0, 5), new PointF(40, footerImage.Height - 160)); var msreadathon = new MemoryStream(); ImageCodecInfo jpgEncoder = GetEncoder(ImageFormat.Jpeg); Encoder myEncoder = Encoder.Quality; EncoderParameters myEncoderParameters = new EncoderParameters(1); EncoderParameter myEncoderParameter = new EncoderParameter(myEncoder, 100L); myEncoderParameters.Param[0] = myEncoderParameter; result.Save(msreadathon, jpgEncoder, myEncoderParameters); //Save image to blob var qrCodePath = string.Format($"{guid.ToString("N")}/qrCode"); var container = BlobStorage.GetContainer(Constants.BlobContainerNames.Wall); var qrCodeBlob = container.GetBlockBlobReference(qrCodePath); qrCodeBlob.Properties.ContentType = "image/png"; ms.Position = 0; qrCodeBlob.UploadFromStream(ms); log.Info("Image uploaded to: " + qrCodeBlob.Uri.AbsoluteUri); var response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new ByteArrayContent(msreadathon.ToArray()); response.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue(CONTENT_DISPOSITION_TYPE); response.Content.Headers.ContentDisposition.FileName = FILENAME; response.Content.Headers.ContentType = new MediaTypeHeaderValue(MEDIA_TYPE); return(response); }
protected static List <IPrediction> DeserializePredictions(ModelType modelType, dynamic jsonObject) { var propertyValues = (JObject)jsonObject.data; var data = new List <IPrediction>(); if (propertyValues.Count > 0) { string typeName = modelType.Prediction.Name; switch (typeName) { case "Color": { foreach (dynamic color in jsonObject.data.colors) { data.Add(Color.Deserialize(color)); } break; } case "Concept": { foreach (dynamic concept in jsonObject.data.concepts) { data.Add(Concept.Deserialize(concept)); } break; } case "Demographics": { foreach (dynamic demographics in jsonObject.data.regions) { data.Add(Demographics.Deserialize(demographics)); } break; } case "Embedding": { foreach (dynamic embedding in jsonObject.data.embeddings) { data.Add(Embedding.Deserialize(embedding)); } break; } case "FaceConcepts": { foreach (dynamic faceConcepts in jsonObject.data.regions) { data.Add(FaceConcepts.Deserialize(faceConcepts)); } break; } case "FaceDetection": { foreach (dynamic faceDetection in jsonObject.data.regions) { data.Add(FaceDetection.Deserialize(faceDetection)); } break; } case "FaceEmbedding": { foreach (dynamic faceEmbedding in jsonObject.data.regions) { data.Add(FaceEmbedding.Deserialize(faceEmbedding)); } break; } case "Focus": { foreach (dynamic focus in jsonObject.data.regions) { data.Add(Focus.Deserialize(focus, (decimal)jsonObject.data.focus.value)); } break; } case "Frame": { foreach (dynamic frame in jsonObject.data.frames) { data.Add(Frame.Deserialize(frame)); } break; } case "Logo": { foreach (dynamic logo in jsonObject.data.regions) { data.Add(Logo.Deserialize(logo)); } break; } default: { throw new ClarifaiException( string.Format("Unknown output type `{0}`", typeName)); } } } return(data); }
/// <summary> /// Prepares application components /// </summary> private static void PrepareApplication() { menu = new Menu(); logo = new Logo(ConsoleColor.Yellow); }
// Get nbr Produits par logo public int GetProductsNbrByLogo(Logo logo) { return(logo.produits.Count); }
void OnDestroy() { if (inst == this) { inst = null; } }
/// <summary> /// Devo gestire le correzioni complicate /// </summary> /// <param name="immaginePartenza"></param> /// <param name="correzioni"></param> /// <returns></returns> private IImmagine rigeneraImmagineConCorrezioniComplicate(IImmagine immaginePartenza, CorrezioniList correzioni, IdrataTarget qualeTarget) { double wwDest = 0, hhDest = 0; BitmapSource bmpFoto = null; // Questa è la foto BitmapSource bmpMaschera = null; // Questa è la maschera (eventuale) bmpFoto = ((ImmagineWic)immaginePartenza).bitmapSource; // ::: Per prima cosa calcolo la dimensione che deve avere l'immagine di uscita (il canvas) // Verifico quindi se c'è una maschera. In tal caso comanda lei Imaging.Correzioni.Mascheratura mascheratura = (Imaging.Correzioni.Mascheratura)correzioni.FirstOrDefault(c => c is Imaging.Correzioni.Mascheratura); // La mascheratura potrebbe essere anche indicata come orientabile if (mascheratura == null) { Imaging.Correzioni.MascheraturaOrientabile mascheraturaOrientabile = (Imaging.Correzioni.MascheraturaOrientabile)correzioni.FirstOrDefault(c => c is Imaging.Correzioni.MascheraturaOrientabile); if (mascheraturaOrientabile != null) { // Ora estraggo la mascheratura giusta per questa foto if (immaginePartenza.orientamento == Orientamento.Verticale) { mascheratura = mascheraturaOrientabile.mascheraturaV; } if (immaginePartenza.orientamento == Orientamento.Orizzontale) { mascheratura = mascheraturaOrientabile.mascheraturaH; } } } // // Ora che ho scoperto se esiste una mascheratura, la applico // if (mascheratura != null) { ImmagineWic immagineMaschera = new ImmagineWic(Path.Combine(getCartellaMaschera(FiltroMask.MskSingole), mascheratura.nome)); bmpMaschera = immagineMaschera.bitmapSource; // Carico la maschera per avere le dimensioni reali definitive if (qualeTarget == IdrataTarget.Provino) { IImmagine imgMascheraPiccola = gestoreImmaginiSrv.creaProvino(immagineMaschera); bmpMaschera = ((ImmagineWic)imgMascheraPiccola).bitmapSource; } wwDest = bmpMaschera.PixelWidth; hhDest = bmpMaschera.PixelHeight; } else { // Cerco di intercettare un eventuale rotazione del quadro (non della foto) Zoom zzz = (Zoom)correzioni.FirstOrDefault(c => c is Zoom); bool rovesciare = zzz != null ? zzz.quadroRuotato : false; if (rovesciare) { wwDest = bmpFoto.PixelHeight; hhDest = bmpFoto.PixelWidth; } else { wwDest = bmpFoto.PixelWidth; hhDest = bmpFoto.PixelHeight; } } // ::: Il canvas Canvas canvas = new Canvas(); canvas.Background = new SolidColorBrush(Colors.White); canvas.Width = wwDest; canvas.Height = hhDest; canvas.HorizontalAlignment = HorizontalAlignment.Left; canvas.VerticalAlignment = VerticalAlignment.Top; #region Correzioni // ::: Gestisco le correzioni TransformGroup traGroup = new TransformGroup(); IList <ShaderEffect> effetti = null; // bool quadroRuotato = false; foreach (Correzione correzione in correzioni) { Correttore correttore = gestoreImmaginiSrv.getCorrettore(correzione); if (correttore.CanConvertTo(typeof(Transform))) { // ::: Trasformazioni Transform trasformazione = (Transform)correttore.ConvertTo(correzione, typeof(Transform)); // La trasformazione di spostamento, (Trasla) fa una eccezione perché dipende dalla grandezza del target. // Devo sistemarla al volo if (trasformazione is TranslateTransform) { TranslateTransform tt = (TranslateTransform)trasformazione; // TODO riproporzionare TranslateTransform tt2 = new TranslateTransform(); // Devo riproporzionare X e Y alla dimensione giusta finale. // posx:300=x:finalW -> x = posx * finalW / 300 tt2.X = ((TranslateTransform)tt).X * canvas.Width / ((Trasla)correzione).rifW; tt2.Y = ((TranslateTransform)tt).Y * canvas.Height / ((Trasla)correzione).rifH; traGroup.Children.Add(tt2); } else { traGroup.Children.Add(trasformazione); } } else if (correttore.CanConvertTo(typeof(ShaderEffectBase))) { // ::: Effetti li sommo poi li faccio tutti in una volta per essere più veloce if (effetti == null) { effetti = new List <ShaderEffect>(); } effetti.Add((ShaderEffect)correttore.ConvertTo(correzione, typeof(ShaderEffectBase))); } } #endregion Correzioni if (effetti != null && effetti.Count > 0) { bmpFoto = EffectsUtil.RenderImageWithEffectsToBitmap(bmpFoto, effetti); } // ::: La foto Image fotona = new Image(); fotona.BeginInit(); fotona.Source = bmpFoto; // bmpFoto; fotona.Stretch = Stretch.Uniform; fotona.HorizontalAlignment = HorizontalAlignment.Center; fotona.VerticalAlignment = VerticalAlignment.Center; fotona.Width = wwDest; fotona.Height = hhDest; fotona.EndInit(); // Assegno tutte le trasformazioni if (traGroup != null && traGroup.Children.Count > 0) { fotona.RenderTransform = traGroup; fotona.RenderTransformOrigin = new Point(0.5, 0.5); // centrate } canvas.Children.Add(fotona); // ::: La Maschera - per concludere, aggiungo anche la maschera che deve ricoprire tutto. Image imageMaschera; if (bmpMaschera != null) { imageMaschera = new Image(); imageMaschera.BeginInit(); imageMaschera.Stretch = Stretch.Uniform; imageMaschera.HorizontalAlignment = HorizontalAlignment.Left; imageMaschera.VerticalAlignment = VerticalAlignment.Top; imageMaschera.Source = bmpMaschera; imageMaschera.Width = wwDest; imageMaschera.Height = hhDest; imageMaschera.EndInit(); canvas.Children.Add(imageMaschera); } // Devo "Arrangiare" il canvas altrimenti non ha dimensione (e la foto viene nera) var size = new Size(wwDest, hhDest); canvas.Measure(size); canvas.Arrange(new Rect(size)); IImmagine immagineMod = null; // Creo la bitmap di ritorno RenderTargetBitmap rtb = new RenderTargetBitmap((int)canvas.Width, (int)canvas.Height, 96d, 96d, PixelFormats.Pbgra32); rtb.Render(canvas); if (rtb.CanFreeze) { rtb.Freeze(); } immagineMod = new ImmagineWic(rtb); // Come penultima cosa, mi rimane da gestire le Scritte (in realtà una sola) foreach (var scritta in correzioni.OfType <Scritta>()) { Correttore correttore = gestoreImmaginiSrv.getCorrettore(scritta); immagineMod = correttore.applica(immagineMod, scritta); } // Per ultima cosa, mi rimane fuori un evenuale logo ... Logo correzioneLogo = (Logo)correzioni.FirstOrDefault(c => c is Logo); if (correzioneLogo != null) { Correttore correttore = gestoreImmaginiSrv.getCorrettore(correzioneLogo); immagineMod = correttore.applica(immagineMod, correzioneLogo); } // Questa forzatura anche se filosoficamente non è bella, ma mi serve per essere più veloce a creare le correzioni complesse sulla foto da stampare. // .. oppure una eventuale area di rispetto (solo sul provino) if (qualeTarget == IdrataTarget.Provino) { AreaRispetto correzioneAreaRispetto = (AreaRispetto)correzioni.FirstOrDefault(c => c is AreaRispetto); if (correzioneAreaRispetto != null) { Correttore correttore = gestoreImmaginiSrv.getCorrettore(correzioneAreaRispetto); immagineMod = correttore.applica(immagineMod, correzioneAreaRispetto); } } return(immagineMod); }
public void ClickSoftuniBlogButton() { Logo.Click(); }
public async Task <ActionResult> ActualizarLogo(IFormCollection formdata) { var response = new ResponseBase(); var logo = new Logo(); List <string> fileExtension = new List <string>() { ".png", ".jpg", "jpeg" }; try { logo.idLogo = int.Parse(formdata["idLogo"]); logo.idEmpresa = int.Parse(formdata["idEmpresa"]); var files = HttpContext.Request.Form.Files; foreach (var file in files) { var filename = file.FileName; var ext = Path.GetExtension(filename); var buffer = file.Length; double mb = (buffer / 1024f) / 1024f; if (mb > 20) { response.success = false; response.message = "tamaño de archivo demasiado grande"; return(StatusCode(500, response)); } if (!fileExtension.Contains(ext)) { response.success = false; response.message = "extension de archivo no permitida"; return(StatusCode(500, response)); } if (file.Length > 0) { var filee = Path.Combine(environment.ContentRootPath); var carpeta = filee + "\\" + "Content" + "\\" + "empresa" + "\\" + logo.idEmpresa; var filePath = filee + "\\" + "Content" + "\\" + "empresa" + "\\" + logo.idEmpresa + "\\" + "logo" + ext; var ruta = "Content" + "\\" + "empresa" + "\\" + logo.idEmpresa + "\\" + "logo" + ext; logo.imagen = "logo" + ext; logo.url = ruta; if (!Directory.Exists(carpeta)) { Directory.CreateDirectory(carpeta); } using (var stream = System.IO.File.Create(filePath)) { await file.CopyToAsync(stream); response = await this.empresa.actualizarLogo(logo); if (response.success == false) { return(StatusCode(403, response)); } } } } } catch (Exception ex) { response.success = false; response.message = ex.Message; } return(Ok(response)); }
public void NavigateToAndClickSoftUniBlogButton() { NavigateTo(); Logo.Click(); }
public async Task DisposeAsync() { await Logo.DisposeAsync().ConfigureAwait(false); LogoHardwareMock.Dispose(); }
void Update() { if (!controller.manager.canInteract) { return; } if (gameObject.activeSelf) { Ray ray = mainCamera.ScreenPointToRay(Input.mousePosition); RaycastHit[] hits = Physics.RaycastAll(ray); bool createNewBuildingButtonHit = false; bool mouseClickRegistered = false; bool mouseClickedOnActiveInputField = false; foreach (RaycastHit hit in hits) { //print(hit.transform.name); bool hitSmallButton = hit.transform.name.Equals(createNewBuildingButton.name); bool hitBigButton = hit.transform.name.Equals(createNewBuildingExpandedButton.name); if ((hitSmallButton || hitBigButton) && !creatingNewBuilding && !loadingDifferentBuilding) { if (hitSmallButton) { //saveGamesUI_createNewSavegamesExpandedButton.MouseOver(); } MouseOverCreateNewBuildingButton(); createNewBuildingButtonHit = true; if (Input.GetMouseButtonUp(0)) { ViewingCompanyOffScreen(); CreateNewBuildingOnScreen(); //controller.StartCreatingNewCompany(); //createNewBuildingExpandedButton.OffScreen(); mouseClickRegistered = true; } } else if (hit.transform.name.Equals(goBackButton.name)) { if (Input.GetMouseButtonUp(0)) { if (choosingNewBuildingLogo) { ChooseLogoUIOffScreen(); CreateNewBuildingOnScreen(); } else if (creatingNewBuilding) { CancelCreatingNewBuilding(); } else if (loadingDifferentBuilding) { LoadDifferentBuildingUIOffScreen(); int buildingNumberToLoad = 0; if (currentDispensary != null) { buildingNumberToLoad = currentDispensary.buildingNumber; ViewingCompanyOnScreen(currentDispensary.dispensaryNumber, buildingNumberToLoad); } else if (currentSupplier != null) { buildingNumberToLoad = currentSupplier.buildingNumber; ViewingCompanyOnScreen(currentSupplier.supplierNumber, buildingNumberToLoad); } else { ViewingCompanyOnScreen(0, 0); } } else { controller.CancelViewingCompany(); } mouseClickRegistered = true; } } else if (hit.transform.name.Equals(loadDifferentBuildingButton.name)) { if (Input.GetMouseButtonUp(0)) { ViewingCompanyOffScreen(); LoadDifferentBuildingUIOnScreen(); // Change UI to show list of dispensaries and grow ops for this company mouseClickRegistered = true; } } else if (hit.transform.name.Equals(loadBuildingButton.name)) { if (Input.GetMouseButtonUp(0)) { LoadDispensary(); mouseClickRegistered = true; } } else if (hit.transform.name.Equals(newBuildingNameInputField.name)) { if (Input.GetMouseButtonUp(0)) { ActivateNewBuildingNameInputField(); mouseClickRegistered = true; if (newBuildingNameInputFieldActive) { mouseClickedOnActiveInputField = true; } } } else if (hit.transform.name.Equals(finishCreatingNewBuildingButton.name)) { if (Input.GetMouseButtonUp(0)) { FinishCreatingNewBuilding(); mouseClickRegistered = true; } } else if (hit.transform.name.Equals(newBuilding_dispensaryButton.name)) { if (Input.GetMouseButtonUp(0)) { dispensaryToggledOn = true; mouseClickRegistered = true; } } else if (hit.transform.name.Equals(newBuilding_supplierButton.name)) { if (Input.GetMouseButtonUp(0)) { dispensaryToggledOn = false; mouseClickRegistered = true; } } else if (hit.transform.tag == "DispensaryButton") { if (Input.GetMouseButtonUp(0)) { currentDispensary = null; currentSupplier = null; Dispensary_s dispensaryToLoad = currentCompany.GetDispensary(hit.transform.name); currentDispensary = dispensaryToLoad; currentSupplier = null; print(currentDispensary.dispensaryName); LoadDifferentBuildingUIOffScreen(); print("Dispensary number clicked on: " + currentDispensary.dispensaryNumber); ViewingCompanyOnScreen(currentDispensary.dispensaryNumber, currentDispensary.buildingNumber); mouseClickRegistered = true; } } else if (hit.transform.tag == "SupplierButton") { if (Input.GetMouseButtonUp(0)) { currentDispensary = null; currentSupplier = null; Supplier_s supplierToLoad = currentCompany.GetSupplier(hit.transform.name); currentDispensary = null; currentSupplier = supplierToLoad; print(currentSupplier.supplierName); LoadDifferentBuildingUIOffScreen(); print("Supplier number clicked on: " + currentSupplier.supplierNumber); ViewingCompanyOnScreen(currentSupplier.supplierNumber, currentSupplier.buildingNumber); mouseClickRegistered = true; } } else if (hit.transform.name.Equals(newBuildingChooseLogoButton.name)) { if (Input.GetMouseButtonUp(0)) { CreateNewBuildingOffScreen(); ChooseLogoUIOnScreen(); mouseClickRegistered = true; } } else if (hit.transform.name.Equals(right_chooseLogoButton.name)) { if (Input.GetMouseButtonUp(0)) { if (currentlySelectedDisplayedLogo != null) { NewBuildingChooseLogo(currentlySelectedDisplayedLogo.logo.ID); ChooseLogoButtonsPanelOffScreen(); ChooseLogoUIOffScreen(); CreateNewBuildingOnScreen(); } mouseClickRegistered = true; } } else if (hit.transform.name.Equals(right_cancelChoosingLogoButton.name)) { if (Input.GetMouseButtonUp(0)) { mouseClickRegistered = true; ChooseLogoButtonsPanelOffScreen(); } } else if (hit.transform.name.Equals(chooseLogoRightArrow.name)) { if (Input.GetMouseButtonUp(0)) { ChooseLogo_GoRight(); mouseClickRegistered = true; } } else if (hit.transform.name.Equals(chooseLogoLeftArrow.name)) { if (Input.GetMouseButtonUp(0)) { ChooseLogo_GoLeft(); mouseClickRegistered = true; } } else if (hit.transform.tag == "LogoDisplayButton") { if (Input.GetMouseButtonUp(0)) { string[] logoNameSplit = hit.transform.name.Split(' '); int logoIndex = -1; if (int.TryParse(logoNameSplit[1], out logoIndex)) { Logo thisLogo = controller.manager.db.GetLogo(logoIndex); foreach (DisplayedLogo logo in logosBeingDisplayed) { if (logo.logo.ID == thisLogo.ID) { if (chooseLogoButtonsPanelOnScreen) { StartCoroutine(ChooseLogoButtonsPanelRefresh(logo)); } else { ChooseLogoButtonsPanelOnScreen(logo); } } } } mouseClickRegistered = true; } } if (mouseClickRegistered && anyInputFieldActive && !mouseClickedOnActiveInputField) { DeactivateAllInputFields(); } } if (!createNewBuildingButtonHit) { MouseLeftCreateNewBuildingButton(); } } if (dispensaryToggledOn) { newBuildingNameInputFieldTitleText.text = "Dispensary Name"; newBuilding_dispensaryButton.SetInactive(); newBuilding_supplierButton.SetActive(); } else { newBuildingNameInputFieldTitleText.text = "Supplier Name"; newBuilding_supplierButton.SetInactive(); newBuilding_dispensaryButton.SetActive(); } }
private void SetUpTestData() { chartId = (long)DataManager.GetDataManager().CreateInstance<User>(_userId).Add(RandomDataGenerator.GenerateChart()).Id; _mockLogo = new Logo() { ChartId = chartId, Enabled = true, Height = 100, Width = 100 }; }