public MainWindow() { InitializeComponent(); var configuration = GameMaster.GameMasterConfiguration.GetDefault(); GMConfig = Configuration.Configuration.ReadFromFile(Constants.ConfigurationFilePath); if (GMConfig != null) { configuration = GMConfig.ConvertToGMConfiguration(); } gameMaster = new GameMaster.GameMaster(configuration); Board = new BoardComponent(BoardCanvas); GMConfig.PropertyChanged += GMConfig_PropertyChanged; guiTimer = new DispatcherTimer(); guiTimer.Interval = TimeSpan.FromMilliseconds(16); guiTimer.Tick += GuiTimerEvent; guiTimer.Start(); gameMasterThread = new Task(RunGameMasterThread); gameMasterThread.Start(); }
private void ConnectRadioButton_Checked(object sender, RoutedEventArgs e) { if (IsConnecting == true) { return; } gameMasterMutex.WaitOne(); IsConnecting = true; gameMaster.SetConfiguration(GMConfig.ConvertToGMConfiguration()); try { gameMaster.ConnectToCommunicationServer(); ConnectRadioButton.Content = "Connected"; StartRadioButton.IsEnabled = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception occured!", MessageBoxButton.OK, MessageBoxImage.Error); IsConnecting = false; ConnectRadioButton.IsChecked = false; } gameMasterMutex.ReleaseMutex(); }
public GMResponse GMProcess(Stream gmstream) { MMICONFIG appConfig = new MMICONFIG(); GMConfig gconfig = new GMConfig(); gconfig.filePath = appConfig.getString("htdocsPath"); gconfig.backupPath = appConfig.getString("failedlogsPath"); gconfig.dbServer = appConfig.getString("dbServer"); gconfig.dbName = appConfig.getString("dbName"); gconfig.dbUser = appConfig.getString("dbUser"); gconfig.dbPwd = appConfig.getString("dbPwd"); gconfig.dbTrust = appConfig.getBool("dbTrust"); gconfig.debug = true; gconfig.appPath = HttpContext.Current.Request.MapPath(Path.Combine(HttpContext.Current.Request.ApplicationPath, "bin")); GMResponse respObj = MMIGMProcess.process(gmstream, gconfig, MMIMode.MMPro); WebOperationContext ctx = WebOperationContext.Current; switch (respObj.errorCode) { case 0: loggingHandler.Info(MMIJSON.ObjectToString(respObj)); ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.OK; break; case 1: loggingHandler.Error(MMIJSON.ObjectToString(respObj)); ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.OK; break; case 2: loggingHandler.Error(MMIJSON.ObjectToString(respObj)); ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.Conflict; break; case 3: loggingHandler.Error(MMIJSON.ObjectToString(respObj)); ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.Conflict; break; default: break; } // switch return(respObj); }
// Construct the paintbox, reading values for the colours etc from the config. public Paintbox(GMConfig config) { ColourGifTransparent = Color.Magenta; BrushBgGif = new SolidBrush(ColourGifTransparent); BrushBg = new SolidBrush(config.MiniTreeColourBackground); BrushBox = new SolidBrush(config.MiniTreeColourIndiBackground); BrushBoxHighlight = new SolidBrush(config.MiniTreeColourIndiHighlight); BrushBoxConcealed = new SolidBrush(config.MiniTreeColourIndiBgConcealed); BrushBoxShade = new SolidBrush(config.MiniTreeColourIndiShade); BrushText = new SolidBrush(config.MiniTreeColourIndiText); BrushTextLink = new SolidBrush(config.MiniTreeColourIndiLink); BrushTextConcealed = new SolidBrush(config.MiniTreeColourIndiFgConcealed); PenConnector = new Pen(config.MiniTreeColourBranch, 1.0f); PenConnectorDotted = new Pen(config.MiniTreeColourBranch, 1.0f); PenConnectorDotted.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; PenBox = new Pen(config.MiniTreeColourIndiBorder, 1.0f); BrushFakeTransparency = null; Font = new Font(config.TreeFontName, config.TreeFontSize); }
public StorageClient(CloudBlobClient blobClient, GMConfig config) { this.blobClient = blobClient; this.config = config; }
public ServiceFactory(GMConfig config) { this.config = config; }