示例#1
0
文件: Form1.cs 项目: muairui/c-
        private void button2_Click(object sender, EventArgs e)
        {
            showMessageDelegate = new ShowMessageDelegate(ShowMessage);
            Thread thread = new Thread(DoWork2);

            thread.Start();
        }
示例#2
0
 public FBClassParcer(Storage openedStorage, ShowMessageDelegate showMessage)
 {
     Storage         = openedStorage;
     _newTypes       = null;
     _processedTypes = null;
     _showMessage    = showMessage;
 }
示例#3
0
 public SmvCodeGenerator(Storage storage, IEnumerable <ExecutionModel> executionModels, Settings settings, ShowMessageDelegate showMessage)
 {
     _storage         = storage;
     _executionModels = executionModels;
     _settings        = settings;
     _showMessage     = showMessage;
 }
示例#4
0
            private void PutFBNetwork(FBNetwork fbNetwork, string fbTypeName, ShowMessageDelegate ShowMessage)
            {
                foreach (var fbInstance in fbNetwork.FB)
                {
                    Storage.PutFBInstance(new FB2SMV.FBCollections.FBInstance(fbInstance.Name, fbInstance.Type, fbInstance.Comment, fbTypeName));
                    fbInstance.Parameters.ForEach(p => Storage.PutInstanceParameter(new FBCollections.InstanceParameter(p.Name, p.Value, fbInstance.Name, fbTypeName, p.Comment)));

                    if (!_processedTypes.Contains(fbInstance.Type) && !_newTypes.Contains(fbInstance.Type))
                    {
                        // TODO: exclude HMI here
                        if (!IsLibraryType(fbInstance.Type))
                        {
                            _newTypes.Enqueue(fbInstance.Type);
                        }
                        else
                        {
                            ShowMessage("Pre-defined FB type added to storage: " + fbInstance.Type);
                            PutLibraryType(fbInstance.Type);
                            _processedTypes.Add(fbInstance.Type);
                        }
                    }
                }
                foreach (var connection in fbNetwork.DataConnections)
                {
                    Storage.PutConnection(new FB2SMV.FBCollections.Connection(connection.Source, connection.Destination,
                                                                              ConnectionType.Data, fbTypeName));
                }
                foreach (var connection in fbNetwork.EventConnections)
                {
                    Storage.PutConnection(new FB2SMV.FBCollections.Connection(connection.Source, connection.Destination,
                                                                              ConnectionType.Event, fbTypeName));
                }
            }
示例#5
0
            public void ParseRecursive(string filename, ShowMessageDelegate ShowMessage)
            {
                if (!fileExtensions.Contains(Path.GetExtension(filename)))
                {
                    fileExtensions.Add(Path.GetExtension(filename));
                }

                string directory     = Path.GetDirectoryName(filename);
                bool   elementIsRoot = true;

                while (filename != null)
                {
                    try //TODO: replace with FaultCallbackDelegate()
                    {
                        ShowMessage("Loading file: " + filename);
                        FB2SMV.FBXML.FBType fb = Deserialie(filename);
                        PutClassToStorage(fb, elementIsRoot, ShowMessage);
                        filename      = NextFileName(directory);
                        elementIsRoot = false;
                    }
                    catch (Exception e)
                    {
                        throw new Exception(String.Format("Can not load file \"{0}\" \n{1}", filename, e.Message));
                    }
                }
            }
示例#6
0
 public FBClassParcer(ShowMessageDelegate showMessage, Settings settings)
 {
     Storage         = new FB2SMV.FBCollections.Storage();
     _newTypes       = new Queue <string>();
     _processedTypes = new SortedSet <string>();
     _showMessage    = showMessage;
     _settings       = settings;
 }
示例#7
0
        static void Sample03()
        {
            ShowMessageDelegate D = delegate()
            {
                Console.WriteLine("Mensaje Método anonimo con delegado");
            };

            D();
        }
示例#8
0
 public Network(ShowMessageDelegate MsgDelegate,
                ReceiveShotDelegate ShotDelegate,
                ReceiveCellShotResultDelegate ShotResultDelegate)
 {
     msgDelegate        = MsgDelegate;
     shotDelegate       = ShotDelegate;
     shotResultDelegate = ShotResultDelegate;
     _terminated        = false;
 }
 /// <summary>
 /// Constructor of DeviceRfidBoard
 /// </summary>
 /// <param name="deviceId">DeviceID is a dummy variable to recover device ID of the board </param>
 /// <param name="strSerialPortCom">String of the associated serial port plug to the device</param>
 /// <param name="showOutbound">Delegate for displaying message from serial port</param>
 public DeviceRfidBoard(uint deviceId,
                        string strSerialPortCom,
                        ShowMessageDelegate showOutbound)
 {
     this.deviceId         = deviceId;
     this.strSerialPortCom = strSerialPortCom;
     this.showOutbound     = showOutbound;
     firmwareVersion       = null;
 }
