public void RemoveStaticPage(StaticPage pageToRemove) { var repo = StaticFactory.CreateStaticPageRepository(); repo.DeleteTagStaticBridgeTable(pageToRemove); repo.RemoveStaticPage(pageToRemove); }
public List <StaticPage> GetAllPages() { var repo = StaticFactory.CreateStaticPageRepository(); var page = repo.GetAllPages(); return(page); }
public void addStaticPageCheckTheDelete() { var repo = StaticFactory.CreateStaticPageRepository(); StaticPage page = new StaticPage(); page.Name = "Anime"; page.Body = "Anime stuff"; page.Category = Category.Anime; page.Approved = Approved.Yes; page.DateCreated = DateTime.Today; repo.AddStaticPage(page); List <StaticPage> pages = repo.GetAllPages(); StaticPage check = pages.Last(); Assert.AreEqual("Anime", check.Name); Assert.AreEqual("Anime stuff", check.Body); //Assert.AreEqual(Anime, check.Category); //Assert.AreEqual("Yes", check.Approved); repo.RemoveStaticPage(page); Assert.IsNull(repo.GetPageByID(page.Id)); }
/// <summary> /// Deletes selected set folder physically and rerenders the set list /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void OnBtnDelMainClickEventRaised(object sender, EventArgs e) { if (SetModel.SelectedSet != null) { DeleteSet.Delete(SetModel.SelectedSet); _setModels = StaticFactory.CreateAllSets(); //Renew all set list SetListboxInit(); } }
public void TestMethod3() { _blackPerson = StaticFactory <IPerson> .CreateObject(typeof(BlackPerson)); _whitePerson = StaticFactory <IPerson> .CreateObject(typeof(BlackPerson)); _blackPerson.Move(); _whitePerson.Move(); }
static void Main() { MainViewPresenter mainPresenter = (MainViewPresenter)StaticFactory.CreateMainViewPresenter(); mainPresenter.ShowMain(); Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); Application.Run(); }
public void AddStaticPage(StaticPage pageToAdd) { var repo = StaticFactory.CreateStaticPageRepository(); repo.AddStaticPage(pageToAdd); foreach (var tag in pageToAdd.Tag) { InsertTagStaticBridgeTable(tag.Id, pageToAdd.Id); } }
/// <summary> /// Open 'AddSetView' within MainView when clicking on MainView's 'btnAdd' /// </summary> private void AddSetPresenterInit(object sender, EventArgs e) { _addSetPresenter = (AddSetPresenter)StaticFactory.CreateAddSetPresenter(_mainView); _addSetPresenter.OnSubmitClicked += OnAddSetViewSubmitClicked; _mainView.btnBack.Visible = true; _mainView.btnAdd.Visible = false; _mainView.btnDel.Visible = false; _mainView.btnRename.Visible = false; _setlistboxPresenter.CloseSetlistbox(); //Close setlistbox _addSetPresenter.ShowAddSetView(); }
private void PlayVideo(int index) { string videoPath = Path.Combine(Base._setsFolder, SetModel.SelectedSet, SetModel.SelectedTopic, "Videos"); string[] videos = Directory.GetFiles(videoPath); //Open on click FileInfo file = new FileInfo(videos[index]); VideoViewPresenter _vwp = StaticFactory.CreateVideoViewPresenter(_mainView, file); _vwp.ShowVideoView(); }
public void EditStaticPage(StaticPage pageToEdit) { var repo = StaticFactory.CreateStaticPageRepository(); repo.DeleteTagStaticBridgeTable(pageToEdit); foreach (var tag in pageToEdit.Tag) { repo.InsertTagStaticBridgeTable(tag.Id, pageToEdit.Id); } repo.EditStaticPage(pageToEdit); }
/// <summary> /// Initialize SetListbox in MainView.MainPanel control list /// </summary> private void SetListboxInit() { if (_setlistboxPresenter != null) { _setlistboxPresenter.CloseSetlistbox(); //Dispose of setlistboxPresenter } _mainView.btnBack.Visible = false; _mainView.btnAdd.Visible = true; _mainView.btnDel.Visible = true; _setlistboxPresenter = (SetlistboxPresenter)StaticFactory.CreateSetlistboxPresenter(_mainView, _setModels); //Create and load setlist presenter //Set double click @ main view _setlistboxPresenter.OnSetDoubleClicked += OnOnSetDoubleClickedEventRaised; }
/// <summary> /// Open set rename dialog /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void OnRenameBtnClickEventRaised(object sender, EventArgs e) { //TODO: Check why SetListbox doesn't update after renaming set if (SetModel.SelectedSet != null) { //Check for illegal characters SetNameUpdater _setNameUpdater = StaticFactory.CreateSetNameUpdater(); _setNameUpdater.inputNewSetTitle.TextChanged += (o, a) => { string illegalChars = "^[\\w ]+$"; Regex regex = new Regex(illegalChars); if (_setNameUpdater.inputNewSetTitle.Text == "" || !regex.IsMatch(_setNameUpdater.inputNewSetTitle.Text)) { _setNameUpdater.SetNameUpdaterBtnSubmit.Visible = false; _setNameUpdater.WarningLabel.Visible = true; } else { _setNameUpdater.SetNameUpdaterBtnSubmit.Visible = true; _setNameUpdater.WarningLabel.Visible = false; } }; //Create setNameUpdater window & _setNameUpdater.StartPosition = FormStartPosition.Manual; _setNameUpdater.Location = new System.Drawing.Point(this._mainView.Location.X + 430, this._mainView.Location.Y + 400); DialogResult updateDialog = _setNameUpdater.ShowDialog(_mainView); //If submit btn = pressed, rename set folder name if (updateDialog == DialogResult.OK) { if (_setlistboxPresenter._setlistboxView.HomeSetList.SelectedItem != null) { //Rename set folder name UpdateSet.Update(_setlistboxPresenter._setlistboxView.HomeSetList.SelectedItem.Text, _setNameUpdater.inputNewSetTitle.Text); //Rebuild setlistbox item list _setlistboxPresenter._setlistboxView.HomeSetList.Items.Clear(); _setModels = StaticFactory.CreateAllSets(); SetListboxInit(); _setlistboxPresenter._setlistboxView.HomeSetList.SelectedIndex = 0; } } } }
public void OnOnSetDoubleClickedEventRaised(object sender, EventArgs e) { if (SetModel.SelectedSet != null) { SetModel.SelectedSet = _setlistboxPresenter._setlistboxView.HomeSetList.SelectedItem.Text; _setlistboxPresenter.CloseSetlistbox(); _setViewPresenter = StaticFactory.CreateSetViewPresenter(_mainView); //New SetViewPresenter on DCLICK _setViewPresenter.ShowSetView(); _mainView.btnRename.Visible = false; _mainView.btnAdd.Visible = false; _mainView.btnDel.Click -= OnBtnDelMainClickEventRaised; _mainView.btnBack.Visible = true; } }
public void TestUser() { User alex = StaticFactory.CreateDefaultUser(); Console.WriteLine(alex.ToString()); User anton = StaticFactory.CreateUserByBirthYear(1983); Console.WriteLine(anton.ToString()); anton.AddFirstName("anton"); Console.WriteLine(anton.ToString()); User ivan = StaticFactory.CreateDefaultUser().AddFirstName("ivan"); Console.WriteLine(ivan.ToString()); }
public CodeGenerator() { varTable = new Stack<Dictionary<string, ZOperand>>(); typeTable = new Dictionary<string, Type>(); typeStack = new Stack<TypeGen>(); funcStack = new Stack<CodeGen>(); name = "ZodiacConsole"; var exeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (exeDir == null) return; var exeFilePath = Path.Combine(exeDir, name + ".exe"); Directory.CreateDirectory(exeDir); ag = new AssemblyGen(name, new CompilerOptions() { OutputPath = exeFilePath }); st = ag.StaticFactory; exp = ag.ExpressionFactory; tm = ag.TypeMapper; }
/// <summary> /// Creates a unique instance of the plugin type, with new /// instances of all native-code instances needed to access /// the entire hardware API. /// </summary> public ImplantJSInstance CreateInstance(JavascriptImplant parent) { var implant = ImplantFactory.Construct(parent); implant.osc = OscFactory.Construct(parent); implant.pads = PadFactory.Construct(parent); implant.knobs = KnobFactory.Construct(parent); implant.keys = KeysFactory.Construct(parent); implant.gui = GuiFactory.Construct(parent); implant.time = TimeFactory.Construct(parent); implant.settings = SettingsFactory.Construct(parent); implant.shared = StaticFactory.Construct(parent); implant.session = SessionFactory.Construct(parent); implant.mode = ModesFactory.Construct(parent); return(implant); }
public MethodContext(MethodGenInfo method, ILGenerator il, ITypeMapper typeMapper) { if (il == null) { throw new ArgumentNullException(nameof(il)); } if (typeMapper == null) { throw new ArgumentNullException(nameof(typeMapper)); } _method = method; _il = il; TypeMapper = typeMapper; ExpressionFactory = new ExpressionFactory(typeMapper); StaticFactory = new StaticFactory(TypeMapper); SupportsScopes = !method.IsDynamicGen; ParameterTypes = method.Parameters.Select(p => p.Type).ToArray(); IsParameterArray = method.Parameters.LastOrDefault().IsParameterArray; }
public StaticPage GetPostByID(int id) { StaticResponse response = new StaticResponse(); var repo = StaticFactory.CreateStaticPageRepository(); var page = repo.GetPageByID(id); if (page != null) { response.Success = true; response.Message = "It worked!"; response.StaticPage = page; } else { response.Success = false; response.Message = "Post not found!"; } return(page); }
/// <summary> /// Creates new topic folder, it's subdir's and <SetModel.SelectedTopic>.rtf /// </summary> private void CreateTopic() { string newTopicName = _setView.InputNewTopicName.Text; SetModel.SelectedTopic = newTopicName; //Update selectedTopic to newly created //Prep folders for the new topic CreateTopicFolderStructure(SetModel.SelectedSet, newTopicName); string path = SaveTopic.Save(SetModel.SelectedSet, _setView.InputNewTopicName.Text); //Save file //TODO: Implement "Update videoListView.Items ON _setView.BtnNewOldTopicSave.Click using (StreamWriter sw = new StreamWriter(path)) { sw.Write(_setView.MainContent.Rtf); } _setView.TopicListbox.Items.Clear(); _setModel = StaticFactory.GetSelectedSetModel(SetModel.SelectedSet); }
public SetViewPresenter(MainView mainView, SetView setView) { _setView = setView; _mainView = mainView; _mainView.btnDel.Click += BtnDelDeleteTopic_Click; _setView.btnCode.Click += BtnCode_Click; _setView.btnBold.Click += BtnBold_Click; _setView.btnUnderline.Click += BtnUnderline_Click; _setView.btnItalic.Click += BtnItalic_Click; _setView.MainContent.SelectionChanged += MainContent_SelectionChanged; _setView.MainContent.KeyDown += MainContent_KeyDown; _setView.btnClear.Click += BtnClear_Click; _setView.InputNewTopicName.TextChanged += InputNewTopicName_TextChanged; _setView.btnNewOldTopicSave.Click += OnBtnNewOldTopicSave_Click; _setModel = StaticFactory.GetSelectedSetModel(SetModel.SelectedSet); _setView.TopicListbox.MouseClick += TopicListbox_MouseClicked; _setView.btnAddVideos.MouseClick += BtnAddVideos_MouseClick; _setView.TopicListbox.SelectedIndex = 0; PopulateTopicListbox(); }
/// <summary> /// BtnBack click logic /// </summary> public void OnBtnBackClickEventRaised(object sender, EventArgs e) { if (_mainView.MainPanel.Controls[0].Name == "AddSetViewOuterPanel") { _addSetPresenter.Dispose(); _mainView.MainPanel.Controls.Clear(); SetListboxInit(); //Init new SetListbox _mainView.btnBack.Visible = false; _mainView.btnAdd.Visible = true; _mainView.btnDel.Visible = true; _mainView.btnRename.Visible = true; } if (_mainView.MainPanel.Controls[0].Name == "SetViewMainPanel") { _setViewPresenter.Dispose(); _mainView.MainPanel.Controls[0].Dispose(); _mainView.MainPanel.Controls.Clear(); SetListboxInit(); _mainView.btnBack.Visible = false; _mainView.btnAdd.Visible = true; _mainView.btnDel.Visible = true; _mainView.btnDel.Click -= _setViewPresenter.BtnDelDeleteTopic_Click; _mainView.btnDel.Click += OnBtnDelMainClickEventRaised; _mainView.btnRename.Visible = true; } if (_mainView.MainPanel.Controls[0].Name == "videoPanel") { _mainView.MainPanel.Controls[0].Dispose(); _mainView.MainPanel.Controls.Clear(); _setViewPresenter = StaticFactory.CreateSetViewPresenter(_mainView); //New SetViewPresenter on DCLICK _setViewPresenter.ShowSetView(); } }
void Initialize(Universe universe, string assemblyName, AssemblyBuilderAccess access, CompilerOptions options, ITypeMapper typeMapper = null) { if (universe == null) throw new ArgumentNullException(nameof(universe)); if (options == null) throw new ArgumentNullException(nameof(options)); _compilerOptions = options; if (typeMapper == null) #if FEAT_IKVM typeMapper = new TypeMapper(universe); #else typeMapper = new TypeMapper(); #endif ExpressionFactory = new ExpressionFactory(typeMapper); StaticFactory = new StaticFactory(typeMapper); #if SILVERLIGHT bool save = false; #else bool save = (access & AssemblyBuilderAccess.Save) != 0; #endif string path = options.OutputPath; if (path == null && save) throw new ArgumentNullException("options.OutputPath"); Universe = universe; TypeMapper = typeMapper; _access = access; if (Helpers.IsNullOrEmpty(assemblyName)) { if (save) throw new ArgumentNullException(nameof(assemblyName)); assemblyName = Guid.NewGuid().ToString(); } string moduleName = path == null ? assemblyName : assemblyName + Path.GetExtension(path); _fileName = path; AssemblyName an = new AssemblyName(); an.Name = assemblyName; AssemblyBuilder = #if !SILVERLIGHT path != null ? Universe.DefineDynamicAssembly(an, access, Path.GetDirectoryName(path)) : #endif Universe.DefineDynamicAssembly(an, access); #if FEAT_IKVM if (!Helpers.IsNullOrEmpty(options.KeyFile)) { AssemblyBuilder.__SetAssemblyKeyPair(new StrongNameKeyPair(File.OpenRead(options.KeyFile))); } else if (!Helpers.IsNullOrEmpty(options.KeyContainer)) { AssemblyBuilder.__SetAssemblyKeyPair(new StrongNameKeyPair(options.KeyContainer)); } else if (!Helpers.IsNullOrEmpty(options.PublicKey)) { AssemblyBuilder.__SetAssemblyPublicKey(FromHex(options.PublicKey)); } if (!Helpers.IsNullOrEmpty(options.ImageRuntimeVersion) && options.MetaDataVersion != 0) { AssemblyBuilder.__SetImageRuntimeVersion(options.ImageRuntimeVersion, options.MetaDataVersion); } ModuleBuilder = AssemblyBuilder.DefineDynamicModule(moduleName, path, options.SymbolInfo); #else if (save) { #if !SILVERLIGHT ModuleBuilder = AssemblyBuilder.DefineDynamicModule(moduleName, Path.GetFileName(path)); #else throw new NotSupportedException("Can't save on this platform"); #endif } else ModuleBuilder = AssemblyBuilder.DefineDynamicModule(moduleName); #endif }
/// <summary> /// Reinitialize SetListbox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnAddSetViewSubmitClicked(object sender, EventArgs e) { _setModels = StaticFactory.CreateAllSets(); //Renew all set list SetListboxInit(); }
public void InsertTagStaticBridgeTable(int tagId, int pageId) { var repo = StaticFactory.CreateStaticPageRepository(); repo.InsertTagStaticBridgeTable(tagId, pageId); }
public StaticOBJ BulidEntity(OxyzPointF start, OxyzPointF end, EntityType et) { IStaticFactory IFacotry = new StaticFactory(); return(IFacotry.Build(start, end, et)); }
public Startup(IConfiguration configuration) { Configuration = configuration; // Si le fichier de config contient if (Configuration["DataSource"] == "factory") { // StaticFactory StaticFactory.UpdateBinavigabilite(); } else if (Configuration["DataSource"] == "local") { using (var client = new WebzineDbContext()) { if (Configuration["ResetDb"] == "true") { client.Database.EnsureDeleted(); client.Database.EnsureCreated(); // Load data in database LocalSeeder seeder = new LocalSeeder(client, StaticFactory.Styles, StaticFactory.Titres, StaticFactory.Artistes, StaticFactory.Commentaires, StaticFactory.LienStyles, StaticFactory.Pays); seeder.LoadData(); client.SaveChanges(); } else { client.Database.EnsureCreated(); } } } else if (Configuration["DataSource"] == "spotify") { // sqlite using (var client = new WebzineDbContext()) { client.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; if (Configuration["ResetDb"] == "true") { client.Database.EnsureDeleted(); client.Database.EnsureCreated(); SpotifySeeder spotify = new SpotifySeeder("1a3478c9f18842bc9fee8692aa574973", "943d3a231566443ba543d0e20a673d44"); var playlist = spotify.GetPlaylist(Configuration["SpotifyPlaylistId"]); Seeder seed = spotify.SeedFromPlaylist(client, playlist); client.SaveChanges(); var spotifyStyle = client.Styles.FirstOrDefault(); List <LienStyle> ls = new List <LienStyle>(); client.Titres.ToList().ForEach(t => ls.Add(new LienStyle { IdStyle = spotifyStyle.IdStyle, IdTitre = t.IdTitre })); ls.ForEach(l => client.LienStyles.Add(l)); client.SaveChanges(); } else { client.Database.EnsureCreated(); } } } else { // erreur mise de factory par default StaticFactory.UpdateBinavigabilite(); } }