コード例 #1
0
        private void CreateContextMenuItems()
        {
            if (assetFolderAddItem == null)
            {
                //assetFolderAddItem = new ToolStripMenuItem(LocaleHelper.GetString("ContextMenu.AssetFolderAdd"), GetImage("colt_assets.png"));
                assetFolderAddItem        = new ToolStripMenuItem(LocaleHelper.GetString("ContextMenu.AssetFolderAdd"), PluginBase.MainForm.FindImage("336"));
                assetFolderAddItem.Click += OnAssetAddOrRemoveClick;

                assetFolderRemoveItem         = new ToolStripMenuItem(LocaleHelper.GetString("ContextMenu.AssetFolderRemove"));
                assetFolderRemoveItem.Checked = true;
                assetFolderRemoveItem.Click  += OnAssetAddOrRemoveClick;
            }

            if ((projectTree != null) && !(projectTree.SelectedNode is ProjectNode))
            {
                DirectoryNode node = projectTree.SelectedNode as DirectoryNode;
                if (node != null)
                {
                    // good to go - insert after 1st separator
                    ContextMenuStrip menu = projectTree.ContextMenuStrip;

                    Int32 index = 0;
                    while (index < menu.Items.Count)
                    {
                        index++; if (menu.Items[index - 1] is ToolStripSeparator)
                        {
                            break;
                        }
                    }

                    menu.Items.Insert(index, IsAssetFolder(node.BackingPath) ? assetFolderRemoveItem : assetFolderAddItem);
                }
            }
        }
コード例 #2
0
        public OperationResult RotateImage(string fileName)
        {
            var core = _coreHelper.GetCore();

            var filePath = $"{core.GetPicturePath()}\\{fileName}";

            if (!File.Exists(filePath))
            {
                return(new OperationResult(false, LocaleHelper.GetString("FileNotFound")));
            }
            try
            {
                var img = Image.FromFile(filePath);
                img.RotateFlip(RotateFlipType.Rotate90FlipNone);
                img.Save(filePath);
                img.Dispose();
            }
            catch (Exception e)
            {
                if (e.Message == "A generic error occurred in GDI+.")
                {
                    return(new OperationResult(true));
                }
                return(new OperationResult(false, LocaleHelper.GetString("ErrorWhileRotateImage")));
            }
            return(new OperationResult(true, LocaleHelper.GetString("ImageRotatedSuccessfully")));
        }
コード例 #3
0
        public OperationResult Delete(int id)
        {
            try
            {
                Core core      = _coreHelper.GetCore();
                var  workerDto = core.Advanced_WorkerRead(id);

                if (workerDto.Equals(null))
                {
                    return(new OperationDataResult <SiteNameModel>(false, LocaleHelper.GetString("SiteWithIdCouldNotBeDeleted", id)));
                }

                return(core.Advanced_WorkerDelete(id)
                    ? new OperationDataResult <SiteNameModel>(true,
                                                              LocaleHelper.GetString("WorkerParamDeletedSuccessfully", workerDto.FirstName, workerDto.LastName))
                    : new OperationDataResult <SiteNameModel>(false,
                                                              LocaleHelper.GetString("WorkerParamCantBeDeted", workerDto.FirstName, workerDto.LastName)));
            }

            catch (Exception)
            {
                return(new OperationDataResult <SiteNameModel>(false,
                                                               LocaleHelper.GetString("SiteWithIdCouldNotBeDeleted", id)));
            }
        }
コード例 #4
0
 public OperationResult CreateEntityGroup(AdvEntitySelectableGroupEditModel editModel)
 {
     try
     {
         eFormCore.Core core        = _coreHelper.GetCore();
         EntityGroup    groupCreate = core.EntityGroupCreate(Constants.FieldTypes.EntitySelect, editModel.Name);
         if (editModel.AdvEntitySelectableItemModels.Any())
         {
             var entityGroup = core.EntityGroupRead(groupCreate.MicrotingUUID);
             var nextItemUid = entityGroup.EntityGroupItemLst.Count;
             foreach (var entityItem in editModel.AdvEntitySelectableItemModels)
             {
                 core.EntitySelectItemCreate(entityGroup.Id, entityItem.Name, entityItem.DisplayIndex, nextItemUid.ToString());
                 //entityGroup.EntityGroupItemLst.Add(new EntityItem(entityItem.Name,
                 //    entityItem.Description, nextItemUid.ToString(), Constants.WorkflowStates.Created));
                 nextItemUid++;
             }
             //core.EntityGroupUpdate(entityGroup);
         }
         return(new OperationResult(true, LocaleHelper.GetString("ParamCreatedSuccessfully", groupCreate.MicrotingUUID)));
     }
     catch (Exception)
     {
         return(new OperationResult(false, LocaleHelper.GetString("SelectableListCreationFailed")));
     }
 }