示例#10
0
 private void ShowMessage(string text)
 {
     if (this.InvokeRequired)
     {
         var d = new ShowMessageDelegate(ShowMessage);
         this.Invoke(d, new object[] { text });
     }
     else
     {
         MessageBox.Show(text);
     }
 }
示例#11
0
 private void ShowMessage(string message, LogType logType)
 {
     if (this.InvokeRequired)
     {
         ShowMessageDelegate showMessageDelegate = ShowMessage;
         this.Invoke(showMessageDelegate, new object[] { message, logType });
     }
     else
     {
         ShowLog(message, logType);
     }
 }
 private void ShowMessage(string message)
 {
     if (richTextBox1.InvokeRequired)
     {
         ShowMessageDelegate d = ShowMessage;
         richTextBox1.Invoke(d, message);
     }
     else
     {
         richTextBox1.AppendText(message + "\n\r");
     }
 }
示例#13
0
 private void ShowMessage(DataGridView dg, string message, int row, int column)
 {
     if (dg.InvokeRequired)
     {
         ShowMessageDelegate showMessageDelegate = ShowMessage;
         dg.Invoke(showMessageDelegate, new object[] { dg, message, row, column });
     }
     else
     {
         dg.Rows[row].Cells[column].Value = message;
     }
 }
示例#14
0
 private void ShowMessage(RichTextBox txtbox, string message)
 {
     if (txtbox.InvokeRequired)
     {
         ShowMessageDelegate showMessageDelegate = ShowMessage;
         txtbox.Invoke(showMessageDelegate, new object[] { txtbox, message });
     }
     else
     {
         txtbox.Text += message + "\r\n";
     }
 }
 private void ShowMessage(String Message, String Title)
 {
     if (this._parentForm.InvokeRequired)
     {
         ShowMessageDelegate update = new ShowMessageDelegate(ShowMessage);
         this._parentForm.Invoke(update, Message, Title);
     }
     else
     {
         MessageBox.Show(_parentForm, Message, Title, MessageBoxButtons.OK);
     }
 }
示例#16
0
 /// <summary>
 /// Used by the automation engine to show a message to the user on-screen. If UI is not available, a standard messagebox will be invoked instead.
 /// </summary>
 public void ShowMessage(string message, string title, UI.Forms.Supplemental.frmDialog.DialogType dialogType, int closeAfter)
 {
     if (InvokeRequired)
     {
         var d = new ShowMessageDelegate(ShowMessage);
         Invoke(d, new object[] { message, title, dialogType, closeAfter });
     }
     else
     {
         var confirmationForm = new UI.Forms.Supplemental.frmDialog(message, title, dialogType, closeAfter);
         confirmationForm.ShowDialog();
     }
 }
示例#17
0
 private void ShowMessageBox(IWin32Window win32Window, string Texto, string Titulo, MessageBoxButtons messageBoxButtons, MessageBoxIcon messageBoxIcon)
 {
     //Al igual que el metodo SetText, para mostrar el final del proceso desde la funcion de
     //PuertoSerie_Data_Received es necesario utilizar delegados
     if (Barra_De_Progreso.InvokeRequired)
     {
         ShowMessageDelegate d = new ShowMessageDelegate(ShowMessageBox);
         Invoke(d, new object[] { win32Window, Texto, Titulo, messageBoxButtons, messageBoxIcon });
     }
     else
     {
         MessageBox.Show(win32Window, Texto, Titulo, messageBoxButtons, messageBoxIcon);
     }
 }
