public override void AddUI(Grid grid) { if (Config != null && Config.ShownAtRunTime) { #region DateTimePicker dp = new DateTimePicker() { Value = value.Value }; dp.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1); dp.SetValue(Grid.ColumnProperty, 1); dp.SetValue(ToolTipService.ToolTipProperty, Config.ToolTip); grid.Children.Add(dp); dp.ValueChanged += (a, b) => { Value = new GPDate(Config.Name, dp.Value); GPDate date = Value as GPDate; // Assign "universal" date format that works for all locales with hours in military format so that it // does not require AM/PM which does not work in asian languages. This is a temporary fix until something // more permanent can be done in the Silverlight API. if (date != null) { date.Format = "M/d/yyyy HH:mm:ss"; } RaiseCanExecuteChanged(); }; #endregion } }
public override void AddUI(Grid grid) { if (Config != null && Config.ShownAtRunTime) { #region DateTimePicker dp = new DateTimePicker() { Value = value.Value }; dp.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1); dp.SetValue(Grid.ColumnProperty, 1); dp.SetValue(ToolTipService.ToolTipProperty, Config.ToolTip); grid.Children.Add(dp); dp.ValueChanged += (a, b) => { Value = new GPDate(Config.Name, dp.Value); GPDate date = Value as GPDate; // Assign "universal" date format that works for all locales with hours in military format so that it // does not require AM/PM which does not work in asian languages. This is a temporary fix until something // more permanent can be done in the Silverlight API. if (date != null) date.Format = "M/d/yyyy HH:mm:ss"; RaiseCanExecuteChanged(); }; #endregion } }
public static string ParameterToDisplayString(GPParameterType type, GPParameter param) { if (param == null) { return(string.Empty); } switch (type) { case GPParameterType.Date: GPDate date = param as GPDate; if (date != null && date.Value != null) { return(date.Value.ToString()); } return(null); case GPParameterType.LinearUnit: GPLinearUnit lu = param as GPLinearUnit; if (lu != null) { return(string.Format("{0} {1}", lu.Distance, lu.Unit.ToString().Replace("esri", ""))); } return(null); case GPParameterType.Boolean: case GPParameterType.Double: case GPParameterType.Long: case GPParameterType.String: case GPParameterType.FeatureLayer: case GPParameterType.RecordSet: case GPParameterType.DataFile: return(ParameterToString(type, param, CultureHelper.GetCurrentCulture())); case GPParameterType.RasterData: case GPParameterType.RasterDataLayer: GPRasterData ras = param as GPRasterData; if (ras != null) { return(ras.Url); } return(null); } return(string.Empty); }
public void PlayerJoinGrandPrix(GPlayer player, Packet packet) { DateTime ReDate(DateTime GPDate) { if (GPDate < DateTime.Now) { return(GPDate.AddDays(1)); } return(GPDate); } Boolean Check(ushort Hour, ushort Min, ushort HourEnd, ushort MinEnd) { DateTime OpenDatetime; DateTime EndDatetime; if (Hour == 0 && Min == 0 && HourEnd == 0 && MinEnd == 0) { return(true); } OpenDatetime = CreateGPDateTime(Hour, Min); EndDatetime = ReDate(CreateGPDateTime(HourEnd, MinEnd)); if (DateTime.Now >= OpenDatetime && DateTime.Now < EndDatetime) { return(true); } return(false); } Boolean GPProgram(ushort Hour, ushort Min) { return(Hour > 0 || Min > 0); } packet.ReadUInt32(out uint GPTypeID); if (IffEntry.GrandPrix.IsGPExist(GPTypeID) == false) { player.SendResponse(TGAME_CREATE_RESULT.CREATE_GAME_CREATE_FAILED.ShowRoomError()); WriteConsole.WriteLine("PlayerJoinGrandPrix: GrandPrix typeid is not existed."); return; } var GP = IffEntry.GrandPrix.GetGP(GPTypeID); var GPGame = GetGameHandle((ushort)GPTypeID); if (GPGame == null || GP.IsNovice) { if (!Check(GP.Hour_Open, GP.Min_Open, GP.Hour_End, GP.Min_End)) { player.SendResponse(TGAME_CREATE_RESULT.CREATE_GAME_CREATE_FAILED.ShowRoomError()); return; } var GameInfo = new GameInformation() { GameTime = 0, VSTime = 0, MaxPlayer = 30, GameType = GAME_TYPE.GRANDPRIX, HoleTotal = GP.TotalHole, Map = (byte)GP.Map, Mode = (byte)GP.Mode, NaturalMode = GP.Natural, GP = true, GPTypeID = GP.TypeID, GPTypeIDA = GP.TypeGP == 0 ? 256 : GP.TypeGP, GPTime = (uint)(GP.TimeHole * 1000), GMEvent = false, Name = GP.Name, Password = "", Artifact = GP.Artifact }; GPGame = CreateGame(player, GameInfo); if (GPProgram(GP.Hour_Program, GP.Min_Program)) { GPGame.SetGPTime(ReDate(CreateGPDateTime(GP.Hour_Program, GP.Min_Program))); } } if (GPGame != null && GPGame.GameData.GPTime > 0) { GPGame.SendPlayerOnJoin(player); } player.SendResponse(ShowWhoPlay(player.ConnectionID)); ////40 00 B0000000 BB 78 00 00 BB if (GPGame != null && GPGame.GameData.GPTime > 0) { } }
public static string ParameterToString(GPParameterType type, GPParameter param, CultureInfo culture) { if (param == null) { return(string.Empty); } switch (type) { case GPParameterType.Boolean: GPBoolean boo = param as GPBoolean; if (boo != null) { return(boo.Value.ToString()); } else { return(string.Empty); } case GPParameterType.Date: GPDate date = param as GPDate; if (date != null && date.Value != null) { return(date.Value.Ticks.ToString()); } else { return(string.Empty); } case GPParameterType.Double: GPDouble dub = param as GPDouble; if (dub != null && !double.IsNaN(dub.Value)) { return(dub.Value.ToString(culture)); } else { return(string.Empty); } case GPParameterType.Long: GPLong lon = param as GPLong; if (lon != null) { return(lon.Value.ToString()); } else { return(string.Empty); } case GPParameterType.String: GPString stir = param as GPString; if (stir != null && stir.Value != null) { return(stir.Value); } else { return(string.Empty); } case GPParameterType.FeatureLayer: GPFeatureRecordSetLayer feat = param as GPFeatureRecordSetLayer; if (feat != null && feat.Url != null) { return(feat.Url); } else { return(string.Empty); } case GPParameterType.RecordSet: GPRecordSet rsl = param as GPRecordSet; if (rsl != null && rsl.Url != null) { return(rsl.Url); } else { return(string.Empty); } case GPParameterType.DataFile: GPDataFile dat = param as GPDataFile; if (dat != null && dat.Url != null) { return(dat.Url); } else { return(string.Empty); } } return(string.Empty); }