コード例 #5
0
ファイル: PluginMain.cs プロジェクト: benny-yau/.NET-RCP
 /// <summary>
 /// Creates a menu item for the plugin and registers the shortcut item
 /// </summary>
 public void CreateMenuItem()
 {
     ToolStripMenuItem viewMenu = (ToolStripMenuItem)PluginBase.MainForm.FindMenuItem("ViewMenu");
     ToolStripMenuItem viewItem = new ToolStripMenuItem(LocaleHelper.GetString("Label.ViewMenuItem"), this.pluginImage, new EventHandler(this.OpenPanel), this.settingObject.SampleShortcut);
     viewMenu.DropDownItems.Add(viewItem);
     PluginBase.MainForm.RegisterShortcutItem("ViewMenu.SamplePlugin", viewItem);
 }
コード例 #6
0
ファイル: PluginUI.cs プロジェクト: kisabon/flashdevelopjp
        public void OpenSWF(String path)
        {
            unloadMovie();

            if (System.IO.File.Exists(path))
            {
                SWFFile swfFile = new SWFFile(path);

                defaultSWFWidth  = swfFile.FrameWidth / 20;
                defaultSWFHeight = swfFile.FrameHeight / 20;

                swfFile.Close();

                fileNameLabel.Text = System.IO.Path.GetFileName(path);
                file = path;
                setupView();
                MoviePath = path;

                IsSWFPlaying = true;
            }
            else
            {
                file = "";
                fileNameLabel.Text = "";
                ErrorManager.ShowInfo(LocaleHelper.GetString("Info.FileExists"));
            }
        }
コード例 #7
0
ファイル: PluginMain.cs プロジェクト: bottleboy/e4xu
        /// <summary>
        /// Initializes the localization of the plugin
        /// </summary>
        public void InitLocalization()
        {
            LocaleVersion locale = PluginBase.MainForm.Settings.LocaleVersion;

            switch (locale)
            {
            /*
             * case LocaleVersion.fi_FI :
             *  // We have Finnish available... or not. :)
             *  LocaleHelper.Initialize(LocaleVersion.fi_FI);
             *  break;
             */
            default:
                // Plugins should default to English...
                LocaleHelper.Initialize(LocaleVersion.en_US);
                break;
            }
            this.pluginDesc = LocaleHelper.GetString("Info.Description");
            // TODO: test
            try
            {
                this.CreateAssociation();
            }
            catch (Exception e)
            {
                Console.Write(e.Message);
            }
        }
コード例 #8
0
        public OperationDataResult <EntityGroup> GetEntityGroupExternally(string entityGroupUid, string token, string callerURL)
        {
            // Do some validation of the token. For now token is not valid
            //bool tokenIsValid = false;
            ExchangeIdToken         idToken = new ExchangeIdToken(token);
            IdTokenValidationResult result  = idToken.Validate(callerURL);

            if (result.IsValid)
            {
                try
                {
                    eFormCore.Core core = _coreHelper.GetCore();

                    EntityGroup entityGroup = core.EntityGroupRead(entityGroupUid);

                    return(new OperationDataResult <EntityGroup>(true, entityGroup));
                }
                catch (Exception)
                {
                    return(new OperationDataResult <EntityGroup>(false,
                                                                 LocaleHelper.GetString("ErrorWhileObtainSelectableList")));
                }
            }
            else
            {
                return(new OperationDataResult <EntityGroup>(false,
                                                             LocaleHelper.GetString("ErrorWhileObtainSelectableList")));
            }
        }
コード例 #9
0
        public OperationDataResult <List <CommonDictionaryTextModel> > GetEntityGroupDictionary(string entityGroupUid)
        {
            try
            {
                eFormCore.Core core = _coreHelper.GetCore();

                EntityGroup entityGroup = core.EntityGroupRead(entityGroupUid);

                List <CommonDictionaryTextModel> mappedEntityGroupDict = new List <CommonDictionaryTextModel>();

                foreach (EntityItem entityGroupItem in entityGroup.EntityGroupItemLst)
                {
                    mappedEntityGroupDict.Add(new CommonDictionaryTextModel()
                    {
                        Id   = entityGroupItem.Id.ToString(),
                        Text = entityGroupItem.Name
                    });
                }

                return(new OperationDataResult <List <CommonDictionaryTextModel> >(true, mappedEntityGroupDict));
            }
            catch (Exception)
            {
                return(new OperationDataResult <List <CommonDictionaryTextModel> >(false,
                                                                                   LocaleHelper.GetString("ErrorWhileObtainSelectableList")));
            }
        }