示例#18
0
 private void ShowMessage(TextBox txtbox, string message)
 {
     if (txtbox.InvokeRequired)
     {
         ShowMessageDelegate showMessageDelegate = ShowMessage;
         txtbox.Invoke(showMessageDelegate, new object[] { txtbox, message });
     }
     else
     {
         //txtbox.Text += message + "\r\n";
         //滚动条保持在最下面
         txtbox.AppendText(message + "\r\n");
     }
 }
		/// <summary>
		/// Performs the initializtion for the game mode being created.
		/// </summary>
		/// <param name="p_dlgShowView">The delegate to use to display a view.</param>
		/// <param name="p_dlgShowMessage">The delegate to use to display a message.</param>
		/// <returns><c>true</c> if the setup completed successfully;
		/// <c>false</c> otherwise.</returns>
		public override bool PerformInitialization(ShowViewDelegate p_dlgShowView, ShowMessageDelegate p_dlgShowMessage)
		{
			if (EnvironmentInfo.Settings.CustomGameModeSettings[GameModeDescriptor.ModeId] == null)
				EnvironmentInfo.Settings.CustomGameModeSettings[GameModeDescriptor.ModeId] = new PerGameModeSettings<object>();
			if (!EnvironmentInfo.Settings.CustomGameModeSettings[GameModeDescriptor.ModeId].ContainsKey("IgnoreDLC"))
			{
				EnvironmentInfo.Settings.CustomGameModeSettings[GameModeDescriptor.ModeId]["IgnoreDLC"] = false;
				EnvironmentInfo.Settings.Save();
			}

			DlcScanner dcsScanner = new DlcScanner(EnvironmentInfo, GameModeDescriptor);
			dcsScanner.ConfirmAction = p_dlgShowMessage;
			dcsScanner.CheckForDLCs();
			return true;
		}
示例#20
0
文件: Form1.cs 项目: D1rce/self-study
 private void ShowMessage(TextBox txtbox, string message)
 {
     if (txtbox.InvokeRequired)
     {
         ShowMessageDelegate showMessageDelegate = ShowMessage;
         txtbox.Invoke(showMessageDelegate, new object[] { txtbox, message });
     }
     else
     {
         if (txtbox.Text.Length > 9999)
         {
             txtbox.Text = "";
         }
         txtbox.Text = message + "\r\n" + txtbox.Text;
     }
 }
        /// <summary>
        /// Performs the initial setup for the game mode being created.
        /// </summary>
        /// <param name="p_dlgShowView">The delegate to use to display a view.</param>
        /// <param name="p_dlgShowMessage">The delegate to use to display a message.</param>
        /// <returns><c>true</c> if the setup completed successfully;
        /// <c>false</c> otherwise.</returns>
        public bool PerformInitialSetup(ShowViewDelegate p_dlgShowView, ShowMessageDelegate p_dlgShowMessage)
        {
            if (EnvironmentInfo.Settings.CustomGameModeSettings[GameModeDescriptor.ModeId] == null)
            {
                EnvironmentInfo.Settings.CustomGameModeSettings[GameModeDescriptor.ModeId] = new PerGameModeSettings <object>();
            }

            StateOfDecaySetupVM vmlSetup = new StateOfDecaySetupVM(EnvironmentInfo, GameModeDescriptor);
            SetupForm           frmSetup = new SetupForm(vmlSetup);

            if (((DialogResult)p_dlgShowView(frmSetup, true)) == DialogResult.Cancel)
            {
                return(false);
            }
            return(vmlSetup.Save());
        }
示例#22
0
        public void SetLogStatus(String status)
        {
            if (this.InvokeRequired == false)
            {
                TexboxLogStatus.Text = TexboxLogStatus.Text + status + "\r\n";

                // Scrolls Down
                TexboxLogStatus.SelectionStart = TexboxLogStatus.Text.Length;
                TexboxLogStatus.ScrollToCaret();
                TexboxLogStatus.Refresh();
            }
            else
            {
                ShowMessageDelegate showMessage = new ShowMessageDelegate(SetLogStatus);
                this.Invoke(showMessage, new object[] { status });
            }
        }
        /// <summary>
        /// Performs the initializtion for the game mode being created.
        /// </summary>
        /// <param name="p_dlgShowView">The delegate to use to display a view.</param>
        /// <param name="p_dlgShowMessage">The delegate to use to display a message.</param>
        /// <returns><c>true</c> if the setup completed successfully;
        /// <c>false</c> otherwise.</returns>
        public override bool PerformInitialization(ShowViewDelegate p_dlgShowView, ShowMessageDelegate p_dlgShowMessage)
        {
            if (EnvironmentInfo.Settings.CustomGameModeSettings[GameModeDescriptor.ModeId] == null)
            {
                EnvironmentInfo.Settings.CustomGameModeSettings[GameModeDescriptor.ModeId] = new PerGameModeSettings <object>();
            }
            if (!EnvironmentInfo.Settings.CustomGameModeSettings[GameModeDescriptor.ModeId].ContainsKey("IgnoreDLC"))
            {
                EnvironmentInfo.Settings.CustomGameModeSettings[GameModeDescriptor.ModeId]["IgnoreDLC"] = false;
                EnvironmentInfo.Settings.Save();
            }

            DlcScanner dcsScanner = new DlcScanner(EnvironmentInfo, GameModeDescriptor);

            dcsScanner.ConfirmAction = p_dlgShowMessage;
            dcsScanner.CheckForDLCs();
            return(true);
        }
