예제 #1
0
        public MainForm()
        {
            //   private string m_strNEMALogFile = null;
            //   private string m_strGPSTrackFile = null;

            XmlParser xp = new XmlParser();

            xp.OnElementStart += new OnElementStartD(xp_OnElementStart);
            //xp.OnElementEnd += new OnElementEndD(xp_OnElementEnd);
            //xp.OnElementData += new OnElementDataD(xp_OnElementData);

            xp.Load("gpstracker.xml");

            xp.Parse();

            //m_strNEMALogFile = System.Configuration.ConfigurationSettings.AppSettings["NMEALogFile"];
            //m_strGPSTrackFile = ConfigurationSettings.AppSettings["GPSTrackFileName"];
            //m_strErrorLogFile  = ConfigurationSettings.AppSettings["ErrorLogFile"];

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
            m_GPSWrapper = new GPSWrapper();

            m_GPSWrapper.NMEALogFileLocation = m_strNEMALogFile;

            m_GPSWrapper.GPSData.CoordinateChange += new CoordinateChangeHandler(GPSCoordsUpdated);
            m_GPSWrapper.GPSException             += new ExceptionHandler(GPSException);

            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();
        }
예제 #2
0
    public override void SaveData <T>(string name, object data)
    {
        var jsonStr = JsonUtility.ToJson((T)data);

        if (!games.ContainsKey(name))
        {
            games.Add(name, new Game());
        }

        Game game = games[name];

        GPSWrapper.OpenSavedGame(name, (status, gameData) =>
        {
            if (status == SavedGameRequestStatus.Success)
            {
                game.gameData = gameData;
                game.type     = typeof(T);
                GPSWrapper.SaveGame(
                    game.gameData,
                    Encoding.ASCII.GetBytes(jsonStr),
                    game.gameData.TotalTimePlayed + (DateTime.Now - game.gameData.LastModifiedTimestamp),
                    OnSavedGameWritten,
                    name//описание сохранения
                    );
            }
            else
            {
                CallOnDataSaved(name, false);
            }
        });
    }
예제 #3
0
 public void ShowAchivementsGUI()
 {
     GPSWrapper.ShowAchivementsGUI((b) => { if (!b)
                                            {
                                                Toast.Instance.Show(LocalizedStrings.cant_open_player_offline);
                                            }
                                   });
 }
예제 #4
0
 public void ShowSavesGUI()
 {
     GPSWrapper.ShowSavedGamesUI(
         (s, g) => { Toast.Instance.Show(LocalizedStrings.show_saves_gui); },
         (b) => { if (!b)
                  {
                      Toast.Instance.Show(LocalizedStrings.cant_open_player_offline);
                  }
         }
         );
 }
예제 #5
0
 public void LogIn()
 {
     GPSWrapper.LogInPlayer(true, (b) =>
     {
         if (b)
         {
             Toast.Instance.Show(LocalizedStrings.hello);
         }
         else
         {
             Toast.Instance.Show(LocalizedStrings.cant_log_in_2);
         }
     });
 }
예제 #6
0
    public override void LoadData <T>(string name)
    {
        if (!games.ContainsKey(name))
        {
            games.Add(name, new Game());
        }

        Game game = games[name];

        GPSWrapper.OpenSavedGame(name, (status, gameData) =>
        {
            if (status == SavedGameRequestStatus.Success)
            {
                game.gameData = gameData;
                game.type     = typeof(T);
                GPSWrapper.LoadGameData(game.gameData, OnSavedGameDataRead);
            }
            else
            {
                CallOnDataLoaded(name, null, false);
            }
        });
    }
예제 #7
0
 public void LogOut()
 {
     GPSWrapper.LogOutPlayer();
     Toast.Instance.Show(LocalizedStrings.logged_out);
 }
예제 #8
0
        public MainForm()
        {
            //   private string m_strNEMALogFile = null;
            //   private string m_strGPSTrackFile = null;

            XmlParser xp = new XmlParser();

            xp.OnElementStart += new OnElementStartD(xp_OnElementStart);
            //xp.OnElementEnd += new OnElementEndD(xp_OnElementEnd);
            //xp.OnElementData += new OnElementDataD(xp_OnElementData);

            xp.Load("gpstracker.xml");

            xp.Parse();

            //m_strNEMALogFile = System.Configuration.ConfigurationSettings.AppSettings["NMEALogFile"];
            //m_strGPSTrackFile = ConfigurationSettings.AppSettings["GPSTrackFileName"];
            //m_strErrorLogFile  = ConfigurationSettings.AppSettings["ErrorLogFile"];

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
            m_GPSWrapper = new GPSWrapper();

            m_GPSWrapper.NMEALogFileLocation = m_strNEMALogFile;
            //public event GPSFixHandler GPSCoordUpdateEvent;

            if (m_bUseGPSUpdateEvents)
            {
                m_GPSWrapper.GPSCoordUpdateEvent += new GPSFixHandler(GPSCoordsUpdated);
            }

            m_GPSWrapper.GPSException += new ExceptionHandler(ExceptionHandler);


            if (m_bUseFormTimer)
            {
                m_UpdateTimer          = new Timer();
                m_UpdateTimer.Interval = m_iFormTimerInterval;
                m_UpdateTimer.Enabled  = true;
                m_UpdateTimer.Tick    += new System.EventHandler(OnFormTimerEvent);
            }
            if (m_bUseLogTimer)
            {
                m_LogTimer          = new Timer();
                m_LogTimer.Interval = m_iLogTimerInterval;
                m_LogTimer.Enabled  = true;
                m_LogTimer.Tick    += new System.EventHandler(OnLogTimerEvent);
            }

            // Set the interval on our timer and start the
            // timer. It will run for the duration of the
            // program
            m_PowerResetTimer = new Timer();
            int interval = ShortestTimeoutInterval();

            m_PowerResetTimer.Interval = interval;
            m_PowerResetTimer.Enabled  = true;
            m_LogTimer.Tick           += new System.EventHandler(PowerResetTimer_Tick);

            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            this.commport.Text = m_strGPSCOMPort;

            this.txtErrorCount.Text = m_iErrorCount.ToString();

            this.chkSupressErrors.Checked = m_blnSuppressErrors;             // take value of control...
        }