コード例 #10
0
 public OperationDataResult <List <TemplateColumnModel> > GetAvailableColumns(int templateId)
 {
     try
     {
         var core   = _coreHelper.GetCore();
         var fields = core.Advanced_TemplateFieldReadAll(templateId);
         List <TemplateColumnModel> templateColumns = new List <TemplateColumnModel>();
         foreach (var field in fields)
         {
             if (field.FieldType != "Picture" &&
                 field.FieldType != "Audio" &&
                 field.FieldType != "Movie" &&
                 field.FieldType != "Signature" &&
                 field.FieldType != "SaveButton")
             {
                 templateColumns.Add(new TemplateColumnModel()
                 {
                     Id    = field.Id,
                     Label = field.Label
                 });
             }
         }
         //List<TemplateColumnModel> templateColumns = fields.Select(field => new TemplateColumnModel()
         //    {
         //        Id = field.id,
         //        Label = field.label
         //    })
         //    .ToList();
         return(new OperationDataResult <List <TemplateColumnModel> >(true, templateColumns));
     }
     catch (Exception)
     {
         return(new OperationDataResult <List <TemplateColumnModel> >(false, LocaleHelper.GetString("ErrorWhileObtainColumns")));
     }
 }
コード例 #11
0
        public OperationDataResult <UserSettingsModel> GetUserSettings()
        {
            var user = UserManager.FindById(User.Identity.GetUserId <int>());

            if (user == null)
            {
                return(new OperationDataResult <UserSettingsModel>(false, LocaleHelper.GetString("UserNotFound")));
            }
            var locale = user.Locale;

            if (locale.IsNullOrEmpty())
            {
                var configuration = WebConfigurationManager.OpenWebConfiguration("~");
                var section       = (AppSettingsSection)configuration.GetSection("appSettings");
                locale = section.Settings["general:defaultLocale"]?.Value;
                if (locale == null)
                {
                    locale = "en-US";
                }
            }
            return(new OperationDataResult <UserSettingsModel>(true, new UserSettingsModel()
            {
                Locale = locale
            }));
        }
コード例 #12
0
        public OperationResult Update(ReplyRequest model)
        {
            var checkListValueList = new List <string>();
            var fieldValueList     = new List <string>();
            var core = _coreHelper.GetCore();

            try
            {
                model.ElementList.ForEach(element =>
                {
                    checkListValueList.AddRange(CaseUpdateHelper.GetCheckList(element));
                    fieldValueList.AddRange(CaseUpdateHelper.GetFieldList(element));
                });
            }
            catch (Exception)
            {
                return(new OperationResult(false, LocaleHelper.GetString("CaseCouldNotBeUpdated")));
            }
            try
            {
                core.CaseUpdate(model.Id, fieldValueList, checkListValueList);
                core.CaseUpdateFieldValues(model.Id);
                return(new OperationResult(true, LocaleHelper.GetString("CaseHasBeenUpdated")));
            }
            catch (Exception)
            {
                return(new OperationResult(false, LocaleHelper.GetString("CaseCouldNotBeUpdated")));
            }
        }
コード例 #13
0
        private void AddToolStrip()
        {
            if (ToggleBuildButton != null)
            {
                return;
            }

            ToggleBuildButton             = new ToolStripButton(Get("127|11|5|5").Img);
            ToggleBuildButton.ToolTipText = LocaleHelper.GetString("Label");
            ToggleBuildButton.Click      += new EventHandler(ToggleBuildButtonClick);

            ProjectsComboBox = new ToolStripComboBox();
            ProjectsComboBox.DropDownStyle         = ComboBoxStyle.DropDownList;
            ProjectsComboBox.Enabled               = false;
            ProjectsComboBox.FlatStyle             = PluginBase.MainForm.Settings.ComboBoxFlatStyle;
            ProjectsComboBox.Font                  = PluginBase.Settings.DefaultFont;
            ProjectsComboBox.SelectedIndexChanged += delegate
            {
                ChangeProject(ProjectsComboBox.SelectedIndex);
            };

            ReloadProjectButton             = new ToolStripButton(Get("66").Img);
            ReloadProjectButton.ToolTipText = LocaleHelper.GetString("Label.ReloadProjects");
            ReloadProjectButton.Click      += new EventHandler(ReloadProjectButtonClick);

            PluginBase.MainForm.ToolStrip.Items.Add(new ToolStripSeparator());
            PluginBase.MainForm.ToolStrip.Items.Add(ToggleBuildButton);
            PluginBase.MainForm.ToolStrip.Items.Add(ProjectsComboBox);
            PluginBase.MainForm.ToolStrip.Items.Add(ReloadProjectButton);
        }