示例#24
0
 /// <summary>
 /// 初始化委托
 /// </summary>
 private void initDelegates()
 {
     setOnlineDelegate             = new EnableDelegate(onLog);
     enableSendDelegate            = new EnableDelegate(onEnableSend);
     sendRtfDelegate               = new SendRtfDelegate(onSendRtfDelegate);
     sendFileDelegate              = new SendFileDelegate(SendFile);
     receiveRTFDelegate            = new ReceiveRTFDelegate(onReceiveRTF);
     removeClientDelegate          = new RemoveClientDelegate(onRemoveClient);
     askedForReceivingFileDelegate =
         new AskedForReceivingFileDelegate(onAskedForReceivingFile);
     stopSendingOrReceivingFileDelegate =
         new StopSendingOrReceivingFileDelegate(onStopSendingOrReceivingFile);
     showMessageDelegate  = new ShowMessageDelegate(onShowMessage);
     setProgressDelegate  = new SetProgressDelegate(onSetProgress);
     showProgressDelegate = new ShowProgressDelegate(onShowProgress);
     updateStatusDelegate = new UpdateStatusDelegate(onUpdateStatus);
     startTimingDelegate  = new StartTimingDelegate(onStartTiming);
 }
示例#25
0
        private void Form1_Load(object sender, EventArgs e)
        {
            Person alice = new Person()
            {
                Name = "Alice"
            };

            ShowMessage = alice.ShowName;

            Person bob = new Person()
            {
                Name = "Bob"
            };

            ShowMessage += bob.ShowName;

            ShowMessage += Person.ShowClassName;
            ShowMessage += this.SayHi;

            ShowMessage();
        }
示例#26
0
 /// <summary>
 /// A simple consturctor that initializes the object with the given values.
 /// </summary>
 /// <param name="p_eifEnvironmentInfo">The application's environement info.</param>
 /// <param name="p_gmdGameModeInfo">The descriptor of the game mode that this factory builds.</param>
 public DlcScanner(IEnvironmentInfo p_eifEnvironmentInfo, IGameModeDescriptor p_gmdGameModeInfo)
 {
     EnvironmentInfo    = p_eifEnvironmentInfo;
     GameModeDescriptor = p_gmdGameModeInfo;
     ConfirmAction      = delegate { return(DialogResult.Cancel); };
 }
示例#27
0
            public static string SetOutputVarBuffers(IEnumerable <Variable> variables, IEnumerable <Event> events, IEnumerable <ECAction> actions, IEnumerable <WithConnection> withConnections, ShowMessageDelegate showMessage)
            {
                string outVarsChangeString = "";

                foreach (Variable variable in variables.Where(v => v.Direction == Direction.Output))
                {
                    string rule = Smv.OsmStateVar + "=" + Smv.Osm.S2 + " & " + Smv.AlgStepsCounterVar + "=0" +
                                  " & ({0}) : {1};\n";
                    string outCond = "";

                    List <ECAction> ac = new List <ECAction>();
                    foreach (WithConnection connection in withConnections.Where(conn => conn.Var == variable.Name))
                    {
                        var outputEventsActions = actions.Where(act => act.Output == connection.Event);
                        if (outputEventsActions.Count() == 0)
                        {
                            showMessage(String.Format("Warning! Event {0} associated with output {1} never fires.", connection.Event, variable.Name));
                        }
                        foreach (ECAction action in outputEventsActions)
                        {
                            if (!ac.Contains(action))
                            {
                                ac.Add(action);
                            }
                        }
                    }

                    foreach (ECAction action in ac)
                    {
                        outCond += "(" + Smv.EccStateVar + "=" + Smv.EccState(action.ECState) + " & " +
                                   Smv.EcActionsCounterVar + "=" + action.Number + ") | ";
                    }

                    if (outCond != "")
                    {
                        rule = String.Format(rule, outCond.TrimEnd(Smv.OrTrimChars), variable.Name);
                        outVarsChangeString += String.Format(Smv.NextCaseBlock, Smv.ModuleParameters.Variable(variable.Name), rule);
                    }
                    else
                    {
                        showMessage(String.Format("Warning! No active events associated with output {0}.", variable.Name));
                    }
                }
                return(outVarsChangeString);
            }
