static void Main() { Model.Initialize(); Console.Title = "Телефонная книга"; Console.CursorVisible = false; Controllers.MainMenuController.Menu(); }
void OnEnable() { if (GlobalSensorController.WasSetFromLoader) { sensorType = GlobalSensorController.StartWithSensor; } adapter = new SensorAdapter(sensorType) { OnChangedAvailabilityEventHandler = (sender, args) => { Debug.Log(args.SensorType + " is connected: " + args.IsConnected); } }; depthFilter = new DepthFilter(); model1.Initialize(); model1.AvatarRoot.SetActive(false); model1Size = Vector3.Distance(model1.Bones[(int)JointType.SpineBase].Transform.position, model1.Bones[(int)JointType.Head].Transform.position); model2.Initialize(); model2.AvatarRoot.SetActive(false); model2Size = Vector3.Distance(model2.Bones[(int)JointType.SpineBase].Transform.position, model2.Bones[(int)JointType.Head].Transform.position); }
public ModelSystemEditingSession OpenModelSystem(XTMFRuntime runtime) { ExportButton.IsEnabled = true; Runtime = runtime; MSEditSession = null; InternalModel.Initialize(runtime.ModelSystemController.GetModelSystems()); DataContext = InternalModel; lock (InternalModel.Data) { Display.ItemsSource = InternalModel.Data; } FilterBox.Display = Display; FilterBox.Filter = Filter; ShowDialog(); return(MSEditSession); }
void Init() { if (!inited) { if (Dfm != null) { Dfm.Initialize(sysr.ResourceManager); } if (Model != null && Model.Levels.Length > 0) { Model.Initialize(sysr.ResourceManager); } else if (Cmp != null) { Cmp.Initialize(sysr.ResourceManager); } else if (Sph != null) { Sph.Initialize(sysr.ResourceManager); if (Sph.SideMaterials.Length > 6) { radiusAtmosphere = Sph.Radius * Math.Max(Sph.SideMaterials[6].Scale, 1f); } else { radiusAtmosphere = Sph.Radius; } } inited = true; } }
public override void Register(SystemRenderer renderer) { sysr = renderer; sysr.Objects.Add(this); if (!inited) { if (Dfm != null) { Dfm.Initialize(sysr.Game.ResourceManager); } if (Model != null && Model.Levels.Length > 0) { Model.Initialize(sysr.Game.ResourceManager); } else if (Cmp != null) { Cmp.Initialize(sysr.Game.ResourceManager); } else if (Sph != null) { Sph.Initialize(sysr.Game.ResourceManager); if (Sph.SideMaterials.Length > 6) { radiusAtmosphere = Sph.Radius * Sph.SideMaterials[6].Scale; } else { radiusAtmosphere = Sph.Radius; } } inited = true; } }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel(IDataService dataService) { if (dataService == null) { return; } Trace.WriteLine(string.Format("{0}> MainViewModel 初期化", DateTime.Now.ToString())); _dataService = dataService; _dataService.GetData((item, error) => { if (error != null) { // Report error here return; } WelcomeTitle = item.Title; Model = item; }); Model.PointChanged += Model_PointChanged; Model.Initialize(); }
private void InitializeSketch(Vec <float> mousePositionAsOrigin) { _model.Initialize(mousePositionAsOrigin); _ui.InitializeCoodinateSystem(); _history = new History(HistoryPositionChangedHandler); Drawing.AddPointToDrawing(ref _model, SaveCurrentStateToHistory); }
private void CreateModel(GameObject prefab, Material materia, Vector3 position) { if (prefab != null && material != null && position != null) { Model model = new Model(prefab, material, position); model.Initialize(); } }
public void Initialize(ResourceManager cache) { if (Camera != null) { return; } Model.Initialize(cache); }
public ActorComponent Construct(Model model) { Model = model; Model.Initialize(); OriginalModel = model; return(this); }
private static void Main(string[] args) { var model = new Model(); model.Initialize(); model.Start(); Console.ReadKey(); }
public ProjectDetailsDialog(VsProject project, IList <VsProject> allProjects) { InitializeComponent(); Model.Initialize(project, allProjects); ViewModelHelper.RegisterViewModel(Model, this); KeyUp += OnKeyUp; }
private Model CreateHydroNetModel() { // Upper Lake configuration Lake upperLake = new Lake("Upper Lake", 1000); //Simple inflow boundary SinkSourceBoundary inflow = new SinkSourceBoundary(2); inflow.Name = "Inflow to Upper lake"; inflow.ContactGeometry = new HydroNumerics.Geometry.XYPoint(350, 625); upperLake.Sources.Add(inflow); //Ground water boundary HydroNumerics.Geometry.XYPolygon contactPolygon = new HydroNumerics.Geometry.XYPolygon(); contactPolygon.Points.Add(new HydroNumerics.Geometry.XYPoint(350, 625)); contactPolygon.Points.Add(new HydroNumerics.Geometry.XYPoint(447, 451)); contactPolygon.Points.Add(new HydroNumerics.Geometry.XYPoint(715, 433)); contactPolygon.Points.Add(new HydroNumerics.Geometry.XYPoint(863, 671)); contactPolygon.Points.Add(new HydroNumerics.Geometry.XYPoint(787, 823)); contactPolygon.Points.Add(new HydroNumerics.Geometry.XYPoint(447, 809)); GroundWaterBoundary groundWaterBoundary = new GroundWaterBoundary(); groundWaterBoundary.Connection = upperLake; groundWaterBoundary.ContactGeometry = contactPolygon; groundWaterBoundary.Distance = 2.3; groundWaterBoundary.HydraulicConductivity = 1e-4; groundWaterBoundary.GroundwaterHead = 3.4; groundWaterBoundary.Name = "Groundwater boundary under Upper Lake"; upperLake.GroundwaterBoundaries.Add(groundWaterBoundary); //Stream between the lakes Stream stream = new Stream("stream", 2000, 2, 1.1); //Lower Lake configuration Lake lowerLake = new Lake("Lower Lake", 20); //Connecting the waterbodies. upperLake.AddDownStreamWaterBody(stream); stream.AddDownStreamWaterBody(lowerLake); //Creating the model Model model = new Model(); model._waterBodies.Add(upperLake); model._waterBodies.Add(stream); model._waterBodies.Add(lowerLake); DateTime startTime = new DateTime(2010, 1, 1); model.SetState("MyState", startTime, new WaterPacket(1000)); upperLake.SetState("MyState", startTime, new WaterPacket(2)); model.Name = "HydroNet test model"; model.Initialize(); return(model); }
private static Model CreateDefaultSettingModel() { MockFileSystem fileSystem = CreateMockFileSystem(); var model = new Model(fileSystem); model.Initialize(); model.Setting.SearchFilePaths = new[] { targetDirPath }; return(model); }
public override async void OnNavigatedTo(NavigatedToEventArgs e, Dictionary <string, object> viewModelState) { base.OnNavigatedTo(e, viewModelState); await Task.Run(async() => await Model.Initialize()); foreach (var account in Accounts) { account.IsTweetEnabled.Value = account.Model.IsEnabled; } }
public virtual void Setup(IBaseView <TModel> view) { View = view; Model = view.GetModel(); Model.Initialize(); SubscribeEvents(); IsAlreadySetup = true; var viewType = View.GetType(); OnFieldWillUpdate = viewType.GetMethod(OnFieldWillUpdateViewMemberName, ViewEventsBindingFlags); OnFieldDidUpdate = viewType.GetMethod(OnFieldDidUpdateViewMemberName, ViewEventsBindingFlags); }
public void AddHubToModel_BeforeLoadingViewModel_HubGetsAddedToViewModel() { // Can't make this test work without changing how MainViewModel loads metadata. // It always requires a filepath, and reading data from that filepath. Thus no changes // can be made to the model that will be reflected in the View Model. Model.Initialize(); Model.Instance.Hubs.Add(new Hub("New Hub")); MainViewModel MVM = new(); Assert.Equal(MVM.Model.Hubs.Count, MVM.HubsVM.Hubs.Count); Assert.Same(MVM.Model.Hubs[0], MVM.HubsVM.Hubs[0].Hub); }
private void OnEnable() { adapter = new SensorAdapter(SensorType.Kinect2) { OnChangedAvailabilityEventHandler = (sender, args) => { Debug.Log(args.SensorType + " is connected: " + args.IsConnected); } }; characterModel.Initialize(); }
public virtual void Initialize() { view = new View(); model = new Model(); foreach (var item in ALLCollcer.Values) { item.Init(); } model.Initialize(); view.Initialize(); }
/// <summary> /// Initializes this instance. /// </summary> private void Initialize(DrawingPresentationModel drawingPresentationModelData, Model modelData) { _drawingPresentationModel = drawingPresentationModelData; _model = modelData; _graphicsAdapter = new DrawingPageGraphicsAdapter(_canvas); // Observers SubscribeEvents(); // UI SubscribeViewEvents(); // Initial UI States _drawingPresentationModel.Initialize(); UpdateUndoRedoButtonEnabledStates(); _canvas.Loaded += (sender, eventArguments) => _model.Initialize(_canvas.ActualWidth, _canvas.ActualHeight, ShapeDrawerType.None); // The actual width and height of the canvas can only be determined after it is completely loaded. }
public object Read(ContentStream stream, object existingObject) { bool keepSourceVertexDataInTags = new BinaryReader(stream).ReadBoolean(); ModelData modelData = ModelDataContentReader.ReadModelData(stream); if (existingObject == null) { return(Model.Load(modelData, keepSourceVertexDataInTags)); } Model obj = (Model)existingObject; obj.Initialize(modelData, keepSourceVertexDataInTags); return(obj); }
private async void OnLoaded(object sender, RoutedEventArgs routedEventArgs) { Loaded -= OnLoaded; await Model.Initialize().ConfigureAwait(true); // load settings page to subscribe to jobs if there are none selected await Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => { if (Model.Servers != null && !Model.Servers.SelectMany(x => x.Jobs).Any(x => x.IsSubscribed)) { ContentSource = new Uri("Pages/Subscribe.xaml", UriKind.Relative); } })); }
public DrawingForm(DrawingPresentationModel drawingPresentationModelData, Model modelData) { InitializeComponent(); _drawingPresentationModel = drawingPresentationModelData; _model = modelData; this.Disposed += RemoveEvents; // Observers SubscribeEvents(); // UI SubscribeViewEvents(); // Initial UI States _drawingPresentationModel.Initialize(); UpdateUndoRedoButtonEnabledStates(); _model.Initialize(_canvas.Size.Width, _canvas.Size.Height, ShapeDrawerType.None); }
private Model CreateHydroNetModel() { // Upper Lake configuration Lake lake = new Lake("The Lake", 1000); lake.WaterLevel = 5.1; SinkSourceBoundary inflow = new SinkSourceBoundary(2); inflow.Name = "Inflow to lake"; HydroNumerics.Geometry.XYPolygon contactPolygon = new HydroNumerics.Geometry.XYPolygon(); contactPolygon.Points.Add(new HydroNumerics.Geometry.XYPoint(350, 625)); contactPolygon.Points.Add(new HydroNumerics.Geometry.XYPoint(447, 451)); contactPolygon.Points.Add(new HydroNumerics.Geometry.XYPoint(715, 433)); contactPolygon.Points.Add(new HydroNumerics.Geometry.XYPoint(863, 671)); contactPolygon.Points.Add(new HydroNumerics.Geometry.XYPoint(787, 823)); contactPolygon.Points.Add(new HydroNumerics.Geometry.XYPoint(447, 809)); GroundWaterBoundary groundWaterBoundary = new GroundWaterBoundary(); groundWaterBoundary.Connection = lake; groundWaterBoundary.ContactGeometry = contactPolygon; groundWaterBoundary.Distance = 2.3; groundWaterBoundary.HydraulicConductivity = 1e-9; groundWaterBoundary.GroundwaterHead = 5.0; groundWaterBoundary.Name = "Groundwater boundary under Lake"; groundWaterBoundary.Name = "MyGWBoundary"; lake.Sources.Add(inflow); lake.GroundwaterBoundaries.Add(groundWaterBoundary); //Creating the model Model model = new Model(); model._waterBodies.Add(lake); DateTime startTime = new DateTime(2000, 1, 1); model.SetState("MyState", startTime, new WaterPacket(1000)); lake.SetState("MyState", startTime, new WaterPacket(2)); model.Name = "Lake model"; model.Initialize(); model.Update(new DateTime(2001, 1, 1)); return(model); }
/// <summary> /// Initializes this instance. /// </summary> private void Initialize(Model modelData) { _model = modelData; _graphicsAdapter = new DrawingPageGraphicsAdapter(_canvas); // Observers _model.CanvasRefreshDrawRequested += HandleCanvasRefreshDrawRequested; // UI _canvas.SizeChanged += (sender, eventArguments) => _model.SetCanvasSize(_canvas.ActualWidth, _canvas.ActualHeight); _canvas.PointerPressed += HandleCanvasMousePressed; _canvas.PointerMoved += HandleCanvasMouseMoved; _canvas.PointerReleased += HandleCanvasMouseReleased; _rectangleButton.Click += HandleRectangleButtonClicked; _lineButton.Click += HandleLineButtonClicked; _clearButton.Click += HandleClearButtonClicked; // Initial UI States _canvas.Loaded += (sender, eventArguments) => _model.Initialize(_canvas.ActualWidth, _canvas.ActualHeight, ShapeDrawerType.None); // The actual width and height of the canvas can only be determined after it is completely loaded. }
private void _StartGame() { _model = new Model(); _model.Initialize(); if (_view != null) { _view.Destroy(); } _view = new View(); _view.Initalize(_model); _controller = new Controller(); _controller.Initialize(_model); currentState = GameState.GameInProgress; }
void OnEnable() { if (GlobalSensorController.WasSetFromLoader) { sensorType = GlobalSensorController.StartWithSensor; } adapter = new SensorAdapter(sensorType) { OnChangedAvailabilityEventHandler = (sender, args) => { Debug.Log(args.SensorType + " is connected: " + args.IsConnected); } }; depthFilter = new DepthFilter(); model.Initialize(); }
public DrawingForm(Model modelData) { InitializeComponent(); _model = modelData; this.Disposed += RemoveEvents; // Observers _model.CanvasRefreshDrawRequested += HandleCanvasRefreshDrawRequested; // UI _canvas.Resize += (sender, eventArguments) => _model.SetCanvasSize(_canvas.Size.Width, _canvas.Size.Height); _canvas.Paint += (sender, eventArguments) => _model.RefreshDrawCanvas(new DrawingFormGraphicsAdapter(eventArguments.Graphics)); _canvas.MouseDown += HandleCanvasMousePressed; _canvas.MouseMove += HandleCanvasMouseMoved; _canvas.MouseUp += HandleCanvasMouseReleased; _rectangleButton.Click += HandleRectangleButtonClicked; _lineButton.Click += HandleLineButtonClicked; _clearButton.Click += HandleClearButtonClicked; // Initial UI States _model.Initialize(_canvas.Size.Width, _canvas.Size.Height, ShapeDrawerType.None); }
private static void LoadMetadata() { if (MetadataPath != null) { if (File.Exists(Path.Combine(MetadataPath, "Model.json"))) { Model.Deserialize(MetadataPath); } else { MetadataPath = null; MessageBox.Show("Stored Metadata path is invalid. Initializing an empty project instead.", "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); Model.Initialize(); // Create an empty Model. } } else { Model.Initialize(); // Create an empty Model. } }
public async Task Test_ReplaceLogByEnableSetting(bool enableLog) { const string targetDirPath = @"D:\FileRenamerDiff_Test"; string filePathA = Path.Combine(targetDirPath, "A.txt"); string filePathB = Path.Combine(targetDirPath, "B.csv"); var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>() { [filePathA] = new MockFileData("A"), [filePathB] = new MockFileData("B"), }); var model = new Model(fileSystem); model.Initialize(); model.Setting.SearchFilePaths = new[] { targetDirPath }; model.Setting.IsCreateRenameLog = enableLog; model.Setting.ReplaceTexts.Add(new ReplacePattern("A", "X")); await model.LoadFileElements(); await model.Replace(); await model.RenameExcute(); if (!enableLog) { fileSystem.AllFiles .Should().NotContain("RenameLog", "ログ設定が無効ならログファイルはないはず"); return; } var logFilePath = fileSystem.AllFiles.Where(x => x.Contains("RenameLog")).FirstOrDefault(); string logContent = fileSystem.File.ReadAllText(logFilePath); logContent .Should().Contain("A.txt", "リネームログがあるはず"); logContent .Should().Contain("X.txt", "リネームログがあるはず"); }
public bool Initialize(SystemConfiguration configuration, IntPtr windowHandle) { try { // Create the Direct3D object. D3D = new DX11(); // Initialize the Direct3D object. if (!D3D.Initialize(configuration, windowHandle)) { MessageBox.Show("Could not initialize Direct3D", "Error", MessageBoxButtons.OK); return false; } // Create the camera object Camera = new Camera(); // Initialize a base view matrix the camera for 2D user interface rendering. Camera.SetPosition(0, 0, -10); Camera.Render(); var baseViewMatrix = Camera.ViewMatrix; // Create the model class. Model = new Model(); // Initialize the model object. if (!Model.Initialize(D3D.Device, "cube.txt", new[] { "seafloor.dds" })) { MessageBox.Show("Could not initialize the model object", "Error", MessageBoxButtons.OK); return false; } // Create the shader object. ClipPlaneShader = new ClipPlaneShader(); // Initialize the shader object. if (!ClipPlaneShader.Initialize(D3D.Device, windowHandle)) { MessageBox.Show("Could not initialize the shader", "Error", MessageBoxButtons.OK); return false; } // Create the light object. Light = new Light(); // Initialize the light object. Light.SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f); Light.SetDiffuseColor(1, 1, 1, 1f); Light.SetDirection(0, 0, 1); Light.SetSpecularColor(0, 1, 1, 1); Light.SetSpecularPower(16); if (SystemConfiguration.DebugWindowOn) { // Create the render to texture object. RenderTexture = new RenderTexture(); // Initialize the render to texture object. if (!RenderTexture.Initialize(D3D.Device, configuration)) return false; // Create the debug window object. DebugWindow = new DebugWindow(); // Initialize the debug window object. if (!DebugWindow.Initialize(D3D.Device, configuration.Width, configuration.Height, 100, 100 * configuration.Height / configuration.Width)) { MessageBox.Show("Could not initialize the debug window object.", "Error", MessageBoxButtons.OK); return false; } // Create the texture shader object. TextureShader = new TextureShader(); // Initialize the texture shader object. if (!TextureShader.Initialize(D3D.Device, windowHandle)) { MessageBox.Show("Could not initialize the texture shader object.", "Error", MessageBoxButtons.OK); return false; } } return true; } catch (Exception ex) { MessageBox.Show("Could not initialize Direct3D\nError is '" + ex.Message + "'"); return false; } }
public bool Initialize(SystemConfiguration configuration, IntPtr windowHandle) { try { // Create the Direct3D object. D3D = new DX11(); // Initialize the Direct3D object. if (!D3D.Initialize(configuration, windowHandle)) { MessageBox.Show("Could not initialize Direct3D", "Error", MessageBoxButtons.OK); return false; } // Create the camera object Camera = new Camera(); // Initialize a base view matrix the camera for 2D user interface rendering. Camera.SetPosition(0, 0, -1); Camera.Render(); var baseViewMatrix = Camera.ViewMatrix; // Create the text object. Text = new Text(); if (!Text.Initialize(D3D.Device, D3D.DeviceContext, windowHandle, configuration.Width, configuration.Height, baseViewMatrix)) { MessageBox.Show("Could not initialize the text object", "Error", MessageBoxButtons.OK); return false; } // Create the model class. Model = new Model(); // Initialize the model object. if (!Model.Initialize(D3D.Device, "sphere.txt", "seafloor.dds")) { MessageBox.Show("Could not initialize the model object", "Error", MessageBoxButtons.OK); return false; } // Create the light shader object. LightShader = new LightShader(); // Initialize the light shader object. if (!LightShader.Initialize(D3D.Device, windowHandle)) { MessageBox.Show("Could not initialize the light shader", "Error", MessageBoxButtons.OK); return false; } // Create the light object. Light = new Light(); // Initialize the light object. Light.SetAmbientColor(0.15f, 0.15f, 0.15f, 1.0f); Light.SetDiffuseColor(1, 0, 0, 1f); Light.SetDirection(1, 0, 1); Light.SetSpecularColor(0, 1, 1, 1); Light.SetSpecularPower(32); // Create the model list object. ModelList = new ModelList(); // Initialize the model list object. if (!ModelList.Initialize(25)) { MessageBox.Show("Could not initialize the model list object", "Error", MessageBoxButtons.OK); return false; } // Create the frustum object. Frustum = new Frustum(); return true; } catch (Exception ex) { MessageBox.Show("Could not initialize Direct3D\nError is '" + ex.Message + "'"); return false; } }