コード例 #14
0
        public void stopWatcher()
        {
            if (classpathWatcher != null)
            {
                classpathWatcher.Dispose();
                classpathWatcher = null;
            }

            if (singleFileWatcher != null)
            {
                singleFileWatcher.Dispose();
                singleFileWatcher = null;
            }

            if (project != null)
            {
                changeState(UIState.Standby);
            }
            else
            {
                changeState(UIState.Disabled);
            }

            ToggleBuildButton.ToolTipText = LocaleHelper.GetString("Label.Start");

            isRunning = false;
        }
コード例 #15
0
ファイル: PluginMain.cs プロジェクト: Nindzzya/thecodingfrog
        /// <summary>
        /// Creates a menu item for the plugin and adds a ignored key
        /// </summary>
        public void CreateMenuItem()
        {
            ToolStripMenuItem viewMenu = (ToolStripMenuItem)PluginBase.MainForm.FindMenuItem("ViewMenu");

            viewMenu.DropDownItems.Add(new ToolStripMenuItem(LocaleHelper.GetString("Label.ViewMenuItem"), this.pluginImage, new EventHandler(this.OpenPanel), this.settingObject.VersionShortcut));
            PluginBase.MainForm.IgnoredKeys.Add(this.settingObject.VersionShortcut);
        }
