public void ApplyFixes(PlaceholderGeom geom, ScreenModel screenModel, IResizeRule resizeRule) { foreach (Fix fix in fixes) { fix.Apply(geom, screenModel, resizeRule); } }
public ActionResult GetScreen() { var mode = new ScreenModel(); try { var bitmap = ScreenCapturerServerManager.Capturer(); if (bitmap == null) { return(JsonError("没有截屏到")); } using var outputStream = new MemoryStream(); bitmap.Compress(Bitmap.CompressFormat.Jpeg, 75, outputStream); bitmap.Recycle(); var imageBytes = outputStream.ToArray(); var base64 = Convert.ToBase64String(imageBytes); mode.Type = "jpeg"; mode.Encoding = "base64"; mode.Data = base64; return(JsonSuccess(mode)); } catch (Exception e) { return(Html(e.Message)); } }
/// <summary> /// Fired when the duty cyle channel value changes /// </summary> /// <param name="value">new tag value</param> private void OnDutyCycleChannelValueChange(ITagValue value) { double newChannelValue = (double)value.Value; using (AcquireReadLock()) { // The visual parent is null if the item is deleted, this is not null for models that are within a container // and are not directly the children of the screen surface. if (VisualParent == null) { return; } ScreenModel screenModel = ScreenModel.GetScreen(this); screenModel.FromGatewayActionCollator.AddAction( _dutyCycleCollatorOwner, () => { using (AcquireReadLock()) { // The item could get deleted after the action has been dispatched. if (VisualParent != null) { DutyCycleChannelValue = newChannelValue; OnDutyCycleChannelValueChangedEvent(); } } }); } }
public bool GenerateScreen(ScreenModel model) { try { bool _result = false; OutputScreenGeneratorHelper generator = new OutputScreenGeneratorHelper(screenModel: model); _result = generator.Do(message: out string _message, screenXmlTextContent: out string xmlText); if (_result == false) { Console.WriteLine(_message); } XMLExportHelper export = new XMLExportHelper(xmlTextContent: xmlText, fileName: "Output.xml"); _result = export.Do(message: out _message); if (_result == false) { Console.WriteLine(_message); } return(_result); } catch (Exception) { return(false); } }
/// <summary> /// Fired when frequency channel value changes /// </summary> /// <param name="value">new tag value</param> private void OnFrequencyChannelValueChange(ITagValue value) { double newChannelValue = (double)value.Value; using (AcquireReadLock()) { // The visual parent is null if the item is deleted, this is not null for models that are within a container // and are not directly the children of the screen surface. if (VisualParent == null) { return; } ScreenModel screenModel = ScreenModel.GetScreen(this); // add an action to the collator. the collator will limit the number of actions coming from the gateway and only // process the most recent action. This keeps us from falling behind in time if we can't process the gateway updates as fast as they are received. screenModel.FromGatewayActionCollator.AddAction( _frequencyCollatorOwner, () => { using (AcquireReadLock()) { // The item could get deleted after the action has been dispatched. if (VisualParent != null) { if (!Equals(FrequencyChannelValue, newChannelValue)) { FrequencyChannelValue = newChannelValue; OnFrequencyChannelValueChangedEvent(); } } } }); } }
/// <summary> /// Loads the model. /// </summary> /// <returns></returns> public MobiseModel LoadModel() { System.Diagnostics.Debug.Assert(this.ParentProject != null, "Parent Project shouldn't be null"); System.Diagnostics.Debug.Assert(this.ParentProject.mobiseConfiguration != null, "Mobise configuration shouldn't be null"); string filePath = System.IO.Path.Combine(this.ParentProject.Path, this.Path); MobiseModel model = null; switch (this.FileType) { case Models.FileType.Model: model = new DatabaseModel(this.ParentProject); model.Name = this.Name; ((DatabaseModel)model).Path = filePath; break; case Models.FileType.Style: model = new ProjectThemesModel(); model.Name = this.Name; break; case FileType.ScreenDefinition: var def = this.ParentProject.mobiseConfiguration.Controls.FirstOrDefault(c => c.Name.Equals("screen", StringComparison.OrdinalIgnoreCase)); model = new ScreenModel(def, this.ParentProject); model.Name = this.Name; model.MobiseObjectID = this.MobiseObjectID; break; case FileType.CustomControl: def = this.ParentProject.mobiseConfiguration.Controls.FirstOrDefault(c => c.Name.Equals("view", StringComparison.OrdinalIgnoreCase)); model = new ScreenModel(def, this.ParentProject); model.Name = this.Name; model.MobiseObjectID = this.MobiseObjectID; break; case FileType.Controller: { string modelpath = System.IO.Path.Combine(this.ParentProject.Path, this.Path); if (System.IO.File.Exists(modelpath)) { XDocument doc = XDocument.Load(filePath); string controllerType = doc.Root.Attribute("type") != null?doc.Root.Attribute("type").Value : string.Empty; var cntDef = this.ParentProject.mobiseConfiguration.ControllerDefinitons.FirstOrDefault(c => c.Name.Equals(controllerType, StringComparison.OrdinalIgnoreCase)); if (cntDef != null) { model = new ControllerModel(cntDef, this.ParentProject); } } } break; default: model = null; break; } return(this.LoadModel(model)); }
/// <summary> /// /// </summary> /// <param name="screenModel"></param> /// <param name="area"></param> public void screenChanged(ScreenModel screenModel, Area area) { screenModel.getRGB(mBuffer, area, 1, 0); //synchronized (this) //{ // mBitmap.setPixels(mBuffer, 0, ScreenModel.WIDTH, 0, 0, // ScreenModel.WIDTH, ScreenModel.HEIGHT); // } }
public MovePlaceholderCommand(PlaceholderViewEventArgs args, PlaceHolderCollectionModel collectionModel, ScreenView screenView, ScreenModel screenModel, PlaceholderUserChangeValidator moveValidator) { this.args = args; this.collectionModel = collectionModel; this.screenView = screenView; this.screenModel = screenModel; this.moveValidator = moveValidator; }
public DeleteBackgroundCommand(IntEventArgs args, CollectionModel <BackgroundModel> backgroundCollection, ScreenModel screenModel, Database database, LocationModel locationModel, CollectionModel <ProfileModel> profileCollection) { this.args = args; this.backgroundCollection = backgroundCollection; this.screenModel = screenModel; this.database = database; this.locationModel = locationModel; this.profileCollection = profileCollection; }
public SelectBackgroundCommand(MenuButtonEventArgs args, ScreenModel screenModel, CollectionModel <BackgroundModel> backgroundCollection, PlaceHolderCollectionModel placeholderCollection, UserPreferencesModel preferences, Database database) { this.args = args; this.screenModel = screenModel; this.backgroundCollection = backgroundCollection; this.placeholderCollection = placeholderCollection; this.preferences = preferences; this.database = database; }
public ImportBackgroundCommand(ImportBackgroundEventArgs args, ScreenModel screenModel, LocationModel locationModel, Database database, CollectionModel <BackgroundModel> collection, PlaceHolderCollectionModel placeholderCollection) { this.args = args; this.screenModel = screenModel; this.locationModel = locationModel; this.database = database; this.collection = collection; this.placeholderCollection = placeholderCollection; }
public LayoutIOModel(HudOptionsParser parser, LocationModel location, PlaceHolderCollectionModel collection, ScreenModel screenModel, GraphicalAssetFactory assetFactory) { this.parser = parser; this.location = location; this.collection = collection; this.screenModel = screenModel; this.assetFactory = assetFactory; saveStatus = new SaveStatus(); currentR3eLayout = new SourceLayout(LayoutSourceType.R3E, location.HudOptionsFile, parser.Parse(location.HudOptionsFile), -1, -1); }
private static ScreenModel LoadLevelScreen(int stageIndex) { stageIndex++; ScreenModel model = ContentLoader.Instance.LoadScreen(ScreenContent.level); if (!model.path.Contains("Stage" + stageIndex)) { model.path += (stageIndex) + "/"; } return(model); }
public SaveProfileCommand(SelectedProfileModel profileSelection, PlaceHolderCollectionModel placeholderCollection, LocationModel location, ScreenModel screen, Database database, LayoutIOModel layoutIO, GraphicalAssetFactory assetFactory) { this.profileSelection = profileSelection; this.placeholderCollection = placeholderCollection; this.location = location; this.screen = screen; this.database = database; this.layoutIO = layoutIO; this.assetFactory = assetFactory; }
public static int UploadScreenLayout(string m_screenName, byte[] file, string[] screenZones) { List <ScreenZone> data2 = new List <ScreenZone>(); var path = string.Empty; var fileName = m_screenName; if (!Directory.Exists(ScreenLayoutFilePath)) { System.IO.Directory.CreateDirectory(ScreenLayoutFilePath); } path = Path.Combine(ScreenLayoutFilePath, m_screenName); ScreenModel data = new ScreenModel { ScreenName = m_screenName, ScreenLayoutLocation = path.ToString(), seatZones = screenZones }; foreach (string zone in screenZones) { ScreenZone screenZone = new ScreenZone { ScreenName = m_screenName, SeatZone = zone }; data2.Add(screenZone); } try { System.IO.File.WriteAllBytes(path, file); } catch (Exception e) { return(0); } string sql = @"insert into dbo.Screens(ScreenName, ScreenLayoutLocation) values (@ScreenName, @ScreenLayoutLocation);"; string sql2 = @"insert into dbo.SeatZones(ScreenName, SeatZone) values (@ScreenName, @SeatZone);"; int result = SQLDataAccess.SaveData(sql2, data2); if (result == data2.Count) { return(SQLDataAccess.SaveData(sql, data)); } else { return(0); } }
private static UiFlowScreenModel Map(InputScreen.ScreenModel src, ScreenModel destination) { var map = destination; map.StepValue1 = src.StepValue1; map.StepValue2 = src.StepValue2; map.RequiredOnlyIfNestedValue1DoesNotHaveAValue = src.RequiredOnlyIfNestedValue1DoesNotHaveAValue; map.StepValueNotUsedInTheViewShouldHaveAValue = src.StepValueNotUsedInTheViewShouldHaveAValue; map.Nested1 = src.Nested1.CloneDeep(); map.Nested2 = src.Nested2.CloneDeep(); map.SampleInput = src.StringValue; return(map); }
public static ScreenModel GetImageChange(Bitmap image) { var screenModel = new ScreenModel { Rectangle = Rectangle.Empty, ScreenBitmap = null }; NewBitmap = image; if (NewBitmap == null) { return(screenModel); } lock (NewBitmap) { if (PrevBitmap != null) { screenModel.Rectangle = GetBoundingBoxForChanges(ref PrevBitmap, ref NewBitmap); if (screenModel.Rectangle == Rectangle.Empty) { return(screenModel); } // Get the minimum rectangular area // //diff = new Bitmap(bounds.Width, bounds.Height); PrevBitmap = NewBitmap; Bitmap diff = new Bitmap(screenModel.Rectangle.Width, screenModel.Rectangle.Height); Graphics g = Graphics.FromImage(diff); g.DrawImage(NewBitmap, 0, 0, screenModel.Rectangle, GraphicsUnit.Pixel); g.Dispose(); screenModel.ScreenBitmap = diff; } else { // Create a bounding rectangle. // screenModel.Rectangle = new Rectangle(0, 0, NewBitmap.Width, NewBitmap.Height); // Set the previous bitmap to the current to prepare // for the next screen capture. // screenModel.ScreenBitmap = NewBitmap.Clone(screenModel.Rectangle, NewBitmap.PixelFormat); PrevBitmap = NewBitmap; } } GC.Collect(); GC.WaitForPendingFinalizers(); return(screenModel); }
public CreateProfileCommand(StringEventArgs args, CollectionModel <ProfileModel> profileCollection, Database database, LocationModel location, ScreenModel screen, PlaceHolderCollectionModel placeholderCollection, SelectedProfileModel selectedProfile, LayoutIOModel layoutIO, GraphicalAssetFactory assetsFactory) { this.args = args; this.profileCollection = profileCollection; this.database = database; this.location = location; this.screen = screen; this.placeholderCollection = placeholderCollection; this.selectedProfile = selectedProfile; this.layoutIO = layoutIO; this.assetsFactory = assetsFactory; }
public IActionResult GetScreenDataByDate(DateTime date) { try { ScreenModel model = new ScreenModel(date, dao); string json = model.ToJson(); Debug.WriteLine(json); return(Ok(model)); } catch (Exception e) { return(HandleGetException(e)); } }
public ActionResult Edit(ScreenModel model) { try { _screenService.Update(Mapper.Map <ScreenModel, Screen>(model), CurrentUser.UserId); ShowMessageDialog(MensagensResource.SucessoAtualizar, Message.MessageKind.Success); } catch (Exception e) { ShowMessageDialog(MensagensResource.ErroAtualizar, e); } return(RedirectToAction("Index")); }
/// <summary> /// Called when the view model observes a change in a model property. /// Used to reflect model property changes on the VeriStand gateway (when necessary). /// </summary> /// <param name="modelElement">The model whose property changed. Unused by this method.</param> /// <param name="propertyName">The name of the property that changed.</param> /// <param name="transactionItem">The transaction item associated with the property change.</param> public void PropertyChanged(Element modelElement, string propertyName, TransactionItem transactionItem) { ScreenModel owningScreen = ScreenModel.GetScreen(this); switch (propertyName) { case DutyCycleChannelName: HandleChannelChangeAsync(transactionItem, owningScreen, OnDutyCycleChannelValueChange).IgnoreAwait(); break; case FrequencyChannelName: HandleChannelChangeAsync(transactionItem, owningScreen, OnFrequencyChannelValueChange).IgnoreAwait(); break; } }
public JsonResult Save([Bind(Include = "Id, ScreenCode, ModuleId, Title, Type, URL, IsActive")] ScreenModel screen, bool isInsert) { if (isInsert) { screen.SetCreateProperties(LoginInformation.UserInformation.Id); screen.Id = _screenService.Insert(screen); } else { screen.SetUpdateProperties(LoginInformation.UserInformation.Id); _screenService.Update(screen); } return(new JsonResult { Data = screen }); }
public GameScreen Setup(ScreenModel screenModel) { size = new Vector2Int(screenModel.Width, screenModel.Height); foreach (ITilemapGenerator tilemapGenerator in GetComponentsInChildren <ITilemapGenerator>()) { tilemapGenerator.Generate(screenModel.TileStack.Pop()); } foreach (ScreenBorder border in GetComponentsInChildren <ScreenBorder>()) { border.SetupBorderSize(this); } return(this); }
public bool GenerateOTX(ScreenModel model) { bool _result = false; try { //это пяти значная цифра - параметр сервиса из PDX (по сути это DID - diagnostic ID) List <int> services_Request_PARAM_ID_List = new List <int>(); //это значение, посылаемое в сервис по выбранному DID. Например: "Disabe" или "Enable" (для дискретных сервисов) List <string> services_SIGNAL_VALUE_List = new List <string>(); //список из объектов "сервис". Объекты предопределены в справочнике "SERVICES_handbook" - namespace GXRG.Data > SERVICE.cs List <SERVICE> servicesList = new List <SERVICE>(); //по входной модели данных (model) инициализируем 3 списка, объявленных выше DefineREFS_ListsAboutServices(model, out services_Request_PARAM_ID_List, out services_SIGNAL_VALUE_List, out servicesList); //объявляем генератор OTX, передавая 3 инициализированных списка var generator = new GXRG.Services.OTX.OutputOTXGeneratorHelper(services_Request_PARAM_ID_List, services_SIGNAL_VALUE_List, servicesList); //генерация. Выходной параметр message скажет о статусе операции. Параметр sourcestring вернет XML текст нового OTX _result = generator.Do(message: out string _message, sourcestring: out string xmlText); if (_result == false) { Console.WriteLine(_message); } //объявлем хелпер по экспорту XML, указывая в качесте параметра XML текст-контент, а также имя файла XMLExportHelper export = new XMLExportHelper(xmlTextContent: xmlText, fileName: "OutputControl.otx"); //экспорт, создание нового файла OTX _result = export.Do(message: out _message); if (_result == false) { Console.WriteLine(_message); } return(_result); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return(false); } }
public SelectProfileCommand(MenuButtonEventArgs args, CollectionModel <ProfileModel> profileCollection, SelectedProfileModel selectedProfile, CollectionModel <BackgroundModel> backgroundCollection, ScreenModel screen, LocationModel location, PlaceHolderCollectionModel placeholderCollection, SelectionModel selectionModel, LayoutIOModel layoutIO, GraphicalAssetFactory assetFactory, CollectionModel <MotecModel> motecCollection) { this.args = args; this.profileCollection = profileCollection; this.selectedProfile = selectedProfile; this.backgroundCollection = backgroundCollection; this.screen = screen; this.location = location; this.placeholderCollection = placeholderCollection; this.selectionModel = selectionModel; this.layoutIO = layoutIO; this.assetFactory = assetFactory; this.motecCollection = motecCollection; }
public static ScreenModel GetImageChange(Bitmap image) { var screenModel = new ScreenModel { Rectangle = Rectangle.Empty, ScreenBitmap = null }; NewBitmap = image; if (NewBitmap == null) { return(screenModel); } lock (NewBitmap) { if (PrevBitmap != null) { screenModel.Rectangle = GetBoundingBoxForChanges(ref PrevBitmap, ref NewBitmap); if (screenModel.Rectangle == Rectangle.Empty) { return(screenModel); } // Get the minimum rectangular area // //diff = new Bitmap(bounds.Width, bounds.Height); screenModel.ScreenBitmap = NewBitmap.Clone(screenModel.Rectangle, NewBitmap.PixelFormat); PrevBitmap = NewBitmap; } else { // Create a bounding rectangle. // screenModel.Rectangle = new Rectangle(0, 0, NewBitmap.Width, NewBitmap.Height); // Set the previous bitmap to the current to prepare // for the next screen capture. // screenModel.ScreenBitmap = NewBitmap.Clone(screenModel.Rectangle, NewBitmap.PixelFormat); PrevBitmap = NewBitmap; } } return(screenModel); }
static bool ExportPhrases(ScreenModel screenModel, exportTypeFor exportTypeFor) { bool _result = false; //список из строк, где элемент - объект фразы из модели данных var listOfPhrases = screenModel.ScreenItems.Select(x => x.Phrase).ToList(); ExportKeyValuePhrases export = new ExportKeyValuePhrases(phrases: listOfPhrases, exportTypeFor: exportTypeFor); _result = export.Do(out _message); if (_result == false) { throw new Exception(_message); } return(_result); }
public async Task <IActionResult> OnGetSeats(int movieId, int showTimeId) { var content = await clientHelper.GetAsync($"screens/{movieId}/{showTimeId}"); Screen = await content.ReadAsAsync <ScreenModel>(); var contentBookedSeats = await clientHelper.GetAsync($"seats/booked/{movieId}/{showTimeId}"); var bookedSeats = await contentBookedSeats.ReadAsAsync <SeatModel[]>(); foreach (var seat in Screen.Seats.Where(s => bookedSeats.Any(bs => bs.SeatId == s.SeatId))) { seat.IsBooked = true; } return(Page()); }
public ActionResult Synchronize() { try { var model = new ScreenModel(); var controllersList = model.MapperControllers(); _screenService.Synchronize(controllersList, CurrentUser.UserId); ShowMessageDialog("Screens synchronized successfully", Message.MessageKind.Success); } catch (Exception e) { ShowMessageDialog(MensagensResource.ErroCadastrar, e); } return(RedirectToAction("Index")); }
/// <summary> ///Factory Method /// </summary> /// <param name="screenModel">Screen Type</param> /// <returns>Asıl ürünü tasıyan referans</returns> public Screen ScreenFactory(ScreenModel screenModel) { Screen screen = null; switch (screenModel) { case ScreenModel.Windows: screen = new WinScreen(); break; case ScreenModel.Web: screen = new WebScreen(); break; case ScreenModel.Mobile: screen = new MobileScreen(); break; default: break; } return(screen); }