private void btn_add_mbid_Click(object sender, EventArgs e) { DBOperation bf = new DBOperation(); MainBoard mb_data = new MainBoard(this.MBoard_ID, tbx_mb_num.Text, tbx_Company.Text); if (bf.Find_MainBoard_Data(mb_data) == 1) { bf.Updata_MainBoard_Data(mb_data); //textBox1.Text += "\r\n access_db have data\r\n!"; //if (bf.Updata_IcData(ic_data) == 1) // textBox1.Text += "\r\n access_db have up data ok\r\n!"; //else // textBox1.Text += "\r\n access_db updata error\r\n!"; } else { if (bf.Add_MainBoard_Data(mb_data) == 1) { MessageBox.Show("add main board id ok!"); } else { MessageBox.Show("add main board id error !"); } } }
private void button19_Click(object sender, EventArgs e) { MainBoard dominik2 = new MainBoard(textBox2.Text); dominik2.Show(); Visible = false; }
//Returns the number of enemies visible within the player's view. Just realised includes dead ones, so you could spawnproof an area by leaving corpses. OOPS! private static int VisibleEnemies() { int num = 0; var coordList = new List <Coordinate>(); var nearby = new List <Entity>(); for (int i = -5; i < 6; i++) { for (int j = -5; j < 6; j++) { var coord = new Coordinate(Player.position.x + i, Player.position.y + j); //For each coordinate in the view if (MainBoard.GetFromBoard(coord) != null) //If there are entities there { foreach (Entity ent in MainBoard.GetFromBoard(coord)) //Add each entity to the nearby list { nearby.Add(ent); } } } } if (nearby.Exists(x => x.GetType().IsSubclassOf(typeof(Enemy)))) //If there is one or more enemy in the nearby list { num += nearby.FindAll(x => x.GetType().IsSubclassOf(typeof(Enemy))).Count; //Count them and return that number } return(num); }
public static ConnectionLimitationSettings Load(string path) { try { if (File.Exists(path)) { IFormatter formatter = new BinaryFormatter(); using (Stream stream = new FileStream(path, FileMode.Open, FileAccess.Read)) { ConnectionLimitationSettings cls = (ConnectionLimitationSettings)formatter.Deserialize(stream); stream.Close(); MainBoard.WriteLine("Global connection preferences loaded!", System.Drawing.Color.Green); return(cls); } } MainBoard.WriteLine("No global connection preferences file exist. Creating default ones."); return(new ConnectionLimitationSettings()); } catch (Exception ex) { MainBoard.WriteLine("ERROR - Could not open file: " + ex.Message, System.Drawing.Color.Red); return(null); } }
public Books(MainBoard board, User user) // Bring user so that only bosses can control the book count { InitializeComponent(); Board = board; User = user; AuthorsIsOpen = false; // If the boss enters, enable the change on number of books, and deleting books... if (!User.IsBoss) { LblBookCount.Visible = false; NumCount.Visible = false; GrbCrud.Height = 327; DgvBooks.Height = 325; } WhatToShow = new string[] { "Hamısı", "Mövcud olanlar", "Mövcud olmayanlar" }; FillCmbWhatToShow(); FillDgvBooks(); FillCmbAuthors(); FillCmbFindBook(); }
public EnvironmentViewModel(MainBoard mainBoard) { _mainBoard = mainBoard; // DispatcherTimer setup dispatcherTimer = new DispatcherTimer(); dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); UpgrateFre = 1; }
public StopReservation(MainBoard mainBoard, User user, int reservationId) { InitializeComponent(); ReservationId = reservationId; User = user; MainBoard = mainBoard; Reservation = db.Reservations.Find(ReservationId); FillCmbBookStatusAndNumPenalty(); }
public ControlCenterViewModel(MainBoard mainBoard) { _mainBoard = mainBoard; startButtonContent = "开始"; playBroadcastButtonContent = "播放警报"; player = new SoundPlayer(); player.SoundLocation = "../../Sounds/redalert.wav"; playing = false; }
public Core.Models.MainBoard LoadById(int Id) { MainBoard mainboard = null; using (var db = new DBContext()) { mainboard = db.MainBoards.FirstOrDefault(x => x.Id == Id); } return(mainboard); }
private void MoveHelper(object param, bool isGoBackOrForth, Direction backOrForth) { try { var num = Convert.ToInt32(param); if (MainBoard.IsAllowSwitch(num)) { MainBoard.Switch(num); } else { return; } HintTileProp = -1; if (!isGoBackOrForth) { _isHint = true; if (_breadCrumbsList.Count > _crumb) { _breadCrumbsList.RemoveRange(_crumb, _breadCrumbsList.Count - _crumb); } _breadCrumbsList.Add(num); } switch (backOrForth) { case Direction.BACK: _crumb--; TileClickEvent_EA_PUB(--_moveCnt); break; case Direction.FORTH: _crumb++; TileClickEvent_EA_PUB(++_moveCnt); break; } } catch (Exception) { } if (IsGameOver()) { PublishIsGameOver(true); } else { HintMoveCommand.RaiseCanExecuteChanged(); GoForwardCommand.RaiseCanExecuteChanged(); GoBackCommand.RaiseCanExecuteChanged(); MoveCommand.RaiseCanExecuteChanged(); } }
public MoveResult ProcessAMove(string move, Player currentPlayer) { try { var cells = move.Trim().Split(' '); if (cells.Length != 2) { throw new IndexOutOfRangeException(); } //Parse and Validate starting cell var(x, y) = ParseCellNum(cells[0]); From = MainBoard.GetCell(x, y); if (From != null && !From.IsOccupied()) { return(MoveResult.EmptyBeginningCell); } if (From != null && From.IsOccupied() && !From.Piece.IsSameSide(currentPlayer)) { return(MoveResult.WrongBeginningCell); } //Parse and Validate destination cell (x, y) = ParseCellNum(cells[1]); To = MainBoard.GetCell(x, y); if (To != null && To.IsOccupied() && To.Piece.IsSameSide(currentPlayer)) { return(MoveResult.WrongDestinationCell); } var possibleMoves = GetPossibleMoves(From); if (!possibleMoves.Contains(To)) { return(MoveResult.ImpossibleMove); } return(PerformAMove()); } catch { return(MoveResult.WrongInputFormat); } }
public Users(MainBoard board, User enteredUser) { InitializeComponent(); Board = board; EnteredUser = enteredUser; ShowPassword = false; CmbItems = new string[] { "Hamısı", "İdarəçilər", "İdarəçi olmayanlar" }; FillCmbUsersShown(); FillDgvUsers(); }
public bool InsertMainboard(MainBoard Mainboard) { try { using (var db = new DBContext()) { db.MainBoards.Add(Mainboard); db.SaveChanges(); ActivityLogFunction.WriteActivity("Insert Mainboard"); return(true); } } catch (Exception e) { } return(false); }
/// <summary> /// 组合模式 /// </summary> public static void CompositePatternMethods() { var mainFrames = new MainFrames("电脑主机"); Console.WriteLine("开始构建电脑主机"); var cpu = new CPU("CPU"); var mainBoard = new MainBoard("主板"); mainFrames.Add(cpu); mainFrames.Add(mainBoard); mainFrames.Make(); Console.WriteLine("电脑主机构建完成"); }
public Clients(User user, MainBoard board) { InitializeComponent(); User = user; Board = board; CmbItems = new string[] { "Hamısı", "Borclular", "Borclu olmayanlar" }; FillDgvClients(); FillCmbShowClients(); CultureInfo = new System.Globalization.CultureInfo("az-AZ"); }
public DebugViewModel(MainBoard mainBoard, SettingViewModel settings) { if (mainBoard == null) throw new ArgumentNullException("mainBoard"); if (settings == null) throw new ArgumentNullException("settings"); base.DisplayName = Resources.DebugViewModel_Displayname; _settings = settings; _mainBoard = mainBoard; commands = LoadCommands("Data/MainBoardCommand.xml"); ConnectButtonContent = "连接"; }
public void SaveAs(string path) { try { IFormatter formatter = new BinaryFormatter(); using (Stream stream = new FileStream(path, FileMode.Create, FileAccess.Write)) { formatter.Serialize(stream, this); stream.Close(); } } catch (Exception ex) { MainBoard.WriteLine("ERROR - Could not save file: " + ex.Message, System.Drawing.Color.Red); } }
protected void btnRun_Click(object sender, EventArgs e) { switch (ddlDemoList.SelectedValue.ToString()) { case "1": StockData stk = new StockData(); MainBoard mb = new MainBoard(stk); SubBoard1 sb1 = new SubBoard1(stk); SubBoard2 sb2 = new SubBoard2(stk); stk.setMeasurement("STK001", 200, 49.6); lblResult.Text = stk.observerResult(); break; } }
private List <Cell> GetPossibleMoves(Cell Start) { var possibleMoves = new List <Cell>(); if (Start?.Piece == null) { return(possibleMoves); } var x = Start.X; var y = Start.Y; var player = Start.Piece.Player; var isContinouos = Start.Piece.IsContinuous; foreach (var direction in Start.Piece.MoveDirections.Where(md => !md.FirstMove || (md.FirstMove && IsFirstMove(Start.Piece)))) { for (var i = 1; i < (isContinouos ? MainBoard.Rank : 2); i++) { var cell = MainBoard.GetCell(x + direction.X * i, y + direction.Y * i); if (cell == null) { break; } if (cell.IsOccupied()) { if (!cell.Piece.IsSameSide(player)) { possibleMoves.Add(cell); } break; } if (!direction.OnlyWithAttack) { possibleMoves.Add(cell); } } } return(possibleMoves); }
private void BtnLogin_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(TxtUsername.Text) || string.IsNullOrEmpty(TxtPassword.Text)) { MessageBox.Show("Boş xana buraxmayın"); return; } if (!db.Users.Any(u => u.Username == TxtUsername.Text && u.Password == TxtPassword.Text)) { MessageBox.Show("İstifadəçi adı və ya şifrə düzgün deyil!"); PicLogin.Image = Resources.enter; return; } else { User User = db.Users.First(u => u.Username == TxtUsername.Text); MainBoard form = new MainBoard(User); form.Show(); this.Hide(); } }
//Creates a randomly generated enemy public static void EnemyMake(Coordinate pos) { var EnemyTypes = new List <Type>(); //Will store potential enemy types Type[] types = Assembly.GetExecutingAssembly().GetTypes(); //Get thetypes from the current assembly foreach (Type type in types) { if (type.IsSubclassOf(typeof(Enemy))) { EnemyTypes.Add(type); //Add the enemies to the list } } var r = new Random(); string entType = EnemyTypes[r.Next(EnemyTypes.Count)].Name; //Get the name of a random enemy type string name; do { EntityNum++; name = entType + " " + EntityNum.ToString(); //Generate a unique name from the type + the incrementing entitynum }while (GetEntity(name) != null); char icon = (char)547; //Set the icon int drawPriority = 99; //Set the drawpriority Inventory inventory = GenerateInv(); //Set the inventory to a randomly generated on int hp = 5 + r.Next(0, 20); //Set a random hp between 5 and 25 int[] stats = { hp, hp, r.Next(1), 1 + r.Next(2), -1 }; //Set some random stats string description = "A fearsome enemy!"; //Set a generic description dynamic enemy = EntityCreate(entType, name, pos, icon, drawPriority, inventory, stats, description); //Create the enemy from the data GoldMerge(enemy); //Merge any multiple gold items in the enemy's inventory MainBoard.AddToBoard(enemy); //Add the enemy to the board. }
//Attempt to move the player public static void Move(MoveCommand direction) { InventoryView = false; //Disable inventory view MapDraw = true; //Request a fresh map draw //Get a list of the entities at the goal position List <Entity> goalSquareEntities = MainBoard.GetFromBoard(new Coordinate(Player.position.x + direction.x, Player.position.y + direction.y)); //If there is something impassable there, fail the move if (goalSquareEntities != null && goalSquareEntities.Exists(x => x.Passable == false)) { WriteLine("Can't walk there!"); return; } //If you fail a combat check (can't beat an aggressor in the square), fail the move. if (!CombatCheck(goalSquareEntities)) { return; } //Remove the player from its current coordinates, update the position, readd it to the coordinate map. MainBoard.entityPos[Player.position].Remove(Player); Player.position.x += direction.x; Player.position.y += direction.y; MainBoard.AddToBoard(Player); //Call a cleanup function to remove any dead entities and their inventories if the inventories are empty, and clear their //coordinates from the map if there are no more entities there. CleanUp(MainBoard); //Attempt to generate monsters, likelihood increases with distance from (0,0) (Bugged to not do it in the right way) MonsterGen(direction, Player.DistanceFromCenter()); //List the entities you see in your new square foreach (Entity ent in EntityManager.GetLocalEntities(Player, MainBoard).FindAll(x => (x.Name != "Player"))) { WriteLine("You see a " + ent.Name + ent.Status + "\b"); } }
/// <summary> /// Run algorithm /// </summary> private void RunButton_Click(object sender, EventArgs e) { //Convert WinForms to Piece[,] Piece[,] lab = new Piece[MainBoard.RowCount, MainBoard.ColumnCount]; for (int i = 0; i < MainBoard.RowCount; i++) { for (int j = 0; j < MainBoard.ColumnCount; j++) { Label l = (Label)MainBoard.GetControlFromPosition(j, i); BlockData bd = (BlockData)l.Tag; lab[i, j] = bd.generatePiece(); } } //Set and run Solver sol = new Solver(lab); sol.Solve(); statusLabel.Text = "Running..."; //Show MessageBox.Show(sol.ToString()); statusLabel.Text = "Done"; }
public int Delete_MainBoard_Data(MainBoard mbData) { int intFalg = 0; try { oledCon = DBHelper.getCon(); oledCon.Open(); string strcmd = "delete from tb_MainBoard where MainBoard_ID='" + mbData.Id + "'"; OleDbCommand oledCmd = new OleDbCommand(strcmd, oledCon); if (oledCmd.ExecuteNonQuery() != 0) { intFalg = 1;//成功 } return(intFalg); } catch (Exception ee) { return(intFalg); } }
public bool UpdateMainboard(MainBoard Mainboard) { if (Mainboard == null) { return(false); } try { using (var db = new DBContext()) { int id = Mainboard.Id; var temp = db.MainBoards.FirstOrDefault(x => x.Id == id); PropertyCopier <Core.Models.MainBoard, Core.Models.MainBoard> .Copy(Mainboard, temp); db.SaveChanges(); ActivityLogFunction.WriteActivity("Update Mainboard"); return(true); } } catch (Exception e) { } return(false); }
public int Updata_MainBoard_Data(MainBoard mbData) { int intFalg = 0; try { oledCon = DBHelper.getCon(); oledCon.Open(); string strAdd = "update tb_MainBoard "; strAdd += "set MainBoard_Num='" + mbData.Number + "'" + "set 单位名称='" + mbData.CompanyName + "'" + "where MainBoard_ID='" + mbData.Id + "'"; OleDbCommand oledCmd = new OleDbCommand(strAdd, oledCon); if (oledCmd.ExecuteNonQuery() != 0) { intFalg = 1;//添加成功 } return(intFalg); } catch (Exception ee) { return(intFalg); } }
public Reservations(MainBoard mainBoard, User user) { InitializeComponent(); User = user; MainBoard = mainBoard; WhatToSearch = new string[] { "Oxucuya görə", "Kitaba görə", "Verdi", "Aldı", "Vaxta görə" }; WhichDates = new string[] { "Verilib", "Alınıb" }; ErrorColor = Color.FromArgb(255, 54, 0); SuccessColor = Color.FromArgb(234, 156, 10); FillCmbSearch(); FillDgvReservations(); TmrSetPenalties.Enabled = true; }
public int Find_MainBoard_Data(MainBoard mbData) { int intFalg = 0; try { //oledCon = data.getCon(); //oledCon.Open(); string strcmd = "select * from tb_MainBoard where MainBoard_ID='" + mbData.Id + "'"; DataBase data = new DataBase();//创建DataBase类的对象 DataSet ds = data.getDs(strcmd, "tb_MB"); if (ds.Tables[0].Rows.Count > 0) { intFalg = 1; } return(intFalg); } catch (Exception ee) { return(intFalg); } }
public int Add_MainBoard_Data(MainBoard mbData) { int intFalg = 0; try { oledCon = DBHelper.getCon(); oledCon.Open(); string strAdd = "insert into tb_MainBoard (MainBoard_ID,MainBoard_Num,单位名称)"; strAdd += "values('" + mbData.Id + "','" + mbData.Number + "','" + mbData.CompanyName + "')"; OleDbCommand oledCmd = new OleDbCommand(strAdd, oledCon); if (oledCmd.ExecuteNonQuery() != 0) { intFalg = 1;//添加成功 } return(intFalg); } catch (Exception ee) { return(intFalg); } }
void Start() { core = GameObject.FindGameObjectWithTag ("core").GetComponent<MainBoard>(); }
private Task Color1_ItemClickedAsync(EnumColorPossibilities piece) { MainBoard.SelectedColorForCurrentGuess(piece); return(Task.CompletedTask); }
public async Task AcceptAsync() { await MainBoard.SubmitGuessAsync(); }
public DebugWindowViewModel(MainBoard mainBoard) { _mainBoard = mainBoard; }
public PullParameterViewModel(MainBoard mainBoard) { _mainBoard = mainBoard; }
private void button1_Click(object sender, EventArgs e) // START { try { int.Parse(TB1.Text); int.Parse(TB2.Text); int.Parse(TB3.Text); int.Parse(TB4.Text); int.Parse(TB5.Text); int.Parse(TB6.Text); int.Parse(TB7.Text); int.Parse(TB8.Text); int.Parse(TB9.Text); int.Parse(TB10.Text); int.Parse(TB11.Text); int.Parse(TB12.Text); int.Parse(TB13.Text); int.Parse(TB14.Text); int.Parse(TB15.Text); int.Parse(TB16.Text); int.Parse(TB17.Text); int.Parse(TB18.Text); int.Parse(TB19.Text); int.Parse(TB20.Text); int.Parse(TB21.Text); int.Parse(TB22.Text); int.Parse(TB23.Text); int.Parse(TB24.Text); int.Parse(TB25.Text); int.Parse(TB26.Text); } catch { MessageBox.Show("BŁĄD - wpisane wartości muszą być liczbą"); ActiveControl.Text = "0"; return; } /* bool zmTry1 = true; * bool zmTry2 = true; * bool zmTry3 = true; * bool zmTry4 = true; * bool zmTry5 = true; * bool zmTry6 = true; * bool zmTry7 = true; * bool zmTry8 = true; * bool zmTry9 = true; * bool zmTry10 = true; * bool zmTry11 = true; * bool zmTry12 = true; * bool zmTry13 = true; * bool zmTry14 = true; * bool zmTry15 = true; * bool zmTry16 = true; * bool zmTry17 = true; * bool zmTry18 = true; * bool zmTry19 = true; * bool zmTry20 = true; * bool zmTry21 = true; * bool zmTry22 = true; * bool zmTry23 = true; * bool zmTry24 = true; * bool zmTry25 = true; * bool zmTry26 = true; * * * * bool.TryParse(TB1.Text, out zmTry1); * bool.TryParse(TB2.Text, out zmTry2); * bool.TryParse(TB3.Text, out zmTry3); * bool.TryParse(TB4.Text, out zmTry4); * bool.TryParse(TB5.Text, out zmTry5); * bool.TryParse(TB6.Text, out zmTry6); * bool.TryParse(TB7.Text, out zmTry7); * bool.TryParse(TB8.Text, out zmTry8); * bool.TryParse(TB9.Text, out zmTry9); * bool.TryParse(TB10.Text, out zmTry10); * bool.TryParse(TB11.Text, out zmTry11); * bool.TryParse(TB12.Text, out zmTry12); * bool.TryParse(TB13.Text, out zmTry13); * bool.TryParse(TB14.Text, out zmTry14); * bool.TryParse(TB15.Text, out zmTry15); * bool.TryParse(TB16.Text, out zmTry16); * bool.TryParse(TB17.Text, out zmTry17); * bool.TryParse(TB18.Text, out zmTry18); * bool.TryParse(TB19.Text, out zmTry19); * bool.TryParse(TB20.Text, out zmTry20); * bool.TryParse(TB21.Text, out zmTry21); * bool.TryParse(TB22.Text, out zmTry22); * bool.TryParse(TB23.Text, out zmTry23); * bool.TryParse(TB24.Text, out zmTry24); * bool.TryParse(TB25.Text, out zmTry25); * bool.TryParse(TB26.Text, out zmTry26); * * if (((zmTry1 && zmTry2 && zmTry3 && zmTry4 && zmTry5 && zmTry6 && zmTry7 && zmTry8 && zmTry9 && zmTry10 && zmTry11 && zmTry12 && zmTry13 && zmTry14 && zmTry15 && zmTry16 && zmTry17 && zmTry18 && zmTry19 && zmTry20 && zmTry21 && zmTry22 && zmTry23 && zmTry24 && zmTry25 && zmTry26) == true)) * { * MessageBox.Show("BŁĄD - wpisane wartości nie są liczbami całkowitymi"); * } * else * { */ Properties.Settings.Default["ZM1"] = TB1.Text; Properties.Settings.Default["ZM2"] = TB2.Text; Properties.Settings.Default["ZM3"] = TB3.Text; Properties.Settings.Default["ZM4"] = TB4.Text; Properties.Settings.Default["ZM5"] = TB5.Text; Properties.Settings.Default["ZM6"] = TB6.Text; Properties.Settings.Default["ZM7"] = TB7.Text; Properties.Settings.Default["ZM8"] = TB8.Text; Properties.Settings.Default["ZM9"] = TB9.Text; Properties.Settings.Default["ZM10"] = TB10.Text; Properties.Settings.Default["ZM11"] = TB11.Text; Properties.Settings.Default["ZM12"] = TB12.Text; Properties.Settings.Default["ZM13"] = TB13.Text; Properties.Settings.Default["ZM14"] = TB14.Text; Properties.Settings.Default["ZM15"] = TB15.Text; Properties.Settings.Default["ZM16"] = TB16.Text; Properties.Settings.Default["ZM17"] = TB17.Text; Properties.Settings.Default["ZM18"] = TB18.Text; Properties.Settings.Default["ZM19"] = TB19.Text; Properties.Settings.Default["ZM20"] = TB20.Text; Properties.Settings.Default["ZM21"] = TB21.Text; Properties.Settings.Default["ZM22"] = TB22.Text; Properties.Settings.Default["ZM23"] = TB23.Text; Properties.Settings.Default["ZM24"] = TB24.Text; Properties.Settings.Default["ZM25"] = TB25.Text; Properties.Settings.Default["ZM26"] = TB26.Text; Properties.Settings.Default.Save(); Hide(); MainBoard dominik2 = new MainBoard("TEST"); dominik2.Show(); Visible = false; }
public MainWindowViewModel(MainBoard mainBoard) { base.DisplayName = Resources.MainWindowViewModel_DisplayName; _mainBoard = mainBoard; }
// Use this for initialization void Start() { text = GetComponentInChildren<ColorCodesLetter>(); core = GameObject.FindGameObjectWithTag ("core").GetComponent<MainBoard>(); }
public ColorSettings(MainBoard mainBoard) { InitializeComponent(); MainBoard = mainBoard; SetColors(); }
public EnvirnomentWindowViewModel(MainBoard mainBoard) { _mainBoard = mainBoard; }