コード例 #16
0
ファイル: PluginMain.cs プロジェクト: Nindzzya/thecodingfrog
        /// <summary>
        /// Creates a plugin panel for the plugin
        /// </summary>
        public void CreatePluginPanel()
        {
            this.pluginUI      = new PluginUI(this);
            this.pluginUI.Text = LocaleHelper.GetString("Title.PluginPanel");
            this.pluginPanel   = PluginBase.MainForm.CreateDockablePanel(this.pluginUI, this.pluginGuid, this.pluginImage, DockState.DockRight);

            try
            {
                StringBuilder   sb         = new StringBuilder();
                byte[]          buf        = new byte[8192];
                HttpWebRequest  request    = (HttpWebRequest)WebRequest.Create("http://jeanlouis.persat.free.fr/fd/check.php");
                HttpWebResponse response   = (HttpWebResponse)request.GetResponse();
                Stream          resStream  = response.GetResponseStream();
                string          tempString = null;
                int             count      = 0;

                do
                {
                    // fill the buffer with data
                    count = resStream.Read(buf, 0, buf.Length);

                    // make sure we read some data
                    if (count != 0)
                    {
                        // translate from bytes to ASCII text
                        tempString = Encoding.ASCII.GetString(buf, 0, count);

                        // continue building the string
                        sb.Append(tempString);
                    }
                }while (count > 0);

                Assembly     assem            = Assembly.GetExecutingAssembly();
                AssemblyName assemName        = assem.GetName();
                string       __currentVersion = assemName.Version.Major.ToString() + assemName.Version.Minor.ToString() + assemName.Version.Build.ToString();
                __currentVersion = __currentVersion.Replace(".", "");

                string __availableVersion = sb.ToString().Replace(".", "");

                int result = decimal.Compare(Convert.ToDecimal(__currentVersion), Convert.ToDecimal(__availableVersion));
                if (result < 0)
                {
                    this.pluginUI.CheckVersion.Text    = String.Format(LocaleHelper.GetString("Info.New"), sb.ToString());
                    this.pluginUI.CheckVersion.Enabled = true;
                }
                else
                {
                    this.pluginUI.CheckVersion.Text    = LocaleHelper.GetString("Info.Latest");
                    this.pluginUI.CheckVersion.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                this.pluginUI.CheckVersion.Text    = LocaleHelper.GetString("Info.Inaccessible");
                this.pluginUI.CheckVersion.Enabled = false;
            }

            this.pluginUI.Changed  += VersionChanged;
            this.pluginUI.SVNCheck += checkSVN;
        }
コード例 #17
0
        public OperationResult Update(SimpleSiteModel simpleSiteModel)
        {
            try
            {
                Core core    = _coreHelper.GetCore();
                var  siteDto = core.SiteRead(simpleSiteModel.Id);
                if (siteDto.WorkerUid != null)
                {
                    var workerDto = core.Advanced_WorkerRead((int)siteDto.WorkerUid);
                    if (workerDto != null)
                    {
                        string fullName  = simpleSiteModel.UserFirstName + " " + simpleSiteModel.UserLastName;
                        var    isUpdated = core.SiteUpdate(simpleSiteModel.Id, fullName, simpleSiteModel.UserFirstName,
                                                           simpleSiteModel.UserLastName, workerDto.Email);

                        return(isUpdated
                            ? new OperationResult(true, LocaleHelper.GetString("DeviceUserUpdatedSuccessfully"))
                            : new OperationResult(false,
                                                  LocaleHelper.GetString("DeviceUserParamCouldNotBeUpdated", simpleSiteModel.Id)));
                    }
                    return(new OperationResult(false, LocaleHelper.GetString("DeviceUserCouldNotBeObtained")));
                }
                return(new OperationResult(false, LocaleHelper.GetString("DeviceUserNotFound")));
            }
            catch (Exception)
            {
                return(new OperationResult(false, LocaleHelper.GetString("DeviceUserCouldNotBeUpdated")));
            }
        }
コード例 #18
0
        public OperationResult Deploy(DeployModel deployModel)
        {
            var deployedSiteIds = new List <int>();

            var sitesToBeRetractedFrom = new List <int>();
            var sitesToBeDeployedTo    = new List <int>();

            var core        = _coreHelper.GetCore();
            var templateDto = core.TemplateItemRead(deployModel.Id);

            foreach (var site in templateDto.DeployedSites)
            {
                deployedSiteIds.Add(site.SiteUId);
            }

            var requestedSiteIds = deployModel
                                   .DeployCheckboxes
                                   .Select(deployCheckbox => deployCheckbox.Id)
                                   .ToList();

            if (requestedSiteIds.Count == 0)
            {
                sitesToBeRetractedFrom.AddRange(templateDto.DeployedSites.Select(site => site.SiteUId));
            }
            else
            {
                sitesToBeDeployedTo.AddRange(requestedSiteIds.Where(siteId => !deployedSiteIds.Contains(siteId)));
            }

            if (deployedSiteIds.Count != 0)
            {
                foreach (var site in templateDto.DeployedSites)
                {
                    if (!requestedSiteIds.Contains(site.SiteUId))
                    {
                        if (!sitesToBeRetractedFrom.Contains(site.SiteUId))
                        {
                            sitesToBeRetractedFrom.Add(site.SiteUId);
                        }
                    }
                }
            }

            if (sitesToBeDeployedTo.Any())
            {
                var mainElement = core.TemplateRead(deployModel.Id);
                mainElement.Repeated =
                    0; // We set this right now hardcoded, this will let the eForm be deployed until end date or we actively retract it.
                mainElement.EndDate   = DateTime.Now.AddYears(10).ToUniversalTime();
                mainElement.StartDate = DateTime.Now.ToUniversalTime();
                core.CaseCreate(mainElement, "", sitesToBeDeployedTo, "");
            }

            foreach (var siteUId in sitesToBeRetractedFrom)
            {
                core.CaseDelete(deployModel.Id, siteUId);
            }

            return(new OperationResult(true, LocaleHelper.GetString("ParamPairedSuccessfully", templateDto.Label)));
        }
コード例 #19
0
ファイル: PluginMain.cs プロジェクト: kisabon/flashdevelopjp
        /// <summary>
        /// メニューアイテムを作る。
        /// </summary>
        private void CreateMenu()
        {
            if (this.settingObj.HideMenu)
            {
                return;
            }

            MenuStrip mainMenu = PluginBase.MainForm.MenuStrip;

            this.fdjpMenu          = new ToolStripMenuItem();
            this.fdjpMenu.Text     = LocaleHelper.GetString("LABEL_MENU");
            this.nextItem          = new ToolStripMenuItem();
            this.nextItem.Text     = LocaleHelper.GetString("LABEL_NEXT_WORD");
            this.nextItem.Click   += new EventHandler(this.nextWord);
            this.prevItem          = new ToolStripMenuItem();
            this.prevItem.Text     = LocaleHelper.GetString("LABEL_PREV_WORD");
            this.prevItem.Click   += new EventHandler(this.prevWord);
            this.alwaysItem        = new ToolStripMenuItem();
            this.alwaysItem.Text   = LocaleHelper.GetString("LABEL_ALWAYS_COMPILE");
            this.alwaysItem.Click += new EventHandler(this.alwaysCompile);

            this.nextLineItem                 = new ToolStripMenuItem();
            this.nextLineItem.Text            = LocaleHelper.GetString("LABEL_NEXT_LINE");
            this.nextLineItem.Click          += new EventHandler(this.nextLine);
            this.prevLineItem                 = new ToolStripMenuItem();
            this.prevLineItem.Text            = LocaleHelper.GetString("LABEL_PREV_LINE");
            this.prevLineItem.Click          += new EventHandler(this.prevLine);
            this.foldAllCommentsItem          = new ToolStripMenuItem();
            this.foldAllCommentsItem.Text     = LocaleHelper.GetString("LABEL_FOLD_ALL_COMMENTS");
            this.foldAllCommentsItem.Click   += new EventHandler(this.foldAllComments);
            this.expandAllCommentsItem        = new ToolStripMenuItem();
            this.expandAllCommentsItem.Text   = LocaleHelper.GetString("LABEL_EXPAND_ALL_COMMENTS");
            this.expandAllCommentsItem.Click += new EventHandler(this.expandAllComments);
            this.alignAssignmentItem          = new ToolStripMenuItem();
            this.alignAssignmentItem.Text     = LocaleHelper.GetString("LABEL_ALIGN_ASSIGNMENT");
            this.alignAssignmentItem.Click   += new EventHandler(this.alignAssignment);
            this.searchNextItem               = new ToolStripMenuItem();
            this.searchNextItem.Text          = LocaleHelper.GetString("LABEL_SEARCH_NEXT");
            this.searchNextItem.Click        += new EventHandler(this.searchNext);
            this.searchPrevItem               = new ToolStripMenuItem();
            this.searchPrevItem.Text          = LocaleHelper.GetString("LABEL_SEARCH_PREV");
            this.searchPrevItem.Click        += new EventHandler(this.searchPrev);
            this.calcSelectionItem            = new ToolStripMenuItem();
            this.calcSelectionItem.Text       = LocaleHelper.GetString("LABEL_CALC_SELECTION");
            this.calcSelectionItem.Click     += new EventHandler(this.calcSelection);

            this.fdjpMenu.DropDownItems.Add(this.nextItem);
            this.fdjpMenu.DropDownItems.Add(this.prevItem);
            this.fdjpMenu.DropDownItems.Add(this.alwaysItem);
            this.fdjpMenu.DropDownItems.Add(this.nextLineItem);
            this.fdjpMenu.DropDownItems.Add(this.prevLineItem);
            this.fdjpMenu.DropDownItems.Add(this.foldAllCommentsItem);
            this.fdjpMenu.DropDownItems.Add(this.expandAllCommentsItem);
            this.fdjpMenu.DropDownItems.Add(this.alignAssignmentItem);
            this.fdjpMenu.DropDownItems.Add(this.searchNextItem);
            this.fdjpMenu.DropDownItems.Add(this.searchPrevItem);
            this.fdjpMenu.DropDownItems.Add(this.calcSelectionItem);

            mainMenu.Items.Add(this.fdjpMenu);
        }
コード例 #20
0
        public OperationDataResult <DisplayTemplateColumnsModel> GetCurrentColumns(int templateId)
        {
            try
            {
                var core     = _coreHelper.GetCore();
                var template = core.TemplateItemRead(templateId);
                var model    = new DisplayTemplateColumnsModel()
                {
                    TemplateId = template.Id,
                    FieldId1   = template.Field1?.Id,
                    FieldId2   = template.Field2?.Id,
                    FieldId3   = template.Field3?.Id,
                    FieldId4   = template.Field4?.Id,
                    FieldId5   = template.Field5?.Id,
                    FieldId6   = template.Field6?.Id,
                    FieldId7   = template.Field7?.Id,
                    FieldId8   = template.Field8?.Id,
                    FieldId9   = template.Field9?.Id,
                    FieldId10  = template.Field10?.Id
                };

                return(new OperationDataResult <DisplayTemplateColumnsModel>(true, model));
            }
            catch (Exception)
            {
                return(new OperationDataResult <DisplayTemplateColumnsModel>(false, LocaleHelper.GetString("ErrorWhileObtainColumns")));
            }
        }
コード例 #21
0
        public OperationResult Delete(int id)
        {
            try
            {
                Core          core    = _coreHelper.GetCore();
                var           siteDto = core.Advanced_SiteItemRead(id);
                SiteNameModel siteNameModel;

                if (!siteDto.Equals(null))
                {
                    Mapper.Initialize(cfg => cfg.CreateMap <SiteName_Dto, SiteNameModel>());
                    siteNameModel =
                        Mapper.Map <SiteName_Dto, SiteNameModel>(siteDto);
                }
                else
                {
                    return(new OperationResult(false, LocaleHelper.GetString("SiteParamNotFound", id)));
                }

                return(core.Advanced_SiteItemDelete(id)
                    ? new OperationResult(true, LocaleHelper.GetString("SiteParamDeletedSuccessfully", siteNameModel.SiteName))
                    : new OperationResult(false, LocaleHelper.GetString("SiteParamCouldNotBeDeleted", siteNameModel.SiteName)));
            }

            catch (Exception)
            {
                return(new OperationDataResult <SiteNameModel>(false,
                                                               LocaleHelper.GetString("SiteParamCouldNotBeDeleted", id)));
            }
        }
コード例 #22
0
ファイル: PluginMain.cs プロジェクト: Nindzzya/thecodingfrog
        /// <summary>
        /// Initializes the localization of the plugin
        /// </summary>
        public void InitLocalization()
        {
            LocaleVersion locale = PluginBase.MainForm.Settings.LocaleVersion;

            switch (locale)
            {
            /*
             * case LocaleVersion.fi_FI :
             *  // We have Finnish available... or not. :)
             *  LocaleHelper.Initialize(LocaleVersion.fi_FI);
             *  break;
             */
            default:
                // Plugins should default to English...
                LocaleHelper.Initialize(LocaleVersion.en_US);
                break;
            }
            this.pluginDesc = LocaleHelper.GetString("Info.Description");

            /*__timer = new System.Timers.Timer();
             * __timer.Elapsed += new ElapsedEventHandler(HandleTimerComplete);
             * if (settingObject.CheckTimer != TimerCheckInterval.Never)
             * {
             *      __timer.Interval = (int)settingObject.CheckTimer;
             * }*/
        }
コード例 #23
0
        public HttpResponseMessage PostLoginPageImages()
        {
            var iUploadedCnt = 0;
            var saveFolder   =
                System.Web.Hosting.HostingEnvironment.MapPath("~/output/datafolder/picture/settings/login-page");

            if (string.IsNullOrEmpty(saveFolder))
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, LocaleHelper.GetString("FolderError")));
            }
            if (!Directory.Exists(saveFolder))
            {
                Directory.CreateDirectory(saveFolder);
            }
            var files = HttpContext.Current.Request.Files;

            for (var i = 0; i <= files.Count - 1; i++)
            {
                var hpf = files[i];
                if (hpf.ContentLength > 0)
                {
                    var filePath = Path.Combine(saveFolder, Path.GetFileName(hpf.FileName));
                    if (!File.Exists(filePath))
                    {
                        hpf.SaveAs(filePath);
                        iUploadedCnt++;
                    }
                }
            }
            if (iUploadedCnt > 0)
            {
                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            return(Request.CreateResponse(HttpStatusCode.BadRequest, LocaleHelper.GetString("InvalidRequest")));
        }
