/// <summary>
        /// Merge field values into the static text.
        /// </summary>
        /// <param name="staticText">Static text on which to merge field values.</param>
        /// <param name="translationInfo">Translation informations used to translate the static text.</param>
        public void Merge(IStaticText staticText, ITranslationInfo translationInfo)
        {
            if (staticText == null)
            {
                throw new ArgumentNullException("staticText");
            }
            if (translationInfo == null)
            {
                throw new ArgumentNullException("translationInfo");
            }

            staticText.Translate(translationInfo.CultureInfo);

            if (staticText.SubjectTranslation == null && staticText.BodyTranslation == null)
            {
                return;
            }

            if (staticText.SubjectTranslation != null && string.IsNullOrEmpty(staticText.SubjectTranslation.Value) == false)
            {
                staticText.SubjectTranslation.Value = Merge(staticText.SubjectTranslation.Value, translationInfo);
            }

            if (staticText.BodyTranslation != null && string.IsNullOrEmpty(staticText.BodyTranslation.Value) == false)
            {
                staticText.BodyTranslation.Value = Merge(staticText.BodyTranslation.Value, translationInfo);
            }
        }
Example #2
0
        public MyDialog_StringQuery(Decal.Adapter.Wrappers.PluginHost H, string[] pbuttons, string ptitle, string plabel, int picon, delInputVerify pVerify, string pdefaultinput, string dialogkey, IView pOrigin)
            : base(dialogkey, pOrigin)
        {
            iButtons      = pbuttons;
            iTitle        = ptitle;
            iLabel        = plabel;
            iIcon         = picon;
            iVerify       = pVerify;
            iDefaultInput = pdefaultinput;

            if (!base.ShowView(H))
            {
                return;
            }

            ResultButtons = new IButton[iButtons.Length];
            for (int i = 0; i < iButtons.Length; ++i)
            {
                ResultButtons[i]      = (IButton)View["btn" + i.ToString()];
                ResultButtons[i].Hit += new EventHandler(MyDialog_StringQuery_Hit);
            }
            Text       = (ITextBox)View["Textbox1"];
            Text.Text  = iDefaultInput;
            Label      = (IStaticText)View["Label1"];
            Label.Text = iLabel;

#if VVS_REFERENCED
            if (View.ViewType == ViewSystemSelector.eViewSystem.VirindiViewService)
            {
                SetStrVVSProps();
            }
#endif
        }
Example #3
0
 public ec(PluginHost A_0, string[] A_1, string A_2, string A_3, int A_4, ec.a A_5, string A_6, string A_7, IView A_8) : base(A_7, A_8)
 {
     this.a = A_1;
     this.b = A_2;
     this.c = A_3;
     this.d = A_4;
     this.e = A_5;
     this.f = A_6;
     if (base.a(A_0))
     {
         this.g = new IButton[this.a.Length];
         for (int i = 0; i < this.a.Length; i++)
         {
             this.g[i]      = (IButton)base.a["btn" + i.ToString()];
             this.g[i].Hit += new EventHandler(this.a);
         }
         this.h      = (ITextBox)base.a["Textbox1"];
         this.h.Text = this.f;
         this.i      = (IStaticText)base.a["Label1"];
         this.i.Text = this.c;
         if (base.a is View)
         {
             this.b();
         }
     }
 }
