/// <summary> /// Connect/disconnect the digital system. /// </summary> internal void SystemConnect() { Cursor.Current = Cursors.WaitCursor; try { OTCContext.Project.DigitalSystem?.Connect(); } catch (Exception ex) { StudioContext.LogError(ex.Message); } this.RefreshStatus(); Cursor.Current = Cursors.Default; }
private void FeedbackStatusReceived(IFeedbackStatusChanged command) { Element element; foreach (FeedbackPointAddressStatus status in command.ReportedStatuses) { element = Element.GetByFeedbackAddress(command.Address, status.PointAddress); if (element != null) { if (element.FeedbackStatus != status.Active) { element.SetFeedbackStatus(status.Active); StudioContext.LogInformation("Accessory {0:D4}:{1} changed to status {2}", command.Address, status.PointAddress, (status.Active ? "HIGH" : "LOW")); } } } }
public void ExportUIElementAsImage(UIElement element, Rect cropRect) { //Add some margin to the image cropRect.Inflate(cropRect.Width / 40, cropRect.Height / 40); if (!StudioContext.IsProjectLoaded(true)) { return; } var currentProj = StudioContext.CurrentProject(); var resolution = 200; var scale = resolution / 96d; var target = new RenderTargetBitmap((int)(scale * (element.RenderSize.Width)), (int)(scale * (element.RenderSize.Height)), scale * 96, scale * 96, PixelFormats.Pbgra32); target.Render(element); var encoder = new PngBitmapEncoder(); var outputFrame = BitmapFrame.Create(target); encoder.Frames.Add(outputFrame); var dir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "ANA Conversation Studio"); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } var fileName = currentProj.Name + " " + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + ".png"; var fullPath = Path.Combine(dir, fileName); using (var ms = new MemoryStream()) { encoder.Save(ms); ms.Position = 0; var bmp = new System.Drawing.Bitmap(ms); var croppedBmp = CropImage(bmp, new System.Drawing.Rectangle((int)(cropRect.X * scale), (int)(cropRect.Y * scale), (int)(cropRect.Width * scale), (int)(cropRect.Height * scale))); using (var file = File.OpenWrite(fullPath)) croppedBmp.Save(file, System.Drawing.Imaging.ImageFormat.Jpeg); } Process.Start("explorer", "/select," + fullPath); }
public void Initialize(params object[] args) { this.ShowPanels(); this.RefreshStatus(); chkOptionsExecuteActions.Checked = OTCContext.Project.ExecuteBlockActions; chkOptionsManualSensorAllowed.Checked = OTCContext.Project.AllowManualSensorActivation; // Register project events OTCContext.Project.DigitalSystem.InformationReceived += DigitalSystem_OnInformationReceived; OTCContext.Project.DigitalSystem.CommandReceived += DigitalSystem_OnCommandReceived; // Initialize the management panels rmaRoutes.RefreshRouteList(); tscTrains.RefreshTrainList(); // Show module information StudioContext.LogInformation("{0} v{1} loaded", this.Description.Caption, Application.ProductVersion); }
public ExpandedFilms(Films films, StudioContext context) { Name = films.Name; Duration = films.Duration; Year = films.Year; Age = films.Age; Description = films.Description; Img = films.Img; Id = films.Id; CountryId = films.CountryId; string sql = "select Genres.* " + "from Films inner join (FilmGenres inner join Genres on Genres.Id = FilmGenres.GenresId) on Films.Id = FilmGenres.FilmsId " + "where Films.Name = '" + Name + "'"; Genres = context.Genres.FromSqlRaw(sql).Select(g => g.Name).ToList(); string sql2 = "select Actors.* " + "from Films inner join (FilmActors inner join Actors on Actors.Id = FilmActors.ActorsId) on Films.Id = FilmActors.FilmsId " + "where Films.Name = '" + Name + "'"; Actors = context.Actors.FromSqlRaw(sql2).Select(g => g.Name).ToList(); }
/// <summary> /// Connect/disconnect the digital system. /// </summary> internal void SystemConnect() { Cursor.Current = Cursors.WaitCursor; try { // Register project events OTCContext.Project.DigitalSystem.InformationReceived += DigitalSystem_OnInformationReceived; OTCContext.Project.DigitalSystem.CommandReceived += DigitalSystem_OnCommandReceived; OTCContext.Project.DigitalSystem?.Connect(); } catch (Exception ex) { StudioContext.LogError(ex.Message); } this.RefreshStatus(); Cursor.Current = Cursors.Default; }
private void DigitalSystem_OnInformationReceived(object sender, Otc.Systems.SystemConsoleEventArgs e) { switch (e.Type) { case SystemConsoleEventArgs.MessageType.Error: StudioContext.LogError(e.Message); break; case SystemConsoleEventArgs.MessageType.Warning: StudioContext.LogWarning(e.Message); break; case SystemConsoleEventArgs.MessageType.Debug: StudioContext.LogDebug(e.Message); break; default: StudioContext.LogInformation(e.Message); break; } }
protected override void Awake() { if (Paths.ProcessName.Contains("KoikatuVR")) { Destroy(this); return; } base.Awake(); VRLoader.OnVRSuccess += () => { if (Paths.ProcessName == "CharaStudio") { VRManager.Create <KKCharaStudioInterpreter>(StudioContext.CreateContext("KKCSVRContext.xml")); } else { VRManager.Create <KoikatuInterpreter>(MainGameContext.CreateContext("VRContext.xml")); } }; }
internal void PrintDigitalReportBySections() { try { // Generate the report DigitalReportByModule rpt = new DigitalReportByModule(); rpt.CreateDocument(); // Generate the cover CoverReport cover = new CoverReport(rpt.DisplayName); cover.CreateDocument(); // Merge the documents rpt.Pages.Insert(0, cover.Pages[0]); // Open the document into the repport viewer plug-in StudioContext.OpenPluginModule(PluginManager.PLUGIN_REPORTVIEWER, rpt); } catch (Exception ex) { MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Opens the last used project (if exists). /// </summary> internal async Task ProjectOpenLast() { if (!StudioContext.OpenLastProject) { return; } else if (!File.Exists(StudioContext.LastOpenedProjectFile)) { return; } beiProgress.Visibility = DevExpress.XtraBars.BarItemVisibility.Always; await OTCContext.OpenProject(StudioContext.LastOpenedProjectFile); this.RefreshViewStatus(); // Show information in console StudioContext.LogInformation("Project {0} loaded (from {1})", OTCContext.Project.Name, StudioContext.LastOpenedProjectFile); beiProgress.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; return; }
/// <summary> /// Construtor da Classe PessoaModel /// </summary> /// <param name="pessoaContext"></param> public PessoaModel(StudioContext pessoaContext) { this._context = pessoaContext; }
public ProducersController(StudioContext context) { _context = context; }
public FilmGenresController(StudioContext context) { _context = context; }
public UserRepository(StudioContext context) : base(context) { }
public AlbumsController(StudioContext context) { _context = context; }
public EquipmentQrController(QrHandler handler, StudioContext context) { _handler = handler; _context = context; }
public CountriesController(StudioContext context) { _context = context; }
public FilmActorsController(StudioContext context) { _context = context; }
public AuthController(IAppSettings settings, StudioContext context, IPasswordHash passwordHash) { _settings = settings; _context = context; _passwordHash = passwordHash; }
public PhotoEditor(string filename) { loadingImage = new PictureBox(); loadingImage.Image = Properties.Resources.material_loading; loadingImage.BackgroundImageLayout = ImageLayout.Zoom; loadingImage.BackColor = Color.Transparent; loadingImage.Location = new Point(0, 0); loadingImage.Size = new Size(100, 100); loadingImage.SizeMode = PictureBoxSizeMode.Zoom; Controls.Add(loadingImage); pic = new PictureBox(); pic.Location = new Point(10, 100); pic.SizeMode = PictureBoxSizeMode.Zoom; pic.BackgroundImageLayout = ImageLayout.Zoom; Controls.Add(pic); colors = new ListBox(); colors.Location = new Point(500, 150); colors.Size = new Size(250, 500); colors.Font = new Font("Arial", 12f); colors.MinimumSize = new Size(100, 100); colors.MouseDown += itemClick; Controls.Add(colors); colorsLabel = new Label(); colorsLabel.Font = new Font("Arial", 12f); colorsLabel.Location = new Point(500, 100); colorsLabel.ForeColor = Color.White; colorsLabel.AutoSize = false; colorsLabel.Height = colorsLabel.PreferredHeight; colorsLabel.Width = 250; colorsLabel.Text = "Colors present in image"; Controls.Add(colorsLabel); selectedColorLabel = new Label(); selectedColorLabel.AutoSize = false; selectedColorLabel.Font = new Font("Arial", 12f); selectedColorLabel.Width = 250; selectedColorLabel.Location = new Point(700, 100); selectedColorLabel.ForeColor = Color.White; selectedColorLabel.Text = "Selected Color"; Controls.Add(selectedColorLabel); selectedColor = new Panel(); selectedColor.Size = new Size(100, 100); selectedColor.Location = new Point(700, 175); selectedColor.BackColor = Color.White; Controls.Add(selectedColor); MinimumSize = new Size(500, 500); pic.MouseClick += delegate(object o, MouseEventArgs args) { Color c = new Bitmap(pic.BackgroundImage).GetPixel(args.Location.X, args.Location.Y); selectedColor.BackColor = c; selectedColor.Invalidate(); selectedColorLabel.Text = string.Format("Selected Color {0}{1}{0}[{2},{3}]", "\n ", c.toHex(), args.Location.X, args.Location.Y); selectedColorLabel.Height = selectedColorLabel.PreferredHeight; }; Resize += delegate { int left = pic.Left + pic.Width + 100; colors.Left = left; colorsLabel.Left = left; selectedColorLabel.Left = selectedColor.Left = left + 300; colors.Height = (int)(pic.Height * .75); }; FormClosed += delegate { StudioContext.getCurrentInstance().formClosed(this); }; LoadImage(filename); }
public OutputOrderHandler(StudioContext context) { _context = context; }
public MusiciansController(StudioContext context) { _context = context; }
public AddressesController(StudioContext context) { _context = context; }
public PhotoShootController(StudioContext context, CurrentUserInfo userInfo) { (_context, _currentUser) = (context, userInfo); }
public CurrentUserInfo(IHttpContextAccessor httpContext, StudioContext context) { _httpContext = httpContext; _context = context; }
internal void EditItem() { if (grdDataView.SelectedRowsCount <= 0) { MessageBox.Show("You must select the row you want to edit.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } // Get the current row int[] rows = grdDataView.GetSelectedRows(); ORMIdentifiableEntity row = grdDataView.GetRow(rows[0]) as ORMIdentifiableEntity; if (row == null) { return; } if (this.CurrentFileType != FileType.Unknown) { switch (this.CurrentFileType) { case FileType.Categories: Category category = Category.Get(row.ID); if (category != null) { CategoryEditorView formCategoryEditor = new CategoryEditorView(category); formCategoryEditor.ShowDialog(); } break; case FileType.Manufacturers: Manufacturer manufacturer = Manufacturer.Get(row.ID); if (manufacturer != null) { ManufacturerEditorView formStore = new ManufacturerEditorView(manufacturer); formStore.ShowDialog(); } break; case FileType.Stores: Store store = Store.Get(row.ID); if (store != null) { StoreEditorView formStore = new StoreEditorView(store); formStore.ShowDialog(); } break; case FileType.Gauges: Rwm.Otc.Trains.Gauge scale = Rwm.Otc.Trains.Gauge.Get(row.ID); if (scale != null) { GaugeEditorView formScale = new GaugeEditorView(scale); formScale.ShowDialog(); } break; case FileType.Decoders: TrainDecoder decoder = TrainDecoder.Get(row.ID); if (decoder != null) { DecoderEditorView formDecoder = new DecoderEditorView(decoder); formDecoder.ShowDialog(); } break; case FileType.RailwayCompanies: Company admin = Company.Get(row.ID); if (admin != null) { CompanyEditorView formAdmin = new CompanyEditorView(admin); formAdmin.ShowDialog(); } break; default: break; } } else if (this.CurrentCategory != null) { StudioContext.OpenPluginModule(ModelModuleDescriptor.MODULE_GUID, row.ID); } this.Refresh(); }
public OutputEquipmentDetailsHandler(StudioContext context) { _context = context; }
public PackageController(StudioContext context, IPictureStorage <Package, int> pictureStorage) { (_context, _pictureStorage) = (context, pictureStorage); }
public StudioController(StudioContext context) { _context = context; }
public CategoryRepository(StudioContext context) : base(context) { }