public void Send() { if (IsEncrypt) { throw new ArgumentException("An encrypted message cannot send"); } if (!IsDownloaded) { throw new ArgumentException("An undownloaded message cannot send"); } IMessageManager messageManager = ModulesManager.GetModulesManager().GetMessageManager(); switch (type) { case StashMessageType.Text: _ = messageManager.SendTextMessage(ChatId, content); break; case StashMessageType.Photo: byte[] imageBytes = Convert.FromBase64String(content); _ = messageManager.SendPhotoMessage(ChatId, imageBytes); break; case StashMessageType.Empty: break; } }
private bool CheckPassword(long chatId, string password) { IMessageManager messageManager = ModulesManager.GetModulesManager().GetMessageManager(); if (string.IsNullOrEmpty(password)) { messageManager.SendTextMessage(chatId, TextResponse.Get(ResponseType.PasswordEmpty)); return(false); } if (password.Length < 12) { messageManager.SendTextMessage(chatId, TextResponse.Get(ResponseType.PasswordMinLength)); return(false); } if (password.Length > 25) { messageManager.SendTextMessage(chatId, TextResponse.Get(ResponseType.PasswordMaxLength)); return(false); } if (!Regex.IsMatch(password, @"^[a-zA-Z0-9!""#$%&'()*+,-./:;<=>?@[\]^_`{|}~]+$")) { messageManager.SendTextMessage(chatId, TextResponse.Get(ResponseType.PasswordCharacters)); return(false); } return(true); }
public async Task Download() { if (IsDownloaded) { return; } if (IsEncrypt) { throw new ArgumentException("An encrypted message cannot download"); } ITelegramBotClient telegramBotClient = ModulesManager.GetModulesManager().GetTelegramBotClient(); using (MemoryStream stream = new MemoryStream()) { await telegramBotClient.GetInfoAndDownloadFileAsync(photoId, stream); byte[] imageBytes = stream.ToArray(); content = Convert.ToBase64String(imageBytes); } photoId = null; IsDownloaded = true; }
private void Save(object sender, RoutedEventArgs e) { bool wasWorking = ModulesManager.walker.working; if (wasWorking == true) { ModulesManager.WalkerDisable(); } while (!ModulesManager.walker.stopped) { ; } ModulesManager.walker.SetList(Way.changeWayToWaypointList(_StatementsList)); if (_startLabelName != null && _startLabelName != "") { ModulesManager.walker.startStatementIndex = ModulesManager.walker.list.FindIndex(x => x.name == _startLabelName); } //if (!wasWorking) ModulesManager.walker.startStatementIndex = startIndex; if (wasWorking) { ModulesManager.WalkerEnable(); } _StatementsList = ModulesManager.walker.CopyList(); fillList(); showPopUpWindow("Saved succesfully"); }
public static bool SwitchFunzioni(Message messaggio) { if (messaggio.Text == null) { return(true); } var comando = StringOperator.PurgeString(messaggio.Text); if (ModulesManager.CheckModules(comando, messaggio)) { return(true); } if (AnalizzatoreFrase.ListaAudioImmensa(comando, messaggio, ContGiulio)) { return(true); } if (AnalizzatoreFrase.Switch(messaggio, comando, ContOffese, ContPaolo, ContPerle)) //controllo sulla prima parola { return(true); } if (comando.Any(x => AnalizzatoreFrase.Contiene(messaggio, x, ContSofferenza, ContPano))) { return(true); } return(false); }
private void OnCallbackQuery(object sender, CallbackQueryEventArgs e) { ITelegramBotClient telegramBotClient = ModulesManager.GetTelegramBotClient(); if (string.IsNullOrEmpty(e.CallbackQuery.Data)) { return; } string[] queryArray = e.CallbackQuery.Data.Split(":"); if (queryArray.Length == 0) { return; } ICallbackQueryHandler callbackQueryHandler; switch (queryArray[0]) { case "delete_message": callbackQueryHandler = new DeleteMessageHandler(); break; default: return; } callbackQueryHandler.Handle(queryArray, e.CallbackQuery.Message.MessageId); telegramBotClient.AnswerCallbackQueryAsync(e.CallbackQuery.Id); }
protected void BtnSave_Click(object sender, EventArgs e) { LblErr.Text = RenderError(""); LblOk.Text = RenderSuccess(""); try { Module o1 = new Module(); if (base.CurrentId == 0) { form2obj(o1); o1 = new ModulesManager().Insert(o1); } else { o1 = new ModulesManager().GetByKey(base.CurrentId); form2obj(o1); new ModulesManager().Update(o1); } Grid1.DataBind(); LblOk.Text = RenderSuccess( Utility.GetLabel("RECORD_SAVED_MSG")); MultiView1.ActiveViewIndex = 0; } catch (Exception e1) { LblErr.Text = RenderError(Utility.GetLabel("RECORD_ERR_MSG") + "<br />" + e1.ToString()); } finally { } }
public void Encrypt(IUser user) { if (IsEncrypt) { return; } if (!IsDownloaded) { throw new ArgumentException("An undownloaded message cannot encrypt"); } if (!user.IsAuthorized) { throw new ArgumentException("User is unauthorized, message cannot encrypt"); } ISecureManager secureManager = ModulesManager.GetModulesManager().GetSecureManager(); string password = secureManager.DecryptWithAes(user.EncryptedPassword); if (type != StashMessageType.Empty) { content = secureManager.EncryptWithAesHmac(content, password); } IsEncrypt = true; }
private void Save(object sender, RoutedEventArgs e) { bool wasWorking = ModulesManager.targeting.working; if (wasWorking) { ModulesManager.TargetingDisable(); } ModulesManager.targeting.setTargetList(_list); ModulesManager.targeting.setFoodList(_foodList); ModulesManager.targeting.setLootList(_lootList); ModulesManager.targeting.openNextContainer = OpenNextContainerCheckBox.IsChecked.Value; ModulesManager.targeting.nextContainer = _nextContainer; _foodList = Storage.Storage.Copy(ModulesManager.targeting.foodList) as List <Item>; _lootList = Storage.Storage.Copy(ModulesManager.targeting.lootList) as List <LootItem>; _list = ModulesManager.targeting.getTargetListCopy(); if (wasWorking) { ModulesManager.TargetingEnable(); } fillAllLists(); showPopUpWindow("Saved succesfully"); }
public ModulesPage(MainFrm ui, TabPage tab) : base(ui, tab) { _isValidUrl = new Dictionary <string, bool>(); _avatarCache = new Dictionary <string, Bitmap>(); _displayModuleException = DisplayModuleException; _profileCache = new Dictionary <HHotel, Dictionary <string, HProfile> >(); Contractor = new ModulesManager(UI); Contractor.OnModuleAction = OnModuleAction; LoadModules(); Tab.DragDrop += Tab_DragDrop; Tab.DragEnter += Tab_DragEnter; UI.MTReleasesBtn.Click += MTReleasesBtn_Click; UI.MTResourceBtn.Click += MTResourceBtn_Click; UI.MTDownloadLatestBtn.Click += MTDownloadLatestBtn_Click; UI.MTAuthorsTxt.SelectedValueChanged += MTAuthorsTxt_SelectedValueChanged; UI.MTInstallModuleBtn.Click += MTInstallModuleBtn_Click; UI.MTUninstallModuleBtn.Click += MTUninstallModuleBtn_Click; UI.MTModulesVw.ItemActivate += MTModulesVw_ItemActivate; UI.MTModulesVw.ItemSelected += MTModulesVw_ItemSelected; UI.MTModulesVw.ItemSelectionStateChanged += MTModulesVw_ItemSelectionStateChanged; }
private void Wind_Loaded(object sender, RoutedEventArgs e) { WindowModel.Width = stackUserPanel.ActualWidth; NotifyController.Init(setNewNotification); ServerList.PostInit(); ModulesManager.PostInitModules(); }
public void CreateUser(long chatId, string password) { ISecureManager secureManager = ModulesManager.GetSecureManager(); if (IsUserExist(chatId)) { LogoutUser(chatId); using (UsersContext db = new UsersContext()) { UserModel userModel = db.Users .Where(user => user.ChatId == chatId) .First(); userModel.HashPassword = secureManager.CalculateHash(password); db.SaveChanges(); } } else { using (UsersContext db = new UsersContext()) { UserModel userModel = new UserModel { ChatId = chatId, HashPassword = secureManager.CalculateHash(password) }; db.Users.Add(userModel); db.SaveChanges(); } } }
internal void Start() { ITelegramBotClient telegramBotClient = ModulesManager.GetModulesManager().GetTelegramBotClient(); telegramBotClient.OnMessage += OnMessage; telegramBotClient.StartReceiving(); }
public Session( IPool <DataStream> dataStreamPool = null, PacketReader packetReader = null, PacketWriter packetWriter = null, PacketPolicy packetPolicy = null, ProtoListTable baseProto = null) { if (dataStreamPool == null) { dataStreamPool = Link.Pools.DataStreamPool.Instance; } if (packetReader == null) { packetReader = new PacketReader(dataStreamPool.Take(), dataStreamPool.Take()); } if (packetWriter == null) { packetWriter = new PacketWriter(dataStreamPool.Take(), dataStreamPool.Take()); } if (packetPolicy == null) { packetPolicy = PacketPolicy.AllAcceptPolicy; } DataStreamPool = dataStreamPool; PacketReader = packetReader; PacketWriter = packetWriter; PacketPolicy = packetPolicy; if (baseProto == null) { Proto = new ProtoListTable(); } else { Proto = baseProto; } Handler = new PacketHandlerTable(); Handler.Proto = Proto; Modules = new ModulesManager(this); connectionInputRoute = new RouteChain(); connectionOutputRoute = new RouteOutputHandler(SendNext); InputChain = new RouteSession(); OutputChain = new RouteSession(); InputChain.Handler = OutputChain.Handler = Handler; InputChain.Session = OutputChain.Session = this; connectionInputRoute.Next = InputChain; OutputChain.Next = connectionOutputRoute; InputChain.IsInput = true; OutputChain.IsInput = false; InputChain.Redirect = OutputChain; OutputChain.Redirect = InputChain; }
public void HandleUserMessage(ITelegramUserMessage message) { if (message.IsEmpty()) { return; } ISessionManager sessionManager = ModulesManager.GetModulesManager().GetSessionManager(); IChatSession chatSession = sessionManager.GetChatSession(message.ChatId); if (chatSession == null) { sessionManager.CreateChatSession(message.ChatId); chatSession = sessionManager.GetChatSession(message.ChatId); } sessionManager.UserSentMessage(message.ChatId, message.MessageId); if (string.Equals(message.Message, "/e") || string.Equals(message.Message, "/exit")) { sessionManager.KillChatSession(message.ChatId); } else { chatStateHandlerFactory.GetChatStateHandler(chatSession.State).HandleUserMessage(message, this); } }
public virtual void Init(Action <IServiceCollection> registerServicesAction = null) { MockConfigurationManager = new MockConfigurationManager(); var services = new ServiceCollection() .AddApplicatonServices <ServicesModule>() .AddApplicatonServices <HtmlModule>() .AddApplicatonServices <OneNoteModule>() .AddApplicatonServices <FileNavigationModule>() //.AddLogging(configure => configure.AddConsole()) .AddSingleton(sp => MockConfigurationManager); services.AddMediatR(typeof(MiddlewareModule).Assembly); registerServicesAction?.Invoke(services); ServiceProvider = services .AddLogging() .BuildServiceProvider(); ModulesManager = ServiceProvider.GetService <IModulesManager>(); try { ModulesManager.GetCurrentModuleInfo(); } catch (ModuleNotFoundException) { ModulesManager.UploadModule(@"..\..\..\..\Modules\rst\rst.bnm", "rst"); ModulesManager.UploadModule(@"..\..\..\..\Modules\kjv\kjv.bnm", "kjv"); } }
public void set_up() { Debug.Listeners.Clear(); TextWriterTraceListener t = new TextWriterTraceListener("log.txt"); Debug.Listeners.Add(t); Debug.AutoFlush = true; Debug.WriteLine("0"); /*PlatformID platformID = Environment.OSVersion.Platform; if (platformID == PlatformID.Win32NT || platformID == PlatformID.Win32Windows) { Process process = new Process(); process.StartInfo.FileName = "icepacknode"; process.StartInfo.Arguments = "--start FerdaIcePackNode"; process.Start(); process.WaitForExit(); } else {*/ ProcessStartInfo psi = new ProcessStartInfo("icegridnode", "--Ice.Config=config --IceGrid.Registry.Data=registry --IceGrid.Node.Data=node --deploy application.xml --warn"); psi.CreateNoWindow = true; psi.WorkingDirectory = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "../db"); Process.Start(psi); /*ProcessStartInfo psi2 = new ProcessStartInfo("icepackadmin", "--Ice.Config=config -e \"application add 'application.xml'\""); psi2.CreateNoWindow = true; Process processReg = Process.Start(psi2); processReg.WaitForExit();*/ System.Threading.Thread.Sleep(5000); /*}*/ Debug.WriteLine("1"); this.manager = new ModulesManager(new string[0],new string[2]{"cs-CZ","en-US"}); Debug.WriteLine("2"); }
static void Main(string[] args) { Console.Title = "Fluint SDK"; Console.WriteLine("Started Fluint SDK."); var packet = ModulesManager.LoadFolder("base").GenerateModulePacket(); new SDKBase(packet).Listen(); }
public static void Main() { ModulesManager manager = Modules.Instance; Engine engine = new Engine(manager); engine.Run(); }
private void OnMessage(object sender, MessageEventArgs e) { IMessageManager messageManager = ModulesManager.GetMessageManager(); ITelegramUserMessage userMessage = telegramUserMessageFactory.Create(e.Message); messageManager.HandleUserMessage(userMessage); }
public void DeleteMessage(long chatId, int messageId) { ITelegramBotClient telegramBotClient = ModulesManager.GetTelegramBotClient(); ISessionManager sessionManager = ModulesManager.GetSessionManager(); sessionManager.GetChatSession(chatId).MessageDeleted(messageId); telegramBotClient.DeleteMessageAsync(chatId, messageId); }
/// <summary> /// Default constructor of the class /// </summary> /// <param name="menuItem">Modules manager of the application</param> /// <param name="resManager">Resource manager</param> /// <param name="box">Box that has thrown the exception</param> /// <param name="userMessage">Message to be displayed to the user</param> public BoxExceptionThreadClass(ModulesManager.ModulesManager mod, ResourceManager resManager, IBoxModule box, string userMessage) { this.resourceManager = resManager; this.box = box; this.userMessage = userMessage; this.modulesManager = mod; }
protected virtual void InitModules() { Modules = new ModulesManager(); AddModules(); Modules.Init(this); }
protected virtual void ConfigureModules() { modules = new ModulesManager(); AddModules(); Modules.Configure(); }
private void Logout(long chatId, IChatStateHandlerContext context) { IMessageManager messageManager = ModulesManager.GetModulesManager().GetMessageManager(); IUserManager userManager = ModulesManager.GetModulesManager().GetUserManager(); userManager.LogoutUser(chatId); messageManager.SendTextMessage(chatId, TextResponse.Get(ResponseType.Logout)); context.ChangeChatState(chatId, Session.ChatSessionState.Start); }
public static void Start() { var collection = ModulesManager.LoadFolder(GetManifest().ActiveFolder); var packet = collection.GenerateModulePacket(); var taskManager = packet.CreateScoped <ITaskManager>(); taskManager.Invoke(TaskSchedule.Startup, null); taskManager.Invoke(TaskSchedule.Background, null); }
private void WriteBotStatus() { ITelegramBotClient telegramBotClient = ModulesManager.GetTelegramBotClient(); Telegram.Bot.Types.User me = telegramBotClient.GetMeAsync().Result; Console.WriteLine(DateTime.Now + " - Bot set up!"); Console.WriteLine($"Id: {me.Id}"); Console.WriteLine($"Login: {me.Username}"); Console.WriteLine($"Name: {me.FirstName}"); }
public Helper(Ice.ObjectAdapter adapter, string[] localePrefs, ModulesManager manager) { this.adapter = adapter; this.localePrefs = localePrefs; Debug.WriteLine("Creating BoxModuleIceFactories..."); this.boxModuleIceFactories = new BoxModuleIceFactories( this ); Debug.WriteLine("Creating ManagersEngine..."); this.managersEngineI = new ManagersEngineI(adapter,this, manager); this.managersEnginePrx = ManagersEnginePrxHelper.uncheckedCast( adapter.addWithUUID(managersEngineI)); }
public void CreateNewUser(long chatId, string password) { IDatabaseManager databaseManager = ModulesManager.GetModulesManager().GetDatabaseManager(); if (databaseManager.IsStashExist(chatId)) { databaseManager.ClearStash(chatId); } databaseManager.CreateUser(chatId, password); }
public void Kill() { IMessageManager messageManager = ModulesManager.GetModulesManager().GetMessageManager(); IUserManager userManager = ModulesManager.GetModulesManager().GetUserManager(); messageManager.DeleteListMessages(ChatId, botMessagesId); botMessagesId.Clear(); messageManager.DeleteListMessages(ChatId, userMessagesId); userMessagesId.Clear(); userManager.LogoutUser(ChatId); }
public void Login(string password) { if (string.IsNullOrEmpty(password)) { throw new ArgumentException("Password cannot be null"); } ISecureManager secureManager = ModulesManager.GetSecureManager(); EncryptedPassword = secureManager.EncryptWithAes(password); IsAuthorized = true; }
public void ChangeChatState(long chatId, ChatSessionState newState) { ISessionManager sessionManager = ModulesManager.GetSessionManager(); IChatSession chatSession = sessionManager.GetChatSession(chatId); if (chatSession != null) { chatSession.State = newState; chatStateHandlerFactory.GetChatStateHandler(chatSession.State).StartStateMessage(chatId); } }
public void HandleUserMessage(ITelegramUserMessage message, IChatStateHandlerContext context) { if (message == null || context == null) { return; } IMessageManager messageManager = ModulesManager.GetModulesManager().GetMessageManager(); messageManager.SendTextMessage(message.ChatId, TextResponse.Get(ResponseType.WelcomeMessage)); context.ChangeChatState(message.ChatId, ChatSessionState.Start); }
private void RegistrationUser(ITelegramUserMessage message, IChatStateHandlerContext context) { IMessageManager messageManager = ModulesManager.GetModulesManager().GetMessageManager(); IUserManager userManager = ModulesManager.GetModulesManager().GetUserManager(); if (CheckPassword(message.ChatId, message.Message)) { userManager.CreateNewUser(message.ChatId, message.Message); messageManager.SendTextMessage(message.ChatId, TextResponse.Get(ResponseType.SuccessRegistration)); context.ChangeChatState(message.ChatId, Session.ChatSessionState.Start); } }
/// <summary> /// Default constructor for the class /// </summary> /// <param name="locManager">Interface that takes care of the localization</param> /// <param name="menuDisp">Menu displayer</param> /// <param name="modManager">Modules Manager</param> /// <param name="iconProvider">Provider of the icons</param> /// <param name="toolBar">ToolBar of the application</param> public NewBoxControl(Menu.ILocalizationManager locManager, Menu.IMenuDisplayer menuDisp, ModulesManager.ModulesManager modManager, IIconProvider iconProvider, Menu.IMenuDisplayer toolBar) { treeView = new NewBoxTreeView(locManager, menuDisp, modManager, iconProvider, toolBar); treeView.WidthConstant = this.heightConstant; treeView.BorderStyle = BorderStyle.FixedSingle; textBox = new RichTextBox(); treeView.TextBox = textBox; textBox.BorderStyle = BorderStyle.Fixed3D; textBox.ReadOnly = true; this.Controls.Add(textBox); this.Controls.Add(treeView); //InitializeComponent things this.Name = "FerdaArchive"; this.Size = new System.Drawing.Size(170, 500); this.ResumeLayout(false); this.PerformLayout(); }
public BoxModule(Ferda.Modules.BoxModulePrx iceBoxModulePrx, BoxModuleFactoryCreator madeInCreator, Helper helper, ModulesManager modulesManager) { this.iceBoxModulePrx = iceBoxModulePrx; this.madeInCreator = madeInCreator; this.iceIdentity = Ice.Util.identityToString( iceBoxModulePrx.ice_getIdentity()); this.helper = helper; this.modulesManager = modulesManager; this.managersLocatorI = this.helper.ManagersEngineI.ManagersLocatorI; foreach(PropertyInfo property in madeInCreator.Properties) { this.propertyNames.Add(property.name); } //string[] driver = this.MadeInCreator.PropertyDrivingLabel; //if (driver != null && driver.Length != 0) //{ // propertyDrivingLabel = driver[0]; //} }
///<summary> /// Constructor /// </summary> public ManagersEngineI(Ice.ObjectAdapter adapter, Helper helper, ModulesManager manager) { Debug.WriteLine("Creating Output..."); lnkOutputI = new OutputI(); outputPrx = OutputPrxHelper.uncheckedCast( adapter.addWithUUID(this.lnkOutputI)); Debug.WriteLine("Creating BoxModuleLocker..."); lnkBoxModuleLockerI = new BoxModuleLockerI(manager); boxModuleLockerPrx = BoxModuleLockerPrxHelper.uncheckedCast( adapter.addWithUUID(this.lnkBoxModuleLockerI)); Debug.WriteLine("Creating BoxModuleValidator..."); lnkBoxModuleValidatorI = new BoxModuleValidatorI(manager); boxModuleValidatorPrx = BoxModuleValidatorPrxHelper.uncheckedCast( adapter.addWithUUID(this.lnkBoxModuleValidatorI)); Debug.WriteLine("Creating BoxModuleProjectInformation..."); lnkBoxModuleProjectInformationI = new BoxModuleProjectInformationI(manager); boxModuleProjectInformationPrx = BoxModuleProjectInformationPrxHelper.uncheckedCast( adapter.addWithUUID(this.lnkBoxModuleProjectInformationI)); Debug.WriteLine("Creating ManagersLocator..."); lnkManagersLocatorI = new ManagersLocatorI(adapter, helper); managersLocatorPrx = ManagersLocatorPrxHelper.uncheckedCast( adapter.addWithUUID(this.lnkManagersLocatorI)); }
private void editRow(int recordId, bool changeView, bool copyRow) { var obj = new Module(); LblOk.Text = RenderSuccess( ""); LblErr.Text = RenderError(""); clearForm(); base.CurrentId = recordId; if (base.CurrentId == 0) { obj.ModuleNamespace = DropNewModule.SelectedValue.Split('.')[0]; obj.ModuleName = DropNewModule.SelectedValue.Split('.')[1]; obj2form(obj, changeView); //loads new module params fields LitModuleType.Text = DropNewModule.SelectedValue; } else { obj = new ModulesManager().GetByKey(base.CurrentId); obj2form(obj, changeView); } if (copyRow) { base.CurrentId = 0; LblId.Text = "0"; ChkIsCore.Checked = false; //TxtName.Text += "-copy"; } MultiView1.ActiveViewIndex = 1; }
private void setFlag(int recordId, bool value, string flagName) { try { Module o1 = new Module(); o1 = new ModulesManager().GetByKey(recordId); switch (flagName.ToLower()) { case "published": o1.Published = value; break; default: break; } new ModulesManager().Update(o1); } catch (Exception e1) { LblErr.Text = RenderError(Utility.GetLabel("RECORD_ERR_MSG") + "<br />" + e1.ToString()); } finally { } }
private void loadDropOrdering() { string templateBlockName = ""; DropOrdering.Items.Clear(); if (base.CurrentId > 0) { templateBlockName = new ModulesManager().GetByKey(base.CurrentId).TemplateBlockName; } ModulesFilter filter = new ModulesFilter(); filter.TemplateBlockName = templateBlockName; List<Module> recordList = new ModulesManager().GetByFilter(filter, "Ordering"); int ordering = 1; foreach (Module record1 in recordList) { DropOrdering.Items.Add( new ListItem(ordering.ToString() + ": " + record1.Title, ordering.ToString())); ordering++; } }
private void obj2form(PigeonCms.Menu obj, bool changeType, bool changeView) { foreach (KeyValuePair<string, string> item in Config.CultureList) { string sTitleTranslation = ""; TextBox t1 = new TextBox(); t1 = (TextBox)PanelTitle.FindControl("TxtTitle" + item.Value); obj.TitleTranslations.TryGetValue(item.Key, out sTitleTranslation); t1.Text = sTitleTranslation; string sTitleWindowTranslation = ""; TextBox t2 = new TextBox(); t2 = (TextBox)PanelTitleWindow.FindControl("TxtTitleWindow" + item.Value); obj.TitleWindowTranslations.TryGetValue(item.Key, out sTitleWindowTranslation); t2.Text = sTitleWindowTranslation; } LblId.Text = obj.Id.ToString(); LblModuleId.Text = obj.ModuleId.ToString(); //Utility.SetDropByValue(DropMenuTypes, obj.MenuType); not used, list filtered on MenuType yet Utility.SetDropByValue(DropReferMenuId, obj.ReferMenuId.ToString()); ChkVisible.Checked = obj.Visible; ChkPublished.Checked = obj.Published; ChkOverridePageTitle.Checked = obj.OverridePageTitle; LitMenuType.Text = DropMenuTypesFilter.SelectedValue; ChkIsCore.Checked = obj.IsCore; PermissionsControl1.Obj2form(obj); Module currModule = new Module(); if (obj.ContentType == MenuContentType.Module) { if (obj.ModuleId == 0 && obj.Id == 0) { if (changeType) { currModule.ModuleNamespace = DropModuleTypes.SelectedValue.Split('.')[0]; currModule.ModuleName = DropModuleTypes.SelectedValue.Split('.')[1]; } else { currModule.ModuleNamespace = DropNewItem.SelectedValue.Split('.')[0]; currModule.ModuleName = DropNewItem.SelectedValue.Split('.')[1]; } } else { string moduleFullName = ""; moduleFullName = new ModulesManager().GetByKey(obj.ModuleId).ModuleFullName; if (!new ModuleTypeManager().Exist(moduleFullName)) { LitErr.Text = RenderError( Utility.GetErrorLabel("NotInstalledModuleType", "Not installed module type")); //LitModuleType.Text += " " + Utility.GetErrorLabel("NotInstalledModuleType", "Not installed module type"); } currModule = new ModulesManager().GetByKey(obj.ModuleId); if (changeType) { currModule.ModuleNamespace = DropModuleTypes.SelectedValue.Split('.')[0]; currModule.ModuleName = DropModuleTypes.SelectedValue.Split('.')[1]; } else Utility.SetDropByValue(DropModuleTypes, moduleFullName); } if (changeView) currModule.CurrView = DropViews.SelectedValue; else { loadDropViews(currModule); Utility.SetDropByValue(DropViews, currModule.CurrView); } ChkShowModuleTitle.Checked = currModule.ShowTitle; ModuleParams1.LoadParams(currModule); } else { Utility.SetDropByValue(DropModuleTypes, ((int)obj.ContentType).ToString()); //LitModuleType.Text = obj.ContentType.ToString(); ModuleParams1.LoadParams(currModule); //to reset params panel } Utility.SetDropByValue(DropCurrMasterPage, obj.CurrMasterPageStored); Utility.SetDropByValue(DropCurrTheme, obj.CurrThemeStored); Utility.SetDropByValue(DropRouteId, obj.RouteId.ToString()); Utility.SetDropByValue(DropUseSsl, ((int)obj.UseSsl).ToString()); TxtName.Text = obj.Name; TxtAlias.Text = obj.Alias; TxtLink.Text = obj.Link; TxtCssClass.Text = obj.CssClass; //load parentId list MenuHelper.LoadListMenu(ListParentId, DropMenuTypesFilter.SelectedValue, base.CurrentId); if (obj.ParentId > 0) Utility.SetListBoxByValues(ListParentId, obj.ParentId); else Utility.SetListBoxByValues(ListParentId, obj.MenuType); //MenuContentType specific switch (obj.ContentType) { case MenuContentType.Module: lockControl(TxtLink, false); lockControl(DropReferMenuId, false); break; case MenuContentType.Url: lockControl(TxtAlias, false); ReqAlias.Enabled = false; lockControl(DropReferMenuId, false); lockControl(DropViews, false); break; case MenuContentType.Javascript: lockControl(TxtAlias, false); ReqAlias.Enabled = false; lockControl(DropReferMenuId, false); lockControl(DropViews, false); break; case MenuContentType.Alias: lockControl(TxtLink, false); lockControl(DropViews, false); break; default: break; } if (obj.IsCore) lnkchange.Visible = false; else lnkchange.Visible = true; }
protected void Grid1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { var linkedModule = new PigeonCms.Module(); var item = new PigeonCms.Menu(); item = (PigeonCms.Menu)e.Row.DataItem; Literal LitStyle = (Literal)e.Row.FindControl("LitStyle"); LitStyle.Text = ""; if (!string.IsNullOrEmpty(item.CssClass)) LitStyle.Text += "C: " + item.CssClass + "<br />"; if (!string.IsNullOrEmpty(item.CurrThemeStored)) LitStyle.Text += "T: " + item.CurrThemeStored + "<br />"; if (!string.IsNullOrEmpty(item.CurrMasterPageStored)) LitStyle.Text += "M: " + item.CurrMasterPageStored + "<br />"; Literal LitModuleNameDesc = (Literal)e.Row.FindControl("LitModuleNameDesc"); switch (item.ContentType) { case MenuContentType.Module: linkedModule = new ModulesManager().GetByKey(item.ModuleId); LitModuleNameDesc.Text = linkedModule.ModuleFullName + "<br>" + "<i>"+ linkedModule.CurrView +"</i>"; break; case MenuContentType.Url: LitModuleNameDesc.Text = MenuContentType.Url.ToString(); break; case MenuContentType.Javascript: LitModuleNameDesc.Text = MenuContentType.Javascript.ToString(); break; case MenuContentType.Alias: LitModuleNameDesc.Text = MenuContentType.Alias.ToString(); break; default: break; } LinkButton LnkSel = (LinkButton)e.Row.FindControl("LnkSel"); LnkSel.Text = "<i class='fa fa-pgn_edit fa-fw'></i>" + Utility.Html.GetTextPreview(item.Name, 20, ""); var LitAlias = (Literal)e.Row.FindControl("LitAlias"); string alias = item.Alias; if (item.ContentType == MenuContentType.Url && !string.IsNullOrEmpty(item.Link)) { alias = "<a href='" + item.Link + "' target='_blank' title='" + item.Link + "'>" + item.Alias + "</a>"; } LitAlias.Text = alias + "<br />" + item.RoutePattern; //moduleContent if (this.AllowEditContentUrl && linkedModule.Id > 0) { var LnkModuleContent = (HyperLink)e.Row.FindControl("LnkModuleContent"); if (!string.IsNullOrEmpty(linkedModule.EditContentUrl)) { LnkModuleContent.Visible = true; LnkModuleContent.NavigateUrl = linkedModule.EditContentUrl; } } var LitAccessTypeDesc = (Literal)e.Row.FindControl("LitAccessTypeDesc"); LitAccessTypeDesc.Text = RenderAccessTypeSummary(item); //Visible if (item.Visible) { var img1 = e.Row.FindControl("ImgVisibleOk"); img1.Visible = true; } else { var img1 = e.Row.FindControl("ImgVisibleKo"); img1.Visible = true; } //Published if (item.Published) { var img1 = e.Row.FindControl("ImgPublishedOk"); img1.Visible = true; } else { var img1 = e.Row.FindControl("ImgPublishedKo"); img1.Visible = true; } //Use SSL if (item.CurrentUseSsl) { var img1 = e.Row.FindControl("ImgUseSsl"); img1.Visible = true; } //Delete if (item.IsCore) { var img1 = e.Row.FindControl("LnkDel"); img1.Visible = false; } else { var img1 = e.Row.FindControl("LnkDel"); img1.Visible = true; } } }
/// <summary> /// Constructs new view /// </summary> /// <param name="archive">An <see cref="T:Ferda.ProjectManager.Archive"/> /// with boxes in project</param> /// <param name="modulesManager">A <see cref="T:Ferda.ModulesManager.ModulesManager"/> /// representing Modules manager</param> /// <param name="name">A string representing name of view</param> protected internal View(Archive archive, ModulesManager.ModulesManager modulesManager, string name) { this.archive = archive; this.modulesManager = modulesManager; this.name = name; }
/* /// <summary> /// Creates ModulesForCreationSubmenu for a selected box /// </summary> protected void CreateModulesForCreationMenu(ToolStripMenuItem menuItem) { ToolStripMenuItem it; List<ToolStripMenuItem> modules = new List<ToolStripMenuItem>(); foreach (Modules.ModuleAskingForCreation info in box.ModulesAskingForCreation) { it = new ToolStripMenuItem(info.label); it.Click += new EventHandler(Creation_Click); modules.Add(it); } foreach (ToolStripMenuItem item in modules) { menuItem.DropDownItems.Add(item); } }*/ /// <summary> /// Shows a messagebox saying that user cannot write to the box /// </summary> public void CannotWriteToBox(ModulesManager.IBoxModule box) { MessageBox.Show( ParentTreeView.ResManager.GetString("PropertiesCannotWriteText"), box.UserName + ": " + ParentTreeView.ResManager.GetString("PropertiesCannotWriteCaption")); }
/// <summary> /// Clones the box in the project /// </summary> /// <param name="box">box to be cloned</param> public void Clone(ModulesManager.IBoxModule box) { Archive.Clone(box); Adapt(); PropertiesDisplayer.Reset(); }
/// <summary> /// Copies the box int the parameter into the clipboard /// </summary> /// <param name="box">box for the clipboard</param> public void Copy(ModulesManager.IBoxModule box) { Clipboard.Nodes.Clear(); Clipboard.Nodes.Add(box); }
///<summary> /// Constructor /// </summary> /// <param name="modulesManager">A ModulesManager</param> public BoxModuleProjectInformationI(ModulesManager modulesManager) { this.modulesManager = modulesManager; }
private bool saveForm() { bool res = false; LitErr.Text = RenderError(""); LitOk.Text = RenderSuccess(""); try { var o1 = new PigeonCms.Menu(); var currModule = new Module(); //save menu if (base.CurrentId == 0) { form2obj(o1); o1 = new MenuManager().Insert(o1); } else { o1 = new MenuManager().GetByKey(base.CurrentId); form2obj(o1); new MenuManager().Update(o1); } //save module if (o1.ContentType == MenuContentType.Module) { if (form2module(o1, currModule)) { if (o1.ModuleId > 0) { currModule = new ModulesManager().GetByKey(o1.ModuleId); } if (currModule.Id > 0) { form2module(o1, currModule); new ModulesManager().Update(currModule); } else { currModule = new ModulesManager().Insert(currModule); o1.ModuleId = currModule.Id; new MenuManager().Update(o1); } } } else if (o1.ModuleId > 0) { new ModulesManager().DeleteById(o1.ModuleId); o1.ModuleId = 0; new MenuManager().Update(o1); } Grid1.DataBind(); LitOk.Text = RenderSuccess(Utility.GetLabel("RECORD_SAVED_MSG")); res = true; } catch (Exception e1) { LitErr.Text = RenderError( Utility.GetLabel("RECORD_ERR_MSG") + "<br />" + e1.ToString()); } finally { } return res; }
private void obj2form(LogItem obj) { LitId.Text = obj.Id.ToString(); LitCreated.Text = obj.DateInserted + " " + obj.UserInserted; LitType.Text = obj.Type.ToString(); var module = new Module(); module = new ModulesManager().GetByKey(obj.ModuleId); LitModuleType.Text = module.ModuleFullName; if (string.IsNullOrEmpty(module.ModuleFullName)) { LitModuleType.Text += " " + Utility.GetErrorLabel("NotInstalledModuleType", "Not installed module type"); } LitView.Text = module.CurrView; LitUserHostAddress.Text = obj.UserHostAddress; LitSessionId.Text = obj.SessionId; LitUserInserted.Text = obj.UserInserted; LitUrl.Text = obj.Url; LitDescription.Text = obj.Description; }
/// <summary> /// Default constructor /// </summary> /// <param name="locManager">Localization manager of the application</param> /// <param name="menuDisp">Menu of the application</param> /// <param name="modManager">Modules manager</param> /// <param name="iconProvider">Provider of the icons for the component</param> /// <param name="toolBar">ToolBar of the application</param> public NewBoxTreeView(Menu.ILocalizationManager locManager, Menu.IMenuDisplayer menuDisp, ModulesManager.ModulesManager modManager, IIconProvider iconProvider, Menu.IMenuDisplayer toolBar) : base() { //setting the icons naIcon = iconProvider.GetIcon("NAIcon"); folderIcon = iconProvider.GetIcon("FolderIcon"); localizationManager = locManager; menuDisplayer = menuDisp; this.toolBar = toolBar; modulesManager = modManager; InitializeComponent(); IBoxModuleFactoryCreator[] creators = modulesManager.BoxModuleFactoryCreators; FillImageList(creators); FillTreeView(creators); AfterSelect += new TreeViewEventHandler(NewBoxTreeView_AfterSelect); GotFocus += new EventHandler(NewBox_GotFocus); MouseMove += new MouseEventHandler(NewBoxTreeView_MouseMove); MouseDown += new MouseEventHandler(NewBoxTreeView_MouseDown); }
/// <summary> /// Constructor that sets the Box property /// </summary> /// <param name="box">box that will be represented by this node</param> /// <param name="alongDirection">the direction of expanding</param> /// <param name="arch">Archive where this box belongs</param> /// <param name="parent">Parent component of the archive</param> /// <param name="iconDictionary">Icon dictionary containing all the icons /// for the box visualization</param> /// <param name="list">Some image list</param> /// <param name="provider">Control providing access to all the icons</param> /// <param name="projManager">Project manager of the application</param> public FerdaTreeNode(ModulesManager.IBoxModule box, bool alongDirection, ProjectManager.Archive arch, FerdaArchive parent, Dictionary<string, int> iconDictionary, ImageList list, IIconProvider provider, ProjectManager.ProjectManager projManager) : base() { Box = box; Text = box.UserName; AlongDirection = alongDirection; Archive = arch; ParentTreeView = parent; //icon provider for the menu this.provider = provider; //setting the projectManager projectManager = projManager; //setting the icon if (box.MadeInCreator.Icon.Length == 0) { this.ImageIndex = iconDictionary["naIcon"]; this.SelectedImageIndex = iconDictionary["naIcon"]; } else { string label = box.MadeInCreator.Label; if (iconDictionary.ContainsKey(label)) { this.ImageIndex = iconDictionary[label]; this.SelectedImageIndex = iconDictionary[label]; } else { MemoryStream stream = new MemoryStream(box.MadeInCreator.Icon); Icon icon = new Icon(stream); int count = list.Images.Count; list.Images.Add(icon); iconDictionary.Add(label, count); this.ImageIndex = count; this.SelectedImageIndex = count; } } //sets the child nodes for this node if (AlongDirection) { //sets the boxes as ConnectionTo foreach(ModulesManager.IBoxModule b in Archive.ConnectedTo(Box)) { Nodes.Add(new FerdaTreeNode(b, AlongDirection, Archive, ParentTreeView, iconDictionary, list, provider, projectManager)); } } else { //sets the boxes as ConnectionFrom foreach(ModulesManager.IBoxModule b in Archive.ConnectionsFrom(Box)) { Nodes.Add(new FerdaTreeNode(b, AlongDirection, Archive, ParentTreeView, iconDictionary, list, provider, projectManager)); } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { loadDropTemplateBlocks(); loadDropPublishedFilter(); loadDropsModuleTypes(); MenuHelper.LoadListMenu(ListMenu, 0); RadioMenuAll.Attributes.Add("onclick", "disableListMenu();"); RadioMenuNone.Attributes.Add("onclick", "disableListMenu();"); RadioMenuSelection.Attributes.Add("onclick", "enableListMenu();"); } else { //reload params on every postback, because cannot manage dinamically fields PigeonCms.Module currentModule = new PigeonCms.Module(); if (base.CurrentId > 0) { currentModule = new ModulesManager().GetByKey(base.CurrentId); ModuleParams1.LoadParams(currentModule); } else { //manually set ModType try { currentModule.ModuleNamespace = LitModuleType.Text.Split('.')[0]; currentModule.ModuleName = LitModuleType.Text.Split('.')[1]; currentModule.CurrView = DropViews.SelectedValue; ModuleParams1.LoadParams(currentModule); } catch { } } } }
/// <summary> /// Deletes the box in the parameter from the project manager /// </summary> /// <param name="box">box to be deleted</param> public void Delete(ModulesManager.IBoxModule box) { if (!this.Focused) { return; } string caption = ResManager.GetString("DeleteFromArchiveCaption"); string message = ResManager.GetString("DeleteFromArchiveMessage"); MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result; // Displays the MessageBox. result = MessageBox.Show(message, caption, buttons, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); if (result == DialogResult.Yes) { Archive.Remove(box); foreach (Desktop.FerdaDesktop desktop in Views) { desktop.Adapt(); } Adapt(); PropertiesDisplayer.Reset(); } }
///<summary> /// Constructor /// </summary> /// <param name="modulesManager">A ModulesManager</param> public BoxModuleLockerI(ModulesManager modulesManager) { this.modulesManager = modulesManager; }
///<summary> ///Localizes view in parameter in the archive ///</summary> ///<param name="box"> /// Box to be localized ///</param> public void LocalizeInArchive(ModulesManager.IBoxModule box) { int i; string boxtype = string.Empty; List<string> types = new List<string>(box.MadeInCreator.BoxCategories); mySelectedNode = null; //indexing from one, because first group is all and every box belongs //to all group. We want to know a specific group for (i = 1; i < CBCategories.Items.Count; i++) { if (types.Contains(CBCategories.Items[i].ToString())) { boxtype = CBCategories.Items[i].ToString(); break; } } //selecting the boxtype for (i = 0; i < CBCategories.Items.Count; i++) { string item = (string)CBCategories.Items[i]; if (item == boxtype) { break; } } CBCategories.SelectedIndex = i; //filling the labels in the second combo-box FillBoxLabels(boxtype); for (i = 0; i < CBTypes.Items.Count; i++) { string item = (string)CBTypes.Items[i]; if (item == box.MadeInCreator.Label) { break; } } CBTypes.SelectedIndex = i; //resetting the archive ResetArchive(boxtype, box.MadeInCreator.Label, true); //now we have to select the box in the list... foreach (FerdaTreeNode tn in TVArchive.Nodes) { if (tn.Box == box) { TVArchive.SelectedNode = tn; mySelectedNode = tn; break; } } //setting the focus to the treeview TVArchive.Focus(); }
/// <summary> /// Default constructor for the class /// </summary> /// <remarks> /// Parametrem by se mohlo predavat jmeno vystupniho konektoru. /// Problem bude s resenim vystupniho konenktoru, pro ktery vlastne /// neni socket ale pozaduje SVG (bud kreslit natvrdo, nebo udelat /// v IBoxModule pro to nejaky zvlastni socket /// </remarks> /// <param name="site">Interface of a graph site (control) /// </param> /// <param name="box">Box that is connected with this node</param> /// <param name="resM">Resource manager of the application</param> /// <param name="svgman">Provider of svg images</param> /// <param name="view">View where this box is located</param> public BoxNode(IGraphSite site, ModulesManager.IBoxModule box, SVGManager svgman, ProjectManager.View view, ResourceManager resM) : base(site) { FerdaConstants constants = new FerdaConstants(); //filling the node this.box = box; this.svgManager = svgman; this.ResManager = resM; //determining the size Rectangle = new RectangleF(0, 0, constants.KrabickaWidth, constants.KrabickaHeight); //adding the output connector //it is not a FerdaConnector, because the box has no socket defined outputConnector = new Connector(this, ResManager.GetString("PropertiesOutputConnector"), true); Connectors.Add(outputConnector); outputConnector.ConnectorLocation = ConnectorLocations.East; //adding the input connectors inputConnectors = new ConnectorCollection(); for (int i = 0; i < box.Sockets.Length; i++) { bool packed = view.IsAnyBoxPackedIn(box, box.Sockets[i].name); inputConnectors.Add( new FerdaConnector(this, svgManager, box.Sockets[i], packed)); Connectors.Add(inputConnectors[i]); inputConnectors[i].ConnectorLocation = ConnectorLocations.West; } //getting the bitmap bitmap = svgManager.GetBoxBitmap(box); //setting the view this.view = view; //adding the moving handler OnMouseDown += new MouseEventHandler(BoxNode_OnMouseDown); OnMouseUp += new MouseEventHandler(BoxNode_OnMouseUp); Resizable = false; this.Text = box.UserName; //using a smaller font - we have big labels mFont = new Font(mFontFamily, 7, FontStyle.Regular, GraphicsUnit.Point); }
//private ModulesManager.OutputPrx output; /// <summary> /// Initializes a new instance of the <see cref="T:Ferda.Modules.BoxModuleFactoryI"/> class. /// </summary> /// <param name="boxInfo">The box info.</param> /// <param name="myFactoryCreatorProxy">The proxy of this factory`s creator.</param> /// <param name="localePrefs">The localization preferences.</param> /// <param name="manager">The modules manager engine.</param> public BoxModuleFactoryI(IBoxInfo boxInfo, BoxModuleFactoryCreatorPrx myFactoryCreatorProxy, string[] localePrefs, ModulesManager.ManagersEnginePrx manager) { this.boxInfo = boxInfo; this.localePrefs = localePrefs; this.myFactoryCreatorProxy = myFactoryCreatorProxy; this.manager = manager; //this.output = this.manager.getOutputInterface(); }