Example #4
0
        public MyDialog_ColorQuery(Decal.Adapter.Wrappers.PluginHost H, string[] pbuttons, string ptitle, string plabel, int picon, Color pdefaultinput, string dialogkey, IView pOrigin)
            : base(dialogkey, pOrigin)
        {
            iButtons      = pbuttons;
            iTitle        = ptitle;
            iLabel        = plabel;
            iIcon         = picon;
            iDefaultInput = pdefaultinput;

            if (!base.ShowView(H))
            {
                return;
            }

            ResultButtons = new IButton[iButtons.Length];
            for (int i = 0; i < iButtons.Length; ++i)
            {
                ResultButtons[i]      = (IButton)View["btn" + i.ToString()];
                ResultButtons[i].Hit += new EventHandler(MyDialog_ColorQuery_Hit);
            }
            Label      = (IStaticText)View["Label1"];
            Label.Text = iLabel;

            //Set up input boxes
            slA = (ISlider)View["slA"];
            slR = (ISlider)View["slR"];
            slG = (ISlider)View["slG"];
            slB = (ISlider)View["slB"];

            slA.Position = iDefaultInput.A;
            slR.Position = iDefaultInput.R;
            slG.Position = iDefaultInput.G;
            slB.Position = iDefaultInput.B;

            slA.Change += new EventHandler <MVIndexChangeEventArgs>(ChangedSlider);
            slR.Change += new EventHandler <MVIndexChangeEventArgs>(ChangedSlider);
            slG.Change += new EventHandler <MVIndexChangeEventArgs>(ChangedSlider);
            slB.Change += new EventHandler <MVIndexChangeEventArgs>(ChangedSlider);

#if VVS_REFERENCED
            if (VVSColorBox)
            {
                //Create the VVS colorbox
                Curtain_CreateVVSColorBox();
            }
#endif
            if (!VVSColorBox)
            {
                dColorBox           = (Decal.Adapter.Wrappers.PushButtonWrapper)(((MyClasses.MetaViewWrappers.DecalControls.View)View).Underlying.Controls["ColorBox"]);
                dColorBox.FaceColor = iDefaultInput;
            }
        }
        public LocalizedString DatabaseTranslateFormat(string text, object[] parameters, CultureInfo cultureInfo, string scope)
        {
            using (var dbContext = m_dbContextFunc.Invoke())
            {
                var cultureDao = new CultureDao(dbContext.Culture);
                var culture    = cultureDao.FindByName(cultureInfo.Name);

                var dictionaryScopeDao = new DictionaryScopeDao(dbContext.DictionaryScope);
                var dictionaryScope    = dictionaryScopeDao.FindByName(scope);

                var         staticTextDao = new StaticTextDao(dbContext.StaticText);
                IStaticText dbResult      = staticTextDao.FindByNameAndCultureAndScope(text, culture, dictionaryScope, dbContext.CultureHierarchy);

                return(new LocalizedString(text, dbResult.Text, false));
            }
        }
        /// <summary>
        /// Build a mockup for a static text used by the food waste domain.
        /// </summary>
        /// <param name="staticTextType">Type of the static text.</param>
        /// <returns>Mockup for a static text used by the food waste domain.</returns>
        public static IStaticText BuildStaticTextMock(StaticTextType staticTextType = StaticTextType.WelcomeLetter)
        {
            Guid         subjectTranslationIdentifier = Guid.NewGuid();
            ITranslation subjectTranslation           = BuildTranslationMock(subjectTranslationIdentifier);
            Guid         bodyTranslationIdentifier    = Guid.NewGuid();
            ITranslation bodyTranslation = BuildTranslationMock(bodyTranslationIdentifier);
            IStaticText  staticTextMock  = MockRepository.GenerateMock <IStaticText>();

            staticTextMock.Stub(m => m.Identifier)
            .Return(Guid.NewGuid())
            .Repeat.Any();
            staticTextMock.Stub(m => m.Type)
            .Return(staticTextType)
            .Repeat.Any();
            staticTextMock.Stub(m => m.Translation)
            .Return(null)
            .Repeat.Any();
            staticTextMock.Stub(m => m.Translations)
            .Return(new List <ITranslation> {
                subjectTranslation, bodyTranslation
            })
            .Repeat.Any();
            staticTextMock.Stub(m => m.SubjectTranslationIdentifier)
            .Return(subjectTranslationIdentifier)
            .Repeat.Any();
            staticTextMock.Stub(m => m.SubjectTranslation)
            .Return(subjectTranslation)
            .Repeat.Any();
            staticTextMock.Stub(m => m.SubjectTranslations)
            .Return(new List <ITranslation> {
                subjectTranslation
            })
            .Repeat.Any();
            staticTextMock.Stub(m => m.BodyTranslationIdentifier)
            .Return(bodyTranslationIdentifier)
            .Repeat.Any();
            staticTextMock.Stub(m => m.BodyTranslation)
            .Return(bodyTranslation)
            .Repeat.Any();
            staticTextMock.Stub(m => m.BodyTranslations)
            .Return(new List <ITranslation> {
                bodyTranslation
            })
            .Repeat.Any();
            return(staticTextMock);
        }
        public LocalizedString DatabaseTranslate(string text, CultureInfo cultureInfo, string scope)
        {
            using (var dbContext = m_dbContextFunc.Invoke())
            {
                var culture         = GetCultureByNameOrGetDefault(dbContext, cultureInfo.Name);
                var dictionaryScope = GetDictionaryScope(dbContext, scope);

                var         staticTextDao = new StaticTextDao(dbContext.StaticText);
                IStaticText dbResult      = staticTextDao.FindByNameAndCultureAndScope(text, culture, dictionaryScope, dbContext.CultureHierarchy);

                if (dbResult == null)
                {
                    return(null);
                }
                return(new LocalizedString(text, dbResult.Text, false));
            }
        }