コード例 #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PluginUI"/> class.
        /// </summary>
        /// <param name="pluginMain">The plugin main.</param>
        public PluginUI(PluginMain pluginMain)
        {
            this.InitializeComponent();
            this.pluginMain = pluginMain;



            LocaleVersion locale = PluginCore.PluginBase.MainForm.Settings.LocaleVersion;

            switch (locale)
            {
            /*
             * case LocaleVersion.fi_FI :
             *  // We have Finnish available... or not. :)
             *  LocaleHelper.Initialize(LocaleVersion.fi_FI);
             *  break;
             */
            default:
                // Plugins should default to English...
                LocaleHelper.Initialize(LocaleVersion.en_US);
                break;
            }

            this.buttonSVNCheck.Text = LocaleHelper.GetString("Title.SVNCheckButton");
            this.NotTracked.Text     = LocaleHelper.GetString("Title.NotTracked") + "\n" +
                                       LocaleHelper.GetString("Title.TrackIt");
            this.NotTracked.LinkArea     = new LinkArea(LocaleHelper.GetString("Title.NotTracked").Length + 1, LocaleHelper.GetString("Title.TrackIt").Length);
            this.NotTracked.LinkClicked += new LinkLabelLinkClickedEventHandler(this.NotTracked_LinkClicked);

            disableVersion();
        }