示例#28
0
		/// <summary>
		/// A simple consturctor that initializes the object with the given values.
		/// </summary>
		/// <param name="p_eifEnvironmentInfo">The application's environement info.</param>
		/// <param name="p_gmdGameModeInfo">The descriptor of the game mode that this factory builds.</param>
		public DlcScanner(IEnvironmentInfo p_eifEnvironmentInfo, IGameModeDescriptor p_gmdGameModeInfo)
		{
			EnvironmentInfo = p_eifEnvironmentInfo;
			GameModeDescriptor = p_gmdGameModeInfo;
			ConfirmAction = delegate { return DialogResult.Cancel; };
		}
示例#29
0
        public void OnMessage(int nIdUserFrom, string strMessage)
        {
            ShowMessageDelegate mesDel = new ShowMessageDelegate(ShowMessage);

            mesDel.BeginInvoke(strMessage, nIdUserFrom, null, null);
        }
示例#30
0
        public string CreateSippDailyCard(ShowMessageDelegate showMessage)
        {
            var sdc = SippDailyCard.Make(Utilities.MakeDateTime(_date), TrackCode);

            var jockeys = new List<string>();

            foreach (var race in _race)
            {
                showMessage(string.Format("Processing race number: {0}",race.RaceNumber));

                var r = SippRace.Make(race.RaceNumber,
                                      race.CorrespondingBrisRace.DistanceInYards,
                                      race.CorrespondingBrisRace.Surface,
                                      race.CorrespondingBrisRace.RaceClassification);

                foreach (var horse in race.Horses)
                {
                    if(!horse.Scratched)
                    {
                        showMessage(string.Format("Processing race number: {0} horse number {1}", race.RaceNumber,horse.ProgramNumber));

                        string jockey = horse.CorrespondingBrisHorse.Jockey;
                        string trainer = horse.CorrespondingBrisHorse.TrainersFullName;

                        if(!jockeys.Contains(jockey))
                        {
                            jockeys.Add(jockey);
                        }

                        var h = SippHorse.Make(horse.ProgramNumber,
                                               horse.Name,
                                               horse.MorningLineOdds.GetOddsToOne(),
                                               jockey,
                                               Utilities.CapitalizeOnlyFirstLetter(trainer),
                                               horse.CorrespondingBrisHorse.PrimePowerRating);

                        h.DaysOff = horse.CorrespondingBrisHorse.DaysSinceLastRace;
                        h.ComingFromLongLayOff = horse.FirstAfterLongLayoff;
                        h.ComingFromLayOff = horse.FirstAfterLayoff;
                        h.SecondOfLayoff = horse.SecondAfterLayoff;
                        h.ThirdOfLayoff = horse.ThirdAfterLayoff;
                        h.FirstTimeOut = horse.CorrespondingBrisHorse.IsFirstTimeOut;
                        h.HandicappingFactors.Clear();

                        h.JockeyStatistics = FactorStatisticManager.GlobalStatisticsPerJockey(jockey).ToString();
                        h.TrainerStatistics = FactorStatisticManager.GlobalStatisticsPerTrainer(trainer).ToString();
                        h.JockeyTrainerStatistics = FactorStatisticManager.GlobalStatisticsPerTrainerAndJockey(trainer, jockey).ToString();

                        /////  Records
                        h.LifeTimeRecord= horse.CorrespondingBrisHorse.LifeTimeEarnings;
                        h.CurrentYearRecord= horse.CorrespondingBrisHorse.CurrentYearEarnings;
                        h.PreviousYearRecord= horse.CorrespondingBrisHorse.PreviousYearEarnings;
                        h.TodaysTrackRecord= horse.CorrespondingBrisHorse.TodaysTrackEarnings;
                        h.WetTrackRecord= horse.CorrespondingBrisHorse.WetTrackEarnings;
                        h.TurfTrackRecord = horse.CorrespondingBrisHorse.TurfTrackEarnings;
                        h.TodaysDistanceRecord = horse.CorrespondingBrisHorse.TodaysDistanceEarnings;
                        h.ColorAgeAndSex = horse.CorrespondingBrisHorse.ColorAgeAndSex;
                        h.SireName = horse.CorrespondingBrisHorse.SireInfo;
                        h.Dam = horse.CorrespondingBrisHorse.DamInfo;
                        h.ClaimingPrice = horse.CorrespondingBrisHorse.ClaimingPriceOfTheHorse;
                        h.Owner = horse.CorrespondingBrisHorse.Owner;
                        h.OwnerSilks = horse.CorrespondingBrisHorse.OwnersSilks;
                        h.QuirinSpeedPoints = horse.CorrespondingBrisHorse.QuirinSpeedPoints;
                        h.RunningStyle = horse.CorrespondingBrisHorse.BrisRunStyle;
                        h.MedicationAndWeight = horse.CorrespondingBrisHorse.MedicationAndWeight;
                        h.PostPosition = horse.FinalPosition;

                        ////// Add sire info //////////////////////////
                        string sire1 = horse.CorrespondingBrisHorse.Sire;
                        string sire2 = horse.CorrespondingBrisHorse.DamSire;

                        int i = 0;
                        foreach (DataRow dr in Sire.GetSiresInfo(sire1, sire2).Rows)
                        {
                            var sippSire = new SippSire
                                               {
                                                   Name = dr["Name"].ToString(),
                                                   FirstTimeOutRating = dr["FTS"].ToString(),
                                                   MudRating = dr["MUD"].ToString(),
                                                   TurfRating = dr["TURF"].ToString(),
                                                   AllWeatherRating = dr["AWS"].ToString(),
                                                   AverageDistance = dr["DIST"].ToString()
                                               };

                            switch (i)
                            {
                                case 0:
                                    h.Sire = sippSire;
                                    break;
                                default:
                                    h.DamSire = sippSire;
                                    break;
                            }

                            ++i;
                        }

                        //////////////////////////////////////////////
                        foreach (var factorStatistic in horse.FactorStatisticsForHorse)
                        {
                            var sippHandicappingFactor = SippHandicappingFactor.Make(factorStatistic.Name);
                            sippHandicappingFactor.GeneralStats = SippHandicappingFactorStats.Make(factorStatistic.Starters,factorStatistic.WinPercent,factorStatistic.Roi, factorStatistic.IV);
                            var trainerStats = FactorStatisticManager.Get(factorStatistic.BitMask, horse.CorrespondingBrisHorse.TrainersFullName);
                            sippHandicappingFactor.TrainerStats = SippHandicappingFactorStats.Make(trainerStats.Starters, trainerStats.WinPercent, trainerStats.Roi, trainerStats.IV);
                            h.HandicappingFactors.Add(sippHandicappingFactor);
                        }

                        foreach (var pp in horse.CorrespondingBrisHorse.PastPerformances)
                        {
                            var sipp = new SippPastPerformance();

                            sipp.DaysSincePreviousRace = pp.DaysSinceLastRace;
                            sipp.DaysSinceTodaysRace = pp.DaysSinceThatRace ;
                            sipp.RacingDate = pp.Date;
                            sipp.RaceNumber = Convert.ToInt32(pp.RaceNumber);
                            sipp.TrackCode = pp.TrackCode;
                            sipp.TrackCondition = pp.TrackCondition;
                            sipp.Distance = pp.DistanceAbreviation;
                            sipp.DistanceInYards = pp.DistanceInYards;
                            sipp.AboutDistanceFlag = pp.AboutDistanceFlag;
                            sipp.Surface = pp.Surface;
                            sipp.RaceCondition = Utilities.FormatCondition(pp.RaceClassification, pp.IsStateBredRestrictedRace, pp.AgeSexRestrictions);
                            sipp.FirstCall = pp.LeadersFirstCall;
                            sipp.SecondCall = pp.LeadersSecondCall;
                            sipp.ThirdCall = pp.LeadersThirdCall;
                            sipp.FinalTime = pp.LeadersFinalCall;
                            sipp.WinnersFinalTime = pp.WinnersFinalTime;
                            sipp.ThisHorseFinalTime = pp.ThisHorseFinalTime;
                            sipp.PostPosition = Convert.ToInt32(pp.PostPosition);
                            sipp.FirstCallPosition = pp.FirstCallPosition;
                            sipp.SecondCallPosition = pp.SecondCallPosition;
                            sipp.ThirdCallPosition= pp.StretchCallPosition;
                            sipp.FinalPosition = pp.FinalPosition;
                            sipp.FirstCallLengthsBehind = pp.FirstCallDistanceFromLeader;
                            sipp.SecondCallLengthsBehind = pp.SecondCallDistanceFromLeader;
                            sipp.ThirdCallLengthsBehind = pp.StretchCallDistanceFromLeader  ;
                            sipp.FinalLengthsBehind = pp.FinalCallDistanceFromLeader;
                            sipp.TrackVariant = pp.TrackVariant;
                            sipp.SpeedFigure = pp.BrisSpeedRating;
                            sipp.Jockey = pp.Jockey.Length < 16 ? pp.Jockey : pp.Jockey.Substring(0, 15);
                            sipp.MedicationWeightEquipment = pp.Medication + pp.Weight + pp.Equipment;
                            sipp.Odds= pp.Odds;
                            sipp.FieldSize = Convert.ToInt32(pp.NumberOfEntrants);

                            sipp.WinnersName = Utilities.CapitalizeOnlyFirstLetter(pp.WinnersName);
                            sipp.SecondPlaceFinisherName = Utilities.CapitalizeOnlyFirstLetter(pp.SecondPlaceFinisherName);
                            sipp.ThirdPlaceFinisherName = Utilities.CapitalizeOnlyFirstLetter(pp.ThirdPlaceFinisherName);
                            h.PastPerformances.Add(sipp);
                        }

                        r.AddHorse(h);
                    }
                }

                sdc.AddRace(r);
            }

            //IEnumerable<ImpactValueStat> ImpactValues = JockeyStatistics.Get(jockey).AllStats,
            showMessage("Now Adding the Jockeys Stats");
            foreach (var jockey in jockeys)
            {
                showMessage(string.Format("adding jockey: {0} ", jockey));
                var s = sdc.GetJockeySummarizedStatistics(jockey);

                foreach (var ivs in JockeyStatistics.Get(jockey).AllStats)
                {
                    s.Add(new SippImpactValueStat
                              {
                                  Name = ivs.Name,
                                  IV = ivs.IV,
                                  Roi = ivs.ROI,
                                  Starters = ivs.Starters,
                                  WinPercentage = ivs.WinPercent
                              });
                }
            }

            if(!Directory.Exists(Utilities.SippFilesDirectory))
            {
                Directory.CreateDirectory(Utilities.SippFilesDirectory);
            }

            string filename = string.Format(@"{0}\sipp_{1}_{2}.xml", Utilities.SippFilesDirectory,TrackCode,_date);
            sdc.SaveToXml(filename);
            showMessage(string.Format("File {0} was created successfully", filename));
            return filename;
        }