Example #8
0
        public void FindByNameAndCultureAndScopeTest()
        {
            using (var context = new StaticTextsContext(m_builderOptions))
            {
                var culture         = context.Culture.First(t => t.Id == 1);
                var dictionaryScope = context.DictionaryScope.First(t => t.Id == 2);


                var         staticTextDao = new StaticTextDao(context.StaticText);
                IStaticText result        = staticTextDao.FindByNameAndCultureAndScope("support", culture, dictionaryScope,
                                                                                       context.CultureHierarchy);
                Assert.AreEqual(1, result.Id);
                Assert.AreEqual(1, result.Format);
                Assert.AreEqual(
                    "# Podpora\r\nPodpora Vokabuláře webového: \r\n\r\n2012–2015 projekt MK ČR č. DF12P01OVV028 *Informační technologie ve službách jazykového kulturního bohatství (IT JAKUB)*  \r\n2010–2015 projekt MŠMT LINDAT-CLARIN č. LM2010013 *Vybudování a provoz českého uzlu pan-evropské infrastruktury pro výzkum*  \r\n2010–2014 projekt GA ČR č. P406/10/1140 *Výzkum historické češtiny (na základě nových materiálových bází)*  \r\n2010–2014 projekt GA ČR č. P406/10/1153 *Slovní zásoba staré češtiny a její lexikografické zpracování*  \r\n2005–2011 projekt MŠMT ČR LC 546 *Výzkumné centrum vývoje staré a střední češtiny (od praslovanských kořenů po současný stav)*  \r\n",
                    result.Text);
            }
        }
Example #9
0
 public d(PluginHost A_0, string[] A_1, string A_2, string A_3, int A_4, string A_5, IView A_6) : base(A_5, A_6)
 {
     this.a = A_1;
     this.b = A_2;
     this.c = A_3;
     this.d = A_4;
     if (base.a(A_0))
     {
         this.e = new IButton[this.a.Length];
         for (int i = 0; i < this.a.Length; i++)
         {
             this.e[i]      = (IButton)base.a["btn" + i.ToString()];
             this.e[i].Hit += new EventHandler(this.a);
         }
         this.f      = (IStaticText)base.a["Label1"];
         this.f.Text = this.c;
     }
 }
Example #10
0
 public void a(bool A_0)
 {
     if (this.h != A_0)
     {
         this.h = A_0;
         if (A_0)
         {
             this.i = eSettingValueType.tEnum;
             this.j = false;
             this.k = -1;
             this.f = ff.f(PluginCore.cq.ax, "uTank2.ViewXML.AdvancedOptionsView.xml");
             this.d = (IList)this.f["lOptionList"];
             this.c = (IStaticText)this.f["txtInfo"];
             this.b = (ITextBox)this.f["txtEditbox"];
             this.e = (IList)this.f["lFilterList"];
             this.g.Clear();
             foreach (string str in Enum.GetNames(typeof(eSettingCategories)))
             {
                 IListRow row = this.e.Add();
                 row[0][0] = false;
                 row[1][0] = str;
                 this.g.Add((eSettingCategories)Enum.Parse(typeof(eSettingCategories), str));
             }
             this.b();
             this.e.Click      += new dClickedList(this.b);
             this.d.Click      += new dClickedList(this.a);
             this.b.Change_Old += new EventHandler(this.a);
             this.f.Visible     = true;
         }
         else
         {
             this.e.Click      -= new dClickedList(this.b);
             this.d.Click      -= new dClickedList(this.a);
             this.b.Change_Old -= new EventHandler(this.a);
             this.d             = null;
             this.c             = null;
             this.b             = null;
             this.e             = null;
             this.f.Dispose();
             this.f = null;
         }
     }
 }