コード例 #25
0
        public OperationDataResult <TemplateListModel> Index(TemplateRequestModel templateRequestModel)
        {
            try
            {
                try
                {
                    var core         = _coreHelper.GetCore();
                    var templatesDto = core.TemplateItemReadAll(false,
                                                                "",
                                                                templateRequestModel.NameFilter,
                                                                templateRequestModel.IsSortDsc,
                                                                templateRequestModel.Sort,
                                                                templateRequestModel.TagIds);

                    var model = new TemplateListModel
                    {
                        NumOfElements = 40,
                        PageNum       = templateRequestModel.PageIndex,
                        Templates     = templatesDto
                    };


                    return(new OperationDataResult <TemplateListModel>(true, model));
                }
                catch (Exception ex)
                {
                    if (ex.Message.Contains("PrimeDb"))
                    {
                        var lines = File.ReadAllLines(
                            System.Web.Hosting.HostingEnvironment.MapPath("~/bin/Input.txt"));

                        var connectionStr = lines.First();
                        var adminTool     = new AdminTools(connectionStr);
                        adminTool.DbSettingsReloadRemote();
                        return(new OperationDataResult <TemplateListModel>(false, LocaleHelper.GetString("CheckConnectionString")));
                    }
                    else
                    {
                        if (ex.InnerException.Message.Contains("Cannot open database"))
                        {
                            try
                            {
                                var core = _coreHelper.GetCore();
                            }
                            catch (Exception)
                            {
                                return(new OperationDataResult <TemplateListModel>(false, LocaleHelper.GetString("CoreIsNotStarted")));
                            }
                            return(new OperationDataResult <TemplateListModel>(false, LocaleHelper.GetString("CheckSettingsBeforeProceed")));
                        }
                    }
                    return(new OperationDataResult <TemplateListModel>(false, LocaleHelper.GetString("CheckSettingsBeforeProceed")));
                }
            }
            catch (Exception)
            {
                throw new HttpResponseException(HttpStatusCode.Unauthorized);
            }
        }