示例#31
0
            public void PutClassToStorage(FB2SMV.FBXML.FBType fbType, bool elementIsRoot, ShowMessageDelegate ShowMessage)
            {
                FB2SMV.FBCollections.FBClass type;
                if (fbType.BasicFB != null)
                {
                    type = FBClass.Basic;
                }
                else if (fbType.FBNetwork != null)
                {
                    type = FBClass.Composite;
                }
                else
                {
                    throw new Exception(
                              String.Format("Unknown FB Type {0}. Only Basic and Composite FB's are supported.", fbType.Name));
                }

                Storage.PutFBType(new FB2SMV.FBCollections.FBType(fbType.Name, fbType.Comment, type, elementIsRoot));
                PutInterfaces(fbType.InterfaceList, fbType.Name);

                if (fbType.BasicFB != null) //Basic FB
                {
                    PutBasicFB(fbType.BasicFB, fbType.Name);
                }
                else if (fbType.FBNetwork != null)
                {
                    PutFBNetwork(fbType.FBNetwork, fbType.Name, ShowMessage);
                }

                _processedTypes.Add(fbType.Name);
            }
		/// <summary>
		/// Performs the initializtion for the game mode being created.
		/// </summary>
		/// <param name="p_dlgShowView">The delegate to use to display a view.</param>
		/// <param name="p_dlgShowMessage">The delegate to use to display a message.</param>
		/// <returns><c>true</c> if the setup completed successfully;
		/// <c>false</c> otherwise.</returns>
		public override bool PerformInitialization(ShowViewDelegate p_dlgShowView, ShowMessageDelegate p_dlgShowMessage)
		{
			return true;
		}
		/// <summary>
		/// Performs the initializtion for the game mode being created.
		/// </summary>
		/// <param name="p_dlgShowView">The delegate to use to display a view.</param>
		/// <param name="p_dlgShowMessage">The delegate to use to display a message.</param>
		/// <returns><c>true</c> if the setup completed successfully;
		/// <c>false</c> otherwise.</returns>
		public abstract bool PerformInitialization(ShowViewDelegate p_dlgShowView, ShowMessageDelegate p_dlgShowMessage);
 /// <summary>
 /// Performs the initialization for the game mode being created.
 /// </summary>
 /// <param name="p_dlgShowView">The delegate to use to display a view.</param>
 /// <param name="p_dlgShowMessage">The delegate to use to display a message.</param>
 /// <returns><c>true</c> if the set-up completed successfully;
 /// <c>false</c> otherwise.</returns>
 public bool PerformInitialization(ShowViewDelegate p_dlgShowView, ShowMessageDelegate p_dlgShowMessage)
 {
     return(true);
 }
 /// <summary>
 /// Performs the initializtion for the game mode being created.
 /// </summary>
 /// <param name="p_dlgShowView">The delegate to use to display a view.</param>
 /// <param name="p_dlgShowMessage">The delegate to use to display a message.</param>
 /// <returns><c>true</c> if the setup completed successfully;
 /// <c>false</c> otherwise.</returns>
 public abstract bool PerformInitialization(ShowViewDelegate p_dlgShowView, ShowMessageDelegate p_dlgShowMessage);
		/// <summary>
		/// Performs the initial setup for the game mode being created.
		/// </summary>
		/// <param name="p_dlgShowView">The delegate to use to display a view.</param>
		/// <param name="p_dlgShowMessage">The delegate to use to display a message.</param>
		/// <returns><c>true</c> if the setup completed successfully;
		/// <c>false</c> otherwise.</returns>
		public bool PerformInitialSetup(ShowViewDelegate p_dlgShowView, ShowMessageDelegate p_dlgShowMessage)
		{
			if (EnvironmentInfo.Settings.CustomGameModeSettings[GameModeDescriptor.ModeId] == null)
				EnvironmentInfo.Settings.CustomGameModeSettings[GameModeDescriptor.ModeId] = new PerGameModeSettings<object>();

			GrimrockSetupVM vmlSetup = new GrimrockSetupVM(EnvironmentInfo, GameModeDescriptor);
			SetupForm frmSetup = new SetupForm(vmlSetup);
			if (((DialogResult)p_dlgShowView(frmSetup, true)) == DialogResult.Cancel)
				return false;
			return vmlSetup.Save();
		}