Example #11
0
        public MyDialog_MessageBox(Decal.Adapter.Wrappers.PluginHost H, string[] pbuttons, string ptitle, string plabel, int picon, string dialogkey, IView pOrigin)
            : base(dialogkey, pOrigin)
        {
            iButtons = pbuttons;
            iTitle   = ptitle;
            iLabel   = plabel;
            iIcon    = picon;

            if (!base.ShowView(H))
            {
                return;
            }

            ResultButtons = new IButton[iButtons.Length];
            for (int i = 0; i < iButtons.Length; ++i)
            {
                ResultButtons[i]      = (IButton)View["btn" + i.ToString()];
                ResultButtons[i].Hit += new EventHandler(MyDialog_MB_Hit);
            }

            Label      = (IStaticText)View["Label1"];
            Label.Text = iLabel;
        }
        /// <summary>
        /// Deletes an identifiable domain object in the repository.
        /// </summary>
        /// <typeparam name="TIdentifiable">Type of the identifiable domain object.</typeparam>
        /// <param name="identifiable">Identifiable domain object to delete.</param>
        public void Delete <TIdentifiable>(TIdentifiable identifiable) where TIdentifiable : IIdentifiable
        {
            if (Equals(identifiable, null))
            {
                throw new ArgumentNullException(nameof(identifiable));
            }

            IHousehold household = identifiable as IHousehold;

            if (household != null)
            {
                Delete <IHousehold, IHouseholdProxy>(household);
                return;
            }

            IStorage storage = identifiable as IStorage;

            if (storage != null)
            {
                Delete <IStorage, IStorageProxy>(storage);
                return;
            }

            IStorageType storageType = identifiable as IStorageType;

            if (storageType != null)
            {
                Delete <IStorageType, IStorageTypeProxy>(storageType);
                return;
            }

            IHouseholdMember householdMember = identifiable as IHouseholdMember;

            if (householdMember != null)
            {
                Delete <IHouseholdMember, IHouseholdMemberProxy>(householdMember);
                return;
            }

            IPayment payment = identifiable as IPayment;

            if (payment != null)
            {
                Delete <IPayment, IPaymentProxy>(payment);
                return;
            }

            IFoodItem foodItem = identifiable as IFoodItem;

            if (foodItem != null)
            {
                Delete <IFoodItem, IFoodItemProxy>(foodItem);
                return;
            }

            IFoodGroup foodGroup = identifiable as IFoodGroup;

            if (foodGroup != null)
            {
                Delete <IFoodGroup, IFoodGroupProxy>(foodGroup);
                return;
            }

            IForeignKey foreignKey = identifiable as IForeignKey;

            if (foreignKey != null)
            {
                Delete <IForeignKey, IForeignKeyProxy>(foreignKey);
                return;
            }

            IStaticText staticText = identifiable as IStaticText;

            if (staticText != null)
            {
                Delete <IStaticText, IStaticTextProxy>(staticText);
                return;
            }

            IDataProvider dataProvider = identifiable as IDataProvider;

            if (dataProvider != null)
            {
                Delete <IDataProvider, IDataProviderProxy>(dataProvider);
                return;
            }

            ITranslation translation = identifiable as ITranslation;

            if (translation != null)
            {
                Delete <ITranslation, ITranslationProxy>(translation);
                return;
            }

            ITranslationInfo translationInfo = identifiable as ITranslationInfo;

            if (translationInfo != null)
            {
                Delete <ITranslationInfo, ITranslationInfoProxy>(translationInfo);
                return;
            }

            throw new NotSupportedException();
        }