コード例 #26
0
        /// <summary>
        /// Filters the initial result set by determining which entries actually resolve back to our declaration target.
        /// </summary>
        private void GotoNextMatch(FRResults results, ASResult target)
        {
            IDictionary <String, List <SearchMatch> > initialResultsList = RefactoringHelpera.GetInitialResultsList(results);
            Boolean foundDeclarationSource = false;

            foreach (KeyValuePair <String, List <SearchMatch> > entry in initialResultsList)
            {
                String           currentFileName = entry.Key;
                ScintillaControl sci             = (ScintillaControl)this.AssociatedDocumentHelper.LoadDocument(currentFileName);
                if (back)
                {
                    entry.Value.Reverse();
                }

                foreach (SearchMatch match in entry.Value)
                {
                    // if the search result does point to the member source, store it
                    if (RefactoringHelpera.DoesMatchPointToTarget(sci, match, target, this.AssociatedDocumentHelper))
                    {
                        if (ignoreDeclarationSource && !foundDeclarationSource && RefactoringHelpera.IsMatchTheTarget(sci, match, target))
                        {
                            //ignore the declaration source
                            foundDeclarationSource = true;
                        }
                        else
                        {
                            int ws = sci.PositionFromLine(match.Line - 1) + match.Column;
                            if (!back)
                            {
                                if (ws > curEndPos)
                                {
                                    sci.SelectionStart = ws;
                                    sci.SelectionEnd   = ws + match.Length;
                                    sci.ScrollCaret();
                                    return;
                                }
                            }
                            else
                            {
                                if (ws < curStartPos)
                                {
                                    sci.SelectionStart = ws;
                                    sci.SelectionEnd   = ws + match.Length;
                                    sci.ScrollCaret();
                                    return;
                                }
                            }
                        }
                    }
                }
            }

            Globals.SciControl.SelectionStart = spos;
            Globals.SciControl.SelectionEnd   = epos;
            string str = Globals.SciControl.GetWordFromPosition(spos);

            MessageBox.Show(LocaleHelper.GetString("MESSAGE_NOT_FOUND") + str, "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
コード例 #27
0
ファイル: PluginMain.cs プロジェクト: bottleboy/e4xu
 public void CreatePluginPanel()
 {
     this.pluginUI      = new PluginUI(this);
     this.pluginUI.Text = LocaleHelper.GetString("Title.PluginPanel");
     this.pluginPanel   = PluginBase.MainForm.CreateDockablePanel(this.pluginUI,
                                                                  this.pluginGuid,
                                                                  null, //this.pluginImage,
                                                                  DockState.DockRight);
 }
コード例 #28
0
        private string ConvertType(string broadcast, string mega)
        {
            if (ViewModel.Item is TLChannel channel)
            {
                return(LocaleHelper.GetString(channel.IsBroadcast ? broadcast : mega));
            }

            return(null);
        }
コード例 #29
0
ファイル: PluginMain.cs プロジェクト: bottleboy/e4xu
        /// <summary>
        /// Creates a menu item for the plugin and adds a ignored key
        /// </summary>
        public void CreateMenuItem()
        {
            ToolStripMenuItem fileMenu = (ToolStripMenuItem)PluginBase.MainForm.FindMenuItem("FileMenu");

            this.projectToolMenuItem = new ToolStripMenuItem(LocaleHelper.GetString("Label.FileMenuItem"),
                                                             null, //this.pluginImage
                                                             new EventHandler(this.CreateNewProject));
            fileMenu.DropDownItems.Insert(3, this.projectToolMenuItem);
        }
コード例 #30
0
        public OperationDataResult <Site_Dto> Edit(int id)
        {
            Core core    = _coreHelper.GetCore();
            var  siteDto = core.SiteRead(id);

            return(siteDto != null
                ? new OperationDataResult <Site_Dto>(true, siteDto)
                : new OperationDataResult <Site_Dto>(false, LocaleHelper.GetString("DeviceUserParamCouldNotBeEdited", id)));
        }