/// <summary> /// Updates the status of the given tracking group box. /// </summary> /// <param name="availableMethod"> /// The IsAvailable method of the tracker. /// </param> /// <param name="checkBox"> /// The checkbox to select the tracker. /// </param> /// <param name="pcbStatus"> /// The tracker status image picture box. /// </param> /// <param name="lblStatus"> /// The tracker status label. /// </param> private void SetStatus(IsAvailable availableMethod, CheckBox checkBox, PictureBox pcbStatus, Label lblStatus) { string error; switch (availableMethod(out error)) { case TrackerStatus.Available: checkBox.Enabled = true; checkBox.Enabled = true; pcbStatus.Image = Properties.Resources.Valid16; this.toolTip1.SetToolTip(pcbStatus, "Tracker is available for recording"); lblStatus.Text = "Available"; break; case TrackerStatus.None: case TrackerStatus.NotAvailable: checkBox.Enabled = false; checkBox.Checked = false; pcbStatus.Image = Properties.Resources.Error16; this.toolTip1.SetToolTip(pcbStatus, "Tracker is not available for recording"); lblStatus.Text = "Not Available"; break; case TrackerStatus.Undetermined: checkBox.Enabled = true; pcbStatus.Image = Properties.Resources.Warning16; this.toolTip1.SetToolTip(pcbStatus, "Tracker status cannot be resolved"); lblStatus.Text = "Undetermined"; break; } }
/// <summary> /// This method updates the infobar with the given tracker information. /// </summary> /// <param name="availableMethod"> /// The IsAvailable method of the tracker. /// </param> /// <param name="image"> /// The bitmap of the tracker /// </param> /// <param name="logo"> /// The bitmap of the logo /// </param> private void UpdateInfobar(IsAvailable availableMethod, Image image, Image logo) { this.pcbSelectedTrackerLogo.Image = logo; this.pcbSelectedTrackerImage.Image = image; string error; availableMethod(out error); this.lblSelectedStatus.Text = error; }
// Necessary so this class works as expected in collections. public override nuint GetNativeHash() { nuint hashValue = (ItemNameKey is null) ? 0 : (nuint)ItemNameKey.GetHashCode(); hashValue = hashValue ^ (nuint)Price.GetNativeHash(); hashValue = hashValue ^ (IconImageName is null ? 0 : (nuint)IconImageName.GetHashCode()); hashValue = hashValue ^ (nuint)IsAvailable.GetHashCode(); hashValue = hashValue ^ (nuint)IsDailySpecial.GetHashCode(); return(hashValue); }
private void backgroundWorker2_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { if (IsAvailable.Available()) { stonline.Text = "Online"; } if (!IsAvailable.Available()) { stonline.Text = "Offline"; } }
public override int GetHashCode() { int hash = 1; hash ^= prices_.GetHashCode(); if (lodgingSubtotal_ != null) { hash ^= LodgingSubtotal.GetHashCode(); } if (incidentalSubtotal_ != null) { hash ^= IncidentalSubtotal.GetHashCode(); } if (taxesSubtotal_ != null) { hash ^= TaxesSubtotal.GetHashCode(); } if (feesSubtotal_ != null) { hash ^= FeesSubtotal.GetHashCode(); } if (estimatedTotal_ != null) { hash ^= EstimatedTotal.GetHashCode(); } if (IsPriceable != false) { hash ^= IsPriceable.GetHashCode(); } if (IsAvailable != false) { hash ^= IsAvailable.GetHashCode(); } if (ViolatesMlos != false) { hash ^= ViolatesMlos.GetHashCode(); } if (ViolatesCta != false) { hash ^= ViolatesCta.GetHashCode(); } if (IsAvailableWithHoldDrop != false) { hash ^= IsAvailableWithHoldDrop.GetHashCode(); } hash ^= suppliedSubtotals_.GetHashCode(); hash ^= offers_.GetHashCode(); return(hash); }
public override string ToString() { StringBuilder strBuilder = new StringBuilder(); strBuilder.Append($"Id: {Id.ToString()},") .Append($"Author: {Author.ToString()},") .Append($"Title: {Title},") .Append($"Price: {Price.ToString()},") .Append($"Available: {IsAvailable.ToString()},") .Append($"Genre: {Genre},") .Append($"Available Books Count: {AvailableBooksCount.ToString()},") .Append($"Sold Books Count: {SoldBooksCount.ToString()},") .Append($"Total Sold Price: {TotalSoldPrice.ToString()}."); return(strBuilder.ToString()); }
public AppModel() { IsAvailable = Observable.FromEventPattern <IsAvailableChangedEventArgs>(Sensor, "IsAvailableChanged") .Select(_ => _.EventArgs.IsAvailable) .ToGetOnly(false); ColorBitmap = IsAvailable .ObserveOn(SynchronizationContext.Current) .Select(b => b ? ColorBitmapInfo.CreateBitmap() : null) .ToGetOnly(null); var colorReader = Sensor.ColorFrameSource.OpenReader(); Sensor.Open(); Observable.Interval(FramesInterval) .Select(_ => colorReader.GetColorBgraData()) .Where(d => d != null) .ObserveOn(SynchronizationContext.Current) .Subscribe(d => ColorBitmapInfo.WritePixels(ColorBitmap.Value, d)); }
public Form1() { InitializeComponent(); // textBox3.Text = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "iFilmer\\Posters\\"); if (!IsAvailable.Available()) { DialogResult dr = MessageBox.Show("Internet connection not availible", "Error", MessageBoxButtons.AbortRetryIgnore, MessageBoxIcon.Exclamation); if (dr == DialogResult.Abort) { Environment.Exit(0); } else if (dr == DialogResult.Retry) { System.Diagnostics.Process.Start(Application.ExecutablePath); Environment.Exit(0); } } else { stonline.Text = "Online"; } }
private bool isSectionAvailable(string section) { User user = Page.User as User; if (user == null || Page.Request.QueryString.Get("id") == null) { return(true); } string url = Page.Request.RawUrl.ToLower(); Planet planet = Universe.instance.getRuler(user.RulerId).getPlanet(Int32.Parse(Page.Request.QueryString["id"])); object obj = Available[section]; if (obj != null) { IsAvailable available = (IsAvailable)obj; return(available(planet)); } if (Page.Request.QueryString.Count != 0 && url.IndexOf("/planet/") != -1 && url.IndexOf("default.aspx") != -1) { string resourceType = OrionGlobals.getConfigurationValue("sectionResourceTypes", section, false); if (null == resourceType) { return(true); } if (!planet.Resources.ContainsKey(resourceType)) { return(true); } ResourceInfo info = planet.getResourceInfo(resourceType); return(info.AvailableFactories.Count > 0); } return(false); }
public ClinicalTrial(string title, decimal price, IsAvailable isavailable) : this() { this.Title = title; this.Price = price; this.IsAvailable = isavailable; }
public int getMove(GameCollection games, Moves pMoves, Moves cMoves, Moves av) { Random r = new Random(); Moves finalM = new Moves(); IsAvailable iA = new IsAvailable(av); /* * #################################################################### * #################################################################### * #################################################################### */ if (cMoves.getMoves().Length + pMoves.getMoves().Length == 0) // Console.WriteLine("### 000 ###"); { Moves z = games.toMoveMap(); for (int i = 0; i < 300; i++) { int mySelection = z.getMoves()[r.Next(z.getMoves().Length)]; if (iA.check(mySelection)) { Console.WriteLine("selected move: " + mySelection); return(mySelection); } if (i >= 299) { Console.WriteLine("giving up"); } } } /* * #################################################################### * #################################################################### * #################################################################### */ if (cMoves.getMoves().Length == 0 && pMoves.getMoves().Length == 1) // Console.WriteLine("### 001 ###"); { GameCollection mm = new GameCollection(); int theMove; theMove = pMoves.getMoves()[0]; Index myIdenx = games.getIndexGameContains(theMove); Console.WriteLine("index -> " + myIdenx); Console.WriteLine("games -> " + games); bool skip = false; for (int i = 0; i < games.getSize(); i++) { for (int j = 0; j < myIdenx.getSize(); j++) { if (i == myIdenx.getIndexArray()[j]) { skip = true; } } if (skip) { skip = false; continue; } mm.addGame(games.getGame(i)); } Console.WriteLine("selection -> " + mm); Moves z = mm.toMoveMap(); for (int i = 0; i < 300; i++) { int mySelection = z.getMoves()[r.Next(z.getMoves().Length)]; if (iA.check(mySelection)) { Console.WriteLine("selected move: " + mySelection); return(mySelection); } if (i >= 299) { Console.WriteLine("giving up"); } } } /* * #################################################################### * #################################################################### * #################################################################### */ if (cMoves.getMoves().Length + pMoves.getMoves().Length >= 3) // Console.WriteLine("### 002 ###"); { Gen lol = new Gen(); GameCollection p = new GameCollection(); GameCollection c = new GameCollection(); GameCollection playerSelection = new GameCollection(); GameCollection computerSelection = new GameCollection(); lol.combinations(pMoves.getMoves(), p); lol.combinations(cMoves.getMoves(), c); Console.WriteLine("player combination: " + p); Console.WriteLine("computer combination: " + c); // combinacoes prontas, pesquisar jogos for (int i = 0; i < p.getSize(); i++) { int myIdenx = games.getIndexGameContains(p.getGame(i).getGameArray()[0], p.getGame(i).getGameArray()[1]); if (myIdenx != -1) { playerSelection.addGame(games.getGame(myIdenx)); } } for (int i = 0; i < c.getSize(); i++) { int myIdenx = games.getIndexGameContains(c.getGame(i).getGameArray()[0], c.getGame(i).getGameArray()[1]); if (myIdenx != -1) { computerSelection.addGame(games.getGame(myIdenx)); } } Console.WriteLine("playerSelection = " + playerSelection); Console.WriteLine("computerSelection = " + computerSelection); Console.WriteLine("playerSelection.toMoveArray = " + playerSelection.toMoveArray()); Console.WriteLine("computerSelection.toMoveArray = " + computerSelection.toMoveArray()); if (computerSelection.getSize() > 0) { for (int i = 0; i < computerSelection.toMoveArray().getMoves().Length; i++) { int mySelection = computerSelection.toMoveArray().getMoves()[i]; Console.WriteLine("computer iA.check -> " + iA.check(mySelection)); Console.WriteLine("mySelection -> " + mySelection); if (iA.check(mySelection)) { return(mySelection); } } } if (playerSelection.getSize() > 0) { for (int i = 0; i < playerSelection.toMoveArray().getMoves().Length; i++) { int mySelection = playerSelection.toMoveArray().getMoves()[i]; Console.WriteLine("player iA.check -> " + iA.check(mySelection)); Console.WriteLine("mySelection -> " + mySelection); if (iA.check(mySelection)) { return(mySelection); } } } else { Console.WriteLine("foideus"); } /* * for (int i = 0; i < computerSelection.toMoveArray().getMoves().Length; i++) * { * int mySelection = computerSelection.toMoveArray().getMoves()[i]; * if (iA.check(mySelection)) * { * return mySelection; * } * } */ } Console.WriteLine("tudo errado."); /* * #################################################################### * #################################################################### * #################################################################### */ if (true) // last resort { GameCollection mm = new GameCollection(); int theMove; theMove = cMoves.getMoves()[0]; Index myIdenx = games.getIndexGameContains(theMove); Console.WriteLine("index -> " + myIdenx); Console.WriteLine("games -> " + games); for (int i = 0; i < games.getSize(); i++) { for (int j = 0; j < myIdenx.getSize(); j++) { if (i == myIdenx.getIndexArray()[j]) { mm.addGame(games.getGame(i)); } } } Console.WriteLine("selection -> " + mm); Moves z = mm.toMoveMap(); for (int i = 0; i < 300; i++) { int mySelection = z.getMoves()[r.Next(z.getMoves().Length)]; if (iA.check(mySelection)) { Console.WriteLine("selected move: " + mySelection); return(mySelection); } if (i >= 299) { Console.WriteLine("giving up"); } } } // real last resort if (true) { GameCollection mm = new GameCollection(); Console.WriteLine("Last Resort"); Console.WriteLine("Available moves -> " + av); Console.WriteLine("Games -> " + games); Console.WriteLine("cMoves -> " + cMoves); Console.WriteLine("pMoves -> " + pMoves); GameCollection gaminhoLastResourt = new GameCollection(); GameCollection pGames = new GameCollection(); for (int i = 0; i < cMoves.getMoves().Length; i++) { Index holyDog = games.getIndexGameContains(cMoves.getMoves()[i]); for (int j = 0; j < holyDog.getIndexArray().Length; j++) { gaminhoLastResourt.addGame(games.getGame(holyDog.getIndexArray()[j])); } } Console.WriteLine("gaminho -> " + gaminhoLastResourt.toMoveArray()); if (gaminhoLastResourt.getSize() > 0) { for (int i = 0; i < gaminhoLastResourt.toMoveArray().getMoves().Length; i++) { int mySelection = gaminhoLastResourt.toMoveArray().getMoves()[i]; Console.WriteLine("player iA.check -> " + iA.check(mySelection)); Console.WriteLine("mySelection -> " + mySelection); if (iA.check(mySelection)) { return(mySelection); } } } else { Console.WriteLine("foideus de novo, #semata"); } } return(-1); }
public bool addMove(int square, int player) { if (square == -1) { return(false); } IsAvailable iA = new IsAvailable(availableMoves); bool test = iA.check(square); if (test == false) { return(false); } /* * ################################################################ * ################################################################ */ if ((playerStarts && player == 1) || (!playerStarts && player == 2)) { pMoves.add(square); availableMoves.remove(square); mp.Play(); if (!testBictory()) { setStatus(Status.Computer); } } if ((playerStarts && player == 2) || (!playerStarts && player == 1)) { cMoves.add(square); availableMoves.remove(square); mp.Play(); if (!testBictory()) { setStatus(Status.Player); } } /* * ################################################################ * ################################################################ */ instance = ink.Instance() as RigidBody2D; if (player == 1) { instance.GetNode <Sprite>("Cray").Texture = player1List[rand.Next(5)]; instance.GetNode <Sprite>("Cray").Scale = new Vector2(0.3f, 0.3f); instance.GetNode <Sprite>("Cray").Position = squareToCoords(square); } else { instance.GetNode <Sprite>("Cray").Texture = player2List[rand.Next(5)]; instance.GetNode <Sprite>("Cray").Scale = new Vector2(0.25f, 0.25f); instance.GetNode <Sprite>("Cray").Position = squareToCoords(square); } AddChild(instance); squareList.Add(instance); return(true); }