示例#37
0
        public void Login()
        {
            SinoUser _su;

            try
            {
                string ls_name      = textUser.EditValue.ToString().Trim();
                string ls_pass      = textPass.EditValue.ToString();
                string ls_checktype = ConvertToCheckType(cb_CheckType.EditValue.ToString());

                if (ls_checktype == "windows")
                {
                    string cdn = GetDomainName();

                    if (cdn == "")
                    {
#if DEBUG
                        ls_name = "lijianlin";
#else
                        throw new Exception("未登录到域,不可进行域认证!");
#endif
                    }

                    ls_pass = StrUtils.EncodeByDESC(ls_name, "DOMAINCK");
                }

                // 取数据接口
                using (AuthorizeService.AuthorizeServiceClient _client = new AuthorizeService.AuthorizeServiceClient())
                {
                    _su = _client.LoginSys(ConfigFile.SystemID, ls_name, ls_pass, ls_checktype);
                }

                if (_su != null)
                {
                    SessionClass.CurrentLogonName     = ls_name;
                    SessionClass.CurrentLogonPass     = ls_pass;
                    SessionClass.CurrentSinoUser      = _su;
                    SessionClass.CurrentCheckType     = ls_checktype;
                    SessionClass.CurrentTicket        = new SinoSZTicketInfo(_su.UserID, _su.IPAddress, _su.EncryptedTicket);
                    SinoBestTicketCache.CurrentTicket = _su.EncryptedTicket;

                    using (CommonService.CommonServiceClient _cs = new CommonService.CommonServiceClient())
                    {
                        SessionClass.ServerConfigData = _cs.GetServerConfig();

                        DataRow[] _drs = _UserDs.User.Select(string.Format("Username='******'", ls_name));
                        if (_drs.Length == 0)
                        {
                            DataRow row = _UserDs.User.NewRow();
                            row["Username"] = ls_name;
                            _UserDs.User.Rows.Add(row);
                            _UserDs.WriteXml(_schemaFile, XmlWriteMode.IgnoreSchema);
                        }

                        _su.DwID = _su.CurrentPost.PostDwID;

                        loginTimes = 0;
                        System.ComponentModel.ISynchronizeInvoke synchronizer = this;
                        MethodInvoker invoker = new MethodInvoker(LoginSuccess);
                        synchronizer.Invoke(invoker, null);
                    }
                }
                else
                {
                    XtraMessageBox.Show("用户名/口令不正确或过期!", "系统提示");
                    System.ComponentModel.ISynchronizeInvoke synchronizer = this;
                    MethodInvoker invoker = new MethodInvoker(ResetForm);
                    synchronizer.Invoke(invoker, null);
                }


                loginTimes++;

                if (loginTimes > 2)
                {
                    System.ComponentModel.ISynchronizeInvoke synchronizer = this;
                    MethodInvoker invoker = new MethodInvoker(CancelApplicaton);
                    synchronizer.Invoke(invoker, null);
                }
            }
            catch (Exception e)
            {
                ShowMessageDelegate showProgress = new ShowMessageDelegate(ShowMessage);
                string _msg = string.Format("发生错误:{0}", e.Message);
                this.Invoke(showProgress, new object[] { _msg });
            }
        }