Пример #1
0
 public ChatWnd(CCBGameData gameData, CCBStoreManager storeData)
 {
     m_gameData           = gameData;
     m_storeData          = storeData;
     m_charactersReceived = new CCBCharacterList();
     m_errorList          = new List <string>();
     m_exit                    = false;
     m_connected               = false;
     m_wasConnected            = false;
     m_showConnectedCallback   = new DShowOnConnected(ShowOnConnected);
     m_fileReceivedCB          = new CCBFileReceived.DFileRecivedPrompt(PromptForFileReceived);
     m_showUserConnectCallback = new DShowUserConnect(ShowUserConnect);
     m_showMessageCallback     = new DShowMessage(ShowMessage);
     m_showLastErrorCallback   = new DShowLastError(ShowLastError);
     m_addFileLinkCallback     = new DAddFileLink(AddFileLinkCallback);
     m_addObjectLinkCallback   = new DAddObjectLink(AddObjectLinkCallback);
     m_p2p = new CCBP2PNetworker();
     m_p2p.AddListener(this);
     m_p2p.OnFileTransferDoneCallback = new DOnFileTransferDone(OnFileTransferDone);
     InitializeComponent();
     SetHostNameTo(tbUserId);
     CeebeetleWindowInit();
     InitChatWindow();
     Validate();
     EnableUI(false);
 }
Пример #2
0
 public StoreViewerWnd(CCBStoreManager storeMgr)
 {
     m_storeMgr = storeMgr;
     InitializeComponent();
     CeebeetleWindowInit();
     Populate();
     Validate();
 }
Пример #3
0
 public StoreManagerWnd(CCBStoreManager manager, CCBGame game)
 {
     m_initialized = false;
     m_manager     = manager;
     m_game        = game;
     InitializeComponent();
     CeebeetleWindowInit();
     tbChance.Text = "100";
     Populate();
     Validate();
     m_initialized = true;
 }
Пример #4
0
        public bool LoadStores(string docPath)
        {
            lock (this)
            {
                CCBLogger logger   = CCBLogConfig.GetLogger();
                XmlReader xsReader = null;

                try
                {
                    xsReader = XmlReader.Create(docPath);
                    DataContractSerializer dsReader = new DataContractSerializer(typeof(CCBStoreManager));
                    CCBStoreManager        stores   = (CCBStoreManager)dsReader.ReadObject(xsReader);

                    m_places.MergePlaces(stores.m_places);
                    MergeStores(stores.m_stores);
                    m_dirty = false;
                    xsReader.Close();
                    return(true);
                }
                catch (System.IO.FileNotFoundException nothere)
                {
                    logger.Debug(String.Format("No data file, not loading stores [{0}]", nothere.FileName));
                    if (null != xsReader)
                    {
                        xsReader.Close();
                    }
                }
                catch (System.Runtime.Serialization.SerializationException serex)
                {
                    logger.Error(String.Format("XML parsing error, not loading stores [{0}]", serex.ToString()));
                    if (null != xsReader)
                    {
                        xsReader.Close();
                    }
                }
                catch (Exception ex)
                {
                    logger.Error("Exception reading store document: " + ex.ToString());
                    if (null != xsReader)
                    {
                        xsReader.Close();
                    }
                }
            }
            return(false);
        }
Пример #5
0
 public MainWindow()
 {
     m_config                       = new CCBConfig();
     m_games                        = new CCBGameData();
     m_templates                    = new List <CCBGameTemplate>();
     m_storeManager                 = new CCBStoreManager();
     m_deleteEnabled                = false;
     m_deleteUsed                   = false;
     m_onCharacterListUpdateD       = new DOnCharacterListUpdate(OnCharacterListUpdate);
     m_onAddingNewEntityModeD       = new DOnAddingNewEntityMode(OnAddingNewEntityMode);
     m_onCreateNewGameD             = new DOnCreateNewGame(OnCreateNewGame);
     m_onCreateNewTemplateD         = new DOnCreateNewTemplate(OnCreateNewTemplate);
     m_gameAdderEntry               = new CCBTreeViewGameAdder();
     m_worker                       = new BackgroundWorker();
     m_worker.WorkerReportsProgress = true;
     m_timer                        = new Timer(133337);
     m_timer.Elapsed               += new ElapsedEventHandler(OnTimer);
     m_timer.Start();
     m_chatWnd = null;
     InitializeComponent();
     try
     {
         m_config.Initialize();
         CCBLogConfig.InitLogging(m_config);
         tbStatus.Text = System.String.Format("{0} [v{1}]", m_config.DocPath, System.Environment.Version.ToString());
     }
     catch (System.Reflection.TargetInvocationException ex)
     {
         System.Diagnostics.Debug.WriteLine("Error caught in Main.");
         System.Diagnostics.Debug.WriteLine(ex.ToString());
     }
     m_worker.ProgressChanged    += new ProgressChangedEventHandler(Worker_OnProgressChanged);
     m_worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Worker_OnPersistenceCompleted);
     m_loaderD        = new DoWorkEventHandler(Worker_Load);
     m_worker.DoWork += m_loaderD;
     m_worker.RunWorkerAsync(m_config);
     SetDefaultView();
     AddOrMoveAdder();
 }
Пример #6
0
 private StoreManagerWnd()
 {
     m_manager = null;
     m_game    = null;
 }