本文整理汇总了C#中IView.SetVisible方法的典型用法代码示例。如果您正苦于以下问题:C# IView.SetVisible方法的具体用法?C# IView.SetVisible怎么用?C# IView.SetVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IView
的用法示例。
在下文中一共展示了IView.SetVisible方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Model
public Model()
{
conf = new Configuration();
playersWithPoints = conf.GetDictionnaryOfPlayersWithPoints();
lib = new KaartenAdapter();
calc = new PointCalculator();
controller = new Controller(this);
activeView = new OpstartMenu(this, controller);
activeView.SetVisible(true);
}
示例2: StartUpDataWasEntered
public void StartUpDataWasEntered(string name, int totalpoints, string typeOfPoints, int pointsOnPoints, int pointsOnCards, string troef)
{
errormessage = "";
//Check name
Regex r = new Regex(@"[^a-zA-Z]");
if (r.IsMatch(name)) {
//Error met naam
errormessage += "Your name contained illegal characters (most likely a space).";
}
if (name.Length == 0) {
errormessage += " You filled in an empty name.";
}
bool possible = false;
if (pointsOnPoints < 0 || pointsOnCards < 0 || totalpoints > 1000)
{
errormessage += " You typed an invalid amount.";
}
else {
possible = calc.CalculateIfPointsArePossible(totalpoints, pointsOnPoints, pointsOnCards);
}
//Error
if (!possible) {
errormessage += " The points you enter must be (max) half of your total points and you cannot have negative points entered.";
}
//Check typeOfPoints
PointTypes pt = PointTypes.POINTS;
if (typeOfPoints != null && typeOfPoints.Length > 0)
{
pt = (PointTypes)Enum.Parse(typeof(PointTypes), typeOfPoints);
}
else { //Error met PointTypesEnum
errormessage += " Your type of pointdistributor was invalid.";
}
//Check Troef
bool validTroef = false;
if (troef != null && troef.Length > 0) {
validTroef = lib.SetTroef(troef);
}
if (!validTroef) {
//Error met troef
errormessage += " Your troef was invalid.";
}
if (errormessage != "")
{
//Update view met errormessage
UpdateViews(ViewCommunicationTypes.ERROR);
}
else {
//Als playernaam nog niet bestaat, sla deze dan op met zijn punten via config
if (!playersWithPoints.ContainsKey(name)) {
conf.SetPlayerAndPoints(name, totalpoints);
}
//Set soort spel in PointCalculator en geef ook de punten mee.
calc.SoortSpel = pt;
//Zet troef als troef...
//al gedaan hierboven ^
calc.Troef = lib.GetTroef();
calc.PointsOnPoints = pointsOnPoints;
calc.PointsOnNumberOfCards = pointsOnCards;
//Maak Kaartenspel aan
//Al gedaan via constructor...
//Schud de kaarten
lib.ShakeCards();
//Maak human player
List<KaartenLib.Kaart> kaartenspeler = new List<KaartenLib.Kaart>(10);
for (int i = 0; i < 10; i++) {
kaartenspeler.Add(lib.PullTopCard());
}
lib.FlipCardsToFrontSide(ref kaartenspeler);
humanPlayer = new Deelnemer(name, kaartenspeler, totalpoints);
//Maak computer player
List<KaartenLib.Kaart> kaartencomp = new List<KaartenLib.Kaart>(10);
for (int i = 0; i < 10; i++)
{
kaartencomp.Add(lib.PullTopCard());
}
computerPlayer = new Deelnemer("computer", kaartencomp, 1000);
//Maak de computerbrain en geef jezelf en de computer mee
brain = new ComputerBrain(lib.GetTroef(), computerPlayer, pt);
//Maak nieuwe View aan.
System.Windows.Forms.Form f = (System.Windows.Forms.Form)activeView;
f.Close();
f.Dispose();
activeView = new Game(this, controller);
activeView.SetVisible(true);
}
}