Beispiel #1
0
        private void UpdateView()
        {
            using (var context = new ApplicationDBContext())
            {
                employeesDataGridView.DataSource = context.GetEmployees(search).ToSortableBindingList();;

                employeesDataGridView.Columns[nameof(Employee.ID)].Visible      = false;
                employeesDataGridView.Columns[nameof(Employee.Role)].HeaderText =
                    Localizations.GetValueOrSelf(nameof(Employee.Role));


                employeesDataGridView.Columns[nameof(Employee.FIO)].HeaderText =
                    Localizations.GetValueOrSelf(nameof(Employee.FIO));
                employeesDataGridView.Columns[nameof(Employee.ITN)].HeaderText =
                    Localizations.GetValueOrSelf(nameof(Employee.ITN));
                employeesDataGridView.Columns[nameof(Employee.Login)].HeaderText =
                    Localizations.GetValueOrSelf(nameof(Employee.Login));
                employeesDataGridView.Columns[nameof(Employee.Passport)].HeaderText =
                    Localizations.GetValueOrSelf(nameof(Employee.Passport));
                employeesDataGridView.Columns[nameof(Employee.PhoneNumber)].HeaderText =
                    Localizations.GetValueOrSelf(nameof(Employee.PhoneNumber));
                employeesDataGridView.Columns[nameof(Employee.Post)].HeaderText =
                    Localizations.GetValueOrSelf(nameof(Employee.Post));
            }
        }
        private int?BuildingToDemolish(Village vill, HtmlDocument htmlDoc)
        {
            if (vill.Build.DemolishTasks.Count == 0)
            {
                return(null);
            }

            var task = vill.Build.DemolishTasks.FirstOrDefault();

            var building = htmlDoc.GetElementbyId("demolish").ChildNodes
                           .FirstOrDefault(x =>
                                           x.GetAttributeValue("value", "") == task.BuildingId.ToString()
                                           );

            //If this building doesn't exist or is below/on the correct level, find next building to demolish
            if (building == null)
            {
                vill.Build.DemolishTasks.Remove(task);
                return(BuildingToDemolish(vill, htmlDoc));
            }
            //TODO: get name of the building you are destroying. localization.
            var option         = building.InnerText;
            var lvl            = option.Split(' ').LastOrDefault();
            var buildingName   = Parser.RemoveNumeric(option.Split('.')[1]).Trim();
            var optionBuilding = Localizations.BuildingFromString(buildingName);

            if (int.Parse(lvl) <= task.Level || optionBuilding != task.Building)
            {
                vill.Build.DemolishTasks.Remove(task);
                return(BuildingToDemolish(vill, htmlDoc));
            }
            return(task.BuildingId);
        }
Beispiel #3
0
        public static bool debugCheckHasMaterialLocalizations(BuildContext context)
        {
            D.assert(() => {
                if (Localizations.of <MaterialLocalizations>(context, typeof(MaterialLocalizations)) == null)
                {
                    var list = new List <DiagnosticsNode>()
                    {
                        new ErrorSummary("No MaterialLocalizations found."),
                        new ErrorDescription(
                            "${context.widget.runtimeType} widgets require MaterialLocalizations " +
                            "to be provided by a Localizations widget ancestor."
                            ),
                        new ErrorDescription(
                            "Localizations are used to generate many different messages, labels, " +
                            "and abbreviations which are used by the material library."
                            ),
                        new ErrorHint(
                            "To introduce a MaterialLocalizations, either use a " +
                            "MaterialApp at the root of your application to include them " +
                            "automatically, or add a Localization widget with a " +
                            "MaterialLocalizations delegate."
                            ),
                    };
                    list.AddRange(context.describeMissingAncestor(expectedAncestorType: typeof(MaterialLocalizations)));
                    throw new UIWidgetsError(list);
                }

                return(true);
            });
            return(true);
        }
Beispiel #4
0
 public void Include(EntityData otherData)
 {
     Alerts.AddRange(otherData.Alerts);
     EmailAlertRecipients.AddRange(otherData.EmailAlertRecipients);
     SmsAlertRecipients.AddRange(otherData.SmsAlertRecipients);
     AlertReports.AddRange(otherData.AlertReports);
     AlertRules.AddRange(otherData.AlertRules);
     ApplicationLanguages.AddRange(otherData.ApplicationLanguages);
     ContentLanguages.AddRange(otherData.ContentLanguages);
     Countries.AddRange(otherData.Countries);
     DataCollectors.AddRange(otherData.DataCollectors);
     Districts.AddRange(otherData.Districts);
     GatewaySettings.AddRange(otherData.GatewaySettings);
     HeadManagerConsents.AddRange(otherData.HeadManagerConsents);
     HealthRisks.AddRange(otherData.HealthRisks);
     HealthRiskLanguageContents.AddRange(otherData.HealthRiskLanguageContents);
     Localizations.AddRange(otherData.Localizations);
     LocalizedTemplates.AddRange(otherData.LocalizedTemplates);
     NationalSocieties.AddRange(otherData.NationalSocieties);
     Notifications.AddRange(otherData.Notifications);
     Projects.AddRange(otherData.Projects);
     SupervisorUserProjects.AddRange(otherData.SupervisorUserProjects);
     ProjectHealthRisks.AddRange(otherData.ProjectHealthRisks);
     RawReports.AddRange(otherData.RawReports);
     Regions.AddRange(otherData.Regions);
     Reports.AddRange(otherData.Reports);
     Users.AddRange(otherData.Users);
     UserNationalSocieties.AddRange(otherData.UserNationalSocieties);
     Villages.AddRange(otherData.Villages);
     Zones.AddRange(otherData.Zones);
 }
Beispiel #5
0
        private async Task SaveAndExit()
        {
            if (_useDiscordRpc && !Properties.Settings.Default.UseDiscordRpc) // previously enabled
            {
                DiscordIntegration.Deinitialize();
            }

            if (Properties.Settings.Default.AssetsLanguage != Languages_CbBox.SelectedIndex)
            {
                Properties.Settings.Default.AssetsLanguage = Languages_CbBox.SelectedIndex;
                await Localizations.SetLocalization(Properties.Settings.Default.AssetsLanguage, true).ConfigureAwait(false);
            }


            if (!_inputPath.Equals(Properties.Settings.Default.PakPath) ||
                !_outputPath.Equals(Properties.Settings.Default.OutputPath) ||
                _useEnglish != Properties.Settings.Default.UseEnglish)
            {
                DarkMessageBoxHelper.Show(Properties.Resources.PathChangedRestart, Properties.Resources.PathChanged, MessageBoxButton.OK, MessageBoxImage.Information);
                DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[Restarting]", "Path(s) changed");

                Properties.Settings.Default.Save();
                Process.Start(Process.GetCurrentProcess().MainModule.FileName);
                Application.Current.Shutdown();
            }
            else
            {
                Properties.Settings.Default.Save();
                DebugHelper.WriteUserSettings();
                DebugHelper.WriteLine("{0} {1} {2}", "[FModel]", "[Window]", "Closing General Settings");
            }
        }
        public static List <BuildingCurrently> CurrentlyBuilding(HtmlAgilityPack.HtmlDocument htmlDoc)
        {
            var finishButton = htmlDoc.DocumentNode.Descendants("div").FirstOrDefault(x => x.HasClass("finishNow"));

            if (finishButton == null)
            {
                return(null);
            }
            var ret = new List <BuildingCurrently>();

            foreach (var row in finishButton.ParentNode.Descendants("li").ToList())
            {
                var duration = TimeParser.ParseTimer(row);
                var name     = row.Descendants("div").FirstOrDefault(x => x.HasClass("name")).InnerText.Split('\n')[1].Trim();
                var lvl      = Parser.RemoveNonNumeric(row.Descendants("span").FirstOrDefault(x => x.HasClass("lvl")).InnerText);

                ret.Add(new BuildingCurrently()
                {
                    Duration = DateTime.Now.Add(duration),
                    Level    = (byte)lvl,
                    Building = Localizations.BuildingFromString(name)
                });
            }
            return(ret);
        }
Beispiel #7
0
        /// <summary>
        /// Parses the ongoing resource transits in the market.
        /// </summary>
        /// <param name="htmlDoc">Html</param>
        public static List <MerchantsUnderWay> ParseTransits(HtmlAgilityPack.HtmlDocument htmlDoc)
        {
            var formulat = htmlDoc.GetElementbyId("merchantsOnTheWay");

            var         underWay    = new List <MerchantsUnderWay>();
            TransitType transitType = default;

            foreach (var child in formulat.ChildNodes)
            {
                if (child.HasClass("spacer"))
                {
                    transitType = Localizations.MercahntDirectionFromString(child.InnerText);
                    continue;
                }
                else if (child.HasClass("traders"))
                {
                    underWay.Add(new MerchantsUnderWay()
                    {
                        Arrival         = DateTime.Now.Add(TimeParser.ParseTimer(child)),
                        TargetVillageId = (int)Parser.RemoveNonNumeric(child.Descendants("td").First(x => x.HasClass("dorf")).Descendants("a").First().GetAttributeValue("href", "")),
                        RepeatTimes     = (int)Parser.RemoveNonNumeric(child.Descendants("div").First(x => x.HasClass("repeat")).InnerText),
                        Transit         = transitType,
                        Resources       = ResourceParser.ParseResourcesMerchants(child),
                    });
                }
            }
            return(underWay);
        }
        public SettingsLanguageViewModel()
        {
            _localizations = CollectionViewSource.GetDefaultView(LocalizationManager.List);
            _localizations.SortDescriptions.Add(new SortDescription(nameof(LocalizationInfo.Name), ListSortDirection.Ascending));

            _localizations.Filter = o =>
            {
                if (string.IsNullOrEmpty(Search))
                {
                    return(true);
                }

                LocalizationInfo info = o as LocalizationInfo;

                string search = Search.Trim();

                // Search by: Name
                return(info.Name.IndexOf(search, StringComparison.OrdinalIgnoreCase) > -1 || info.NativeName.IndexOf(search, StringComparison.OrdinalIgnoreCase) > -1);
            };

            LocalizationSelectedItem = Localizations.Cast <LocalizationInfo>().FirstOrDefault(x => x.Code == LocalizationManager.Current.Code);

            LoadSettings();

            _isLoading = false;
        }
Beispiel #9
0
        /// <summary>
        /// Get fw version from firmeware.diydrones.com
        /// </summary>
        /// <param name="fwurl"></param>
        /// <returns></returns>
        void getAPMVersion(object tempin)
        {
            System.Threading.Thread.CurrentThread.CurrentUICulture = Localizations.ConfigLang;

            try
            {
                software temp = (software)tempin;

                string baseurl = temp.urlpx4v2;

                if (baseurl == "")
                {
                    return;
                }

                Localizations.ReplaceMirrorUrl(ref baseurl);

                Uri url = new Uri(new Uri(baseurl), "git-version.txt");

                log.Info("Get url " + url.ToString());

                updateProgress(-1, Strings.GettingFWVersion);

                WebRequest  wr    = WebRequest.Create(url);
                WebResponse wresp = wr.GetResponse();

                StreamReader sr = new StreamReader(wresp.GetResponseStream());

                while (!sr.EndOfStream)
                {
                    string line = sr.ReadLine();

                    if (line.Contains("APMVERSION:"))
                    {
                        log.Info(line);

                        // get index
                        var index = softwares.IndexOf(temp);
                        // get item to modify
                        var item = softwares[index];
                        // change name
                        item.name = line.Substring(line.IndexOf(':') + 2);
                        // save back to list
                        softwares[index] = item;

                        return;
                    }
                }

                log.Info("no answer");
            }
            catch (Exception ex) { log.Error(ex); }
            finally
            {
                lock (this)
                {
                    ingetapmversion--;
                }
            }
        }
Beispiel #10
0
        private void ShowRent()
        {
            carTextBox.Text      = Rent.Car.ToString();
            employeeTextBox.Text = Rent.Employee.ToString();
            clientTextBox.Text   = Rent.Client.ToString();

            typeOfPaymentTextBox.Text = Rent.TypeOfPayment;
            startDatePicker.Value     = Rent.StartDate;
            daysUpDown.Value          = Rent.RentalPeriod;
            endDatePicker.Value       = Rent.StartDate.AddDays(Rent.RentalPeriod);

            servicesDataGridView.DataSource = Rent.AdditionalService;

            servicesDataGridView.Columns[nameof(ServiceInRentInfo.RentId)].Visible =
                false;
            servicesDataGridView.Columns[nameof(ServiceInRentInfo.ServiceInRentId)].Visible =
                false;

            servicesDataGridView.Columns[nameof(ServiceInRentInfo.Price)].HeaderText =
                Localizations.GetValueOrSelf(nameof(ServiceInRentInfo.Price));

            servicesDataGridView.Columns[nameof(ServiceInRentInfo.Quantity)].HeaderText =
                Localizations.GetValueOrSelf(nameof(ServiceInRentInfo.Quantity));

            servicesDataGridView.Columns[nameof(ServiceInRentInfo.Service)].HeaderText =
                Localizations.GetValueOrSelf(nameof(ServiceInRentInfo.Service));
        }
        private IStringLocalizationProperty GetProperty([NotNull] CultureInfo info)
        {
            if (info is null)
            {
                throw new ArgumentNullException(nameof(info));
            }

            if (Dictionary.TryGetValue(info, out IStringLocalizationProperty property))
            {
                return(property);
            }

            if (!Localizations.TryGetValue(info, out ISubLocalization config))
            {
                return(null);
            }

            property = config?.GetProperty(Key, Sections);

            if (property is not null)
            {
                Dictionary.Add(info, property);
            }

            return(property);
        }
Beispiel #12
0
        public static List <BuildingCurrently> CurrentlyBuilding(HtmlAgilityPack.HtmlDocument htmlDoc, Account acc)
        {
            var finishButton = htmlDoc.DocumentNode.Descendants("div").FirstOrDefault(x => x.HasClass("finishNow"));

            if (finishButton == null)
            {
                return(null);
            }
            var ret = new List <BuildingCurrently>();

            foreach (var row in finishButton.ParentNode.Descendants("li").ToList())
            {
                var duration = TimeParser.ParseTimer(row);
                var nameArr  = row.Descendants("div").FirstOrDefault(x => x.HasClass("name")).InnerText.Split('\t'); //[1].Trim();

                var    levelStr = row.Descendants("span").FirstOrDefault(x => x.HasClass("lvl")).InnerText;
                string name     = nameArr.FirstOrDefault(x => !string.IsNullOrEmpty(x.Replace("\r", "").Replace("\n", "")));
                switch (acc.AccInfo.ServerVersion)
                {
                case Classificator.ServerVersionEnum.T4_4:
                    name = name.Replace(levelStr, "");
                    break;
                }
                var lvl = Parser.RemoveNonNumeric(levelStr);

                ret.Add(new BuildingCurrently()
                {
                    Duration = DateTime.Now.Add(duration),
                    Level    = (byte)lvl,
                    Building = Localizations.BuildingFromString(name, acc)
                });
            }
            return(ret);
        }
Beispiel #13
0
        public override Widget build(BuildContext context)
        {
            D.assert(material_.debugCheckHasMaterialLocalizations(context));
            string name    = widget.applicationName ?? material_._defaultApplicationName(context);
            string version = widget.applicationVersion ?? material_._defaultApplicationVersion(context);
            Widget icon    = widget.applicationIcon ?? material_._defaultApplicationIcon(context);
            MaterialLocalizations localizations = MaterialLocalizations.of(context);
            var list = new List <Widget>();

            list.Add(new Text(name, style: Theme.of(context).textTheme.headline5, textAlign: TextAlign.center));

            if (icon != null)
            {
                list.Add(new IconTheme(data: Theme.of(context).iconTheme, child: icon));
            }

            list.Add(new Text(version, style: Theme.of(context).textTheme.bodyText2, textAlign: TextAlign.center));
            list.Add(new Container(height: 18.0f));
            list.Add(new Text(widget.applicationLegalese ?? "", style: Theme.of(context).textTheme.caption,
                              textAlign: TextAlign.center));
            list.Add(new Container(height: 18.0f));
            list.Add(new Text("Powered by Flutter", style: Theme.of(context).textTheme.bodyText2,
                              textAlign: TextAlign.center));
            list.Add(new Container(height: 24.0f));
            list.AddRange(_licenses);
            if (!_loaded)
            {
                list.Add(new Padding(
                             padding: EdgeInsets.symmetric(vertical: 24.0f),
                             child: new Center(
                                 child: new CircularProgressIndicator()
                                 )
                             ));
            }

            return(new Scaffold(
                       appBar: new AppBar(
                           title: new Text(localizations.licensesPageTitle)
                           ),
                       // All of the licenses page text is English. We don"t want localized text
                       // or text direction.
                       body: Localizations.overrides(
                           locale: new Locale("en", "US"),
                           context: context,
                           child: new DefaultTextStyle(
                               style: Theme.of(context).textTheme.caption,
                               child: new SafeArea(
                                   bottom: false,
                                   child: new Scrollbar(
                                       child: new ListView(
                                           padding: EdgeInsets.symmetric(horizontal: 8.0f, vertical: 12.0f),
                                           children: list
                                           )
                                       )
                                   )
                               )
                           )
                       ));
        }
Beispiel #14
0
 public override TEntity CreateEntity()
 {
     if (!Localizations.Any())
     {
         throw new Exception("Not localizations in localizable model!");
     }
     return(base.CreateEntity());
 }
Beispiel #15
0
 void Awake()
 {
     if (instance != null)
     {
         Debug.LogError("Translations component must be unique!");
     }
     instance = this;
 }
Beispiel #16
0
 void OnDestroy()
 {
     if (instance != this)
     {
         Debug.LogError("Translations component must be unique!");
     }
     instance = null;
 }
Beispiel #17
0
        public string NameForLanguage(string languageCode)
        {
            if (Localizations is null || !Localizations.TryGetValue(languageCode, out var translation))
            {
                return(Name);
            }

            return(translation);
        }
        public async Task UpdUserLocalization(StoreUser user, Localizations localization)
        {
            if (await context.Database.CanConnectAsync() && localization != 0 && user != null)
            {
                user.Localization = localization;
                context.Users.Update(user);

                await context.SaveChangesAsync();
            }
        }
Beispiel #19
0
        public CompletionReward(IntProperty completionCount)
        {
            string all         = Localizations.GetLocalization("AthenaChallengeDetailsEntry", "CompletionRewardFormat_All", "Complete <text color=\"FFF\" case=\"upper\" fontface=\"black\">all {0} challenges</> to earn the reward item");
            string allFormated = ReformatString(all, completionCount.Value.ToString(), true);
            string any         = Localizations.GetLocalization("AthenaChallengeDetailsEntry", "CompletionRewardFormat", "Complete <text color=\"FFF\" case=\"upper\" fontface=\"black\">any {0} challenges</> to earn the reward item");
            string anyFormated = ReformatString(any, completionCount.Value.ToString(), false);

            CompletionText = completionCount.Value >= 0 ? anyFormated : allFormated;

            Reward = null;
        }
Beispiel #20
0
        private void ShowEmployee()
        {
            fioTextBox.Text      = Employee.FIO;
            passportTextBox.Text = Employee.Passport;
            phoneTextBox.Text    = Employee.PhoneNumber;
            postTextBox.Text     = Employee.Post;
            passwordTextBox.Text = Employee.Pass;
            loginTextBox.Text    = Employee.Login;
            itnTextBox.Text      = Employee.ITN;

            roleTextBox.Text = Localizations.GetValueOrSelf(Employee.Role.ToString());
        }
Beispiel #21
0
        private void RentCreateEdit_Load(object sender, EventArgs e)
        {
            servicesInfoList = new BindingList <ServiceInRentInfo>();
            using (var context = new ApplicationDBContext())
            {
                var search = Rent is null ? SearchCarParam.OnlyAvailable : SearchCarParam.Empty;
                carsComboBox.DataSource = context.GetCars(search).ToArray();
            }

            using (var context = new ApplicationDBContext())
            {
                clientsComboBox.DataSource = context.GetClients(SearchClientParam.Empty).ToArray();
            }

            using (var context = new ApplicationDBContext())
            {
                employeesComboBox.DataSource = context.GetEmployees(SearchEmployeeParam.Empty).ToArray();
            }

            using (var context = new ApplicationDBContext())
            {
                servicesList = new BindingList <Service>(
                    context.GetServices(SearchServiceParam.Empty).ToList()
                    );
            }

            endDatePicker.Value = startDatePicker.Value.AddDays((int)daysUpDown.Value);

            servicesComboBox.DataSource     = servicesList;
            servicesDataGridView.DataSource = servicesInfoList;

            servicesDataGridView.Columns[nameof(ServiceInRentInfo.RentId)].Visible =
                false;

            servicesDataGridView.Columns[nameof(ServiceInRentInfo.ServiceInRentId)].Visible =
                false;

            servicesDataGridView.Columns[nameof(ServiceInRentInfo.Price)].HeaderText =
                Localizations.GetValueOrSelf(nameof(ServiceInRentInfo.Price));

            servicesDataGridView.Columns[nameof(ServiceInRentInfo.Quantity)].HeaderText =
                Localizations.GetValueOrSelf(nameof(ServiceInRentInfo.Quantity));

            servicesDataGridView.Columns[nameof(ServiceInRentInfo.Service)].HeaderText =
                Localizations.GetValueOrSelf(nameof(ServiceInRentInfo.Service));

            if (Rent != null)
            {
                ShowRent();
            }

            SetPrice();
        }
Beispiel #22
0
        public void AddLocalization(string languageCode, string key, string value)
        {
            Dictionary <string, string> values;

            if (!Localizations.TryGetValue(languageCode, out values))
            {
                values = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
                Localizations.Add(languageCode, values);
            }

            values[key] = value;
        }
Beispiel #23
0
    public static string processString(object cur, object o, string s)
    {
        if (s == null)
        {
            return(null);
        }

                #if USE_LAURETTE
        s = s.Replace("@LANGUAGE", Localizations.GetLanguageCode());
                #endif
        s = s.Replace("\\n", "\n");

        if (s.Equals("nan"))
        {
            return("0");
        }

        if (s.StartsWith("@localization("))
        {
                        #if USE_LAURETTE
            string evalListString = s.Substring(14, s.Length - 15);
            s = Localizations.TranslateKey(evalListString);
                        #endif
        }
        else if (s.StartsWith("@eval("))
        {
            string evalListString = s.Substring(6, s.Length - 7);
            s = evaluateString(evalListString, o, 1.0f);

            PUGameObject current = cur as PUGameObject;
            if (current != null)
            {
                foreach (var token in mathParser.usedTokens)
                {
                    current.Canvas.GetVariable(token).AddListener(current);
                }
            }
        }
        else if (s.StartsWith("@dpi("))
        {
            string evalListString = s.Substring(5, s.Length - 6);
            s = evaluateString(evalListString, o, PlanetUnityOverride.screenDPI());
        }
        else if (s.StartsWith("@app1("))
        {
            string evalListString = s.Substring(6, s.Length - 7);
            s = evaluateString(evalListString, o, PlanetUnityOverride.screenDPI(), PlanetUnityOverride.app1);
        }

        return(PlanetUnityOverride.appProcessString(s));
    }
        public RentHistoryView(Reception[] receptions)
        {
            InitializeComponent();
            receptionsDataGridView.DataSource = receptions.ToSortableBindingList();

            receptionsDataGridView.Columns[nameof(Reception.Rent)].Visible = false;
            receptionsDataGridView.Columns[nameof(Reception.EmployeeConclusion)].Visible =
                false;

            receptionsDataGridView.Columns[nameof(Reception.Id)].HeaderText =
                Localizations.GetValueOrSelf(nameof(Reception.Id));
            receptionsDataGridView.Columns[nameof(Reception.DateOfReceipt)].HeaderText =
                Localizations.GetValueOrSelf(nameof(Reception.DateOfReceipt));
        }
Beispiel #25
0
 public static bool debugCheckHasMaterialLocalizations(BuildContext context)
 {
     D.assert(() => {
         if (Localizations.of <MaterialLocalizations>(context, typeof(MaterialLocalizations)) == null)
         {
             StringBuilder message = new StringBuilder();
             message.AppendLine("No MaterialLocalizations found.");
             message.AppendLine(
                 context.widget.GetType() + " widgets require MaterialLocalizations " +
                 "to be provided by a Localizations widget ancestor.");
             message.AppendLine(
                 "Localizations are used to generate many different messages, labels," +
                 "and abbreviations which are used by the material library. ");
             message.AppendLine(
                 "To introduce a MaterialLocalizations, either use a " +
                 " MaterialApp at the root of your application to include them " +
                 "automatically, or add a Localization widget with a " +
                 "MaterialLocalizations delegate.");
             message.AppendLine(
                 "The specific widget that could not find a MaterialLocalizations ancestor was:"
                 );
             message.AppendLine("  " + context.widget);
             List <Widget> ancestors = new List <Widget>();
             context.visitAncestorElements((Element element) => {
                 ancestors.Add(element.widget);
                 return(true);
             });
             if (ancestors.isNotEmpty())
             {
                 message.Append("The ancestors of this widget were:");
                 foreach (Widget ancestor in ancestors)
                 {
                     message.Append("\n  " + ancestor);
                 }
             }
             else
             {
                 message.AppendLine(
                     "This widget is the root of the tree, so it has no " +
                     "ancestors, let alone a \"Localizations\" ancestor."
                     );
             }
             throw new UIWidgetsError(message.ToString());
         }
         return(true);
     });
     return(true);
 }
Beispiel #26
0
        private void UpdateView()
        {
            using (var context = new ApplicationDBContext())
            {
                servicesDataGridView.DataSource = context.GetServices(search).ToSortableBindingList();;

                servicesDataGridView.Columns[nameof(Service.ID)].Visible             = false;
                servicesDataGridView.Columns[nameof(Service.Specifications)].Visible = false;

                servicesDataGridView.Columns[nameof(Service.Name)].HeaderText =
                    Localizations.GetValueOrSelf(nameof(Service.Name));

                servicesDataGridView.Columns[nameof(Service.Price)].HeaderText =
                    Localizations.GetValueOrSelf(nameof(Service.Price));
            }
        }
Beispiel #27
0
        internal FStringTable(PackageReader reader)
        {
            TableNamespace = reader.ReadFString();
            KeysToMetadata = new Dictionary <string, Dictionary <string, string> >
            {
                { TableNamespace, new Dictionary <string, string>() }
            };

            int NumEntries = reader.ReadInt32();

            for (int i = 0; i < NumEntries; i++)
            {
                string key = reader.ReadFString();
                KeysToMetadata[TableNamespace].Add(key, Localizations.GetLocalization(TableNamespace, key, reader.ReadFString()));
            }
        }
Beispiel #28
0
        public void ChangeFormLanguage(Localizations newLocalization)
        {
            LanguageSettings LS = new LanguageSettings();

            LS.SetCulture(newLocalization);
            var resources = new ComponentResourceManager(typeof(Main));

            CultureInfo newCultureInfo = new CultureInfo(EnumDescriptionHelper.GetEnumDescription(newLocalization));

            foreach (Control c in this.Controls)
            {
                resources.ApplyResources(c, c.Name, newCultureInfo);
            }

            resources.ApplyResources(this, "$this", newCultureInfo);
        }
        public PluginDocumentationPage(Type pluginType)
        {
            PluginType = pluginType;
            var image = pluginType.GetImage(0).Source;

            _xml = GetXML(pluginType);

            var authorAttribut = pluginType.GetPluginAuthorAttribute();

            if (authorAttribut != null)
            {
                AuthorName      = authorAttribut.Author;
                AuthorEmail     = authorAttribut.Email;
                AuthorInstitute = authorAttribut.Institute;
                AuthorURL       = authorAttribut.URL;
            }

            if (pluginType.GetComponentCategoryAttributes().Count() > 0)
            {
                Category = pluginType.GetComponentCategoryAttributes().First().Category;
            }
            else
            {
                Category = ComponentCategory.Undefined;
            }
            Settings = GetSettings(pluginType);

            if (_xml == null || _xml.Name != "documentation")
            {
                //entity doesn't have a proper _xml file
                _xml = null;
                Localizations.Add("en", CreateLocalizedEntityDocumentationPage(this, pluginType, null, "en", image as BitmapFrame));
            }
            else
            {
                foreach (var lang in XMLHelper.GetAvailableLanguagesFromXML(_xml.Elements("language").Select(langElement => langElement.Attribute("culture").Value)))
                {
                    Localizations.Add(lang, CreateLocalizedEntityDocumentationPage(this, pluginType, _xml, lang, image as BitmapFrame));
                }
                if (!Localizations.ContainsKey("en"))
                {
                    throw new Exception("Documentation should at least support english language!");
                }

                References = XMLHelper.ReadReferences(_xml);
            }
        }
Beispiel #30
0
        public static IPromise <object> showDatePicker(
            BuildContext context,
            DateTime initialDate,
            DateTime firstDate,
            DateTime lastDate,
            SelectableDayPredicate selectableDayPredicate = null,
            DatePickerMode initialDatePickerMode          = DatePickerMode.day,
            Locale locale             = null,
            TransitionBuilder builder = null
            )
        {
            D.assert(initialDate >= firstDate, () => "initialDate must be on or after firstDate");
            D.assert(initialDate <= lastDate, () => "initialDate must be on or before lastDate");
            D.assert(firstDate <= lastDate, () => "lastDate must be on or after firstDate");
            D.assert(
                selectableDayPredicate == null || selectableDayPredicate(initialDate),
                () => "Provided initialDate must satisfy provided selectableDayPredicate"
                );
            D.assert(context != null);
            D.assert(MaterialD.debugCheckHasMaterialLocalizations(context));

            Widget child = new _DatePickerDialog(
                initialDate: initialDate,
                firstDate: firstDate,
                lastDate: lastDate,
                selectableDayPredicate: selectableDayPredicate,
                initialDatePickerMode: initialDatePickerMode
                );

            if (locale != null)
            {
                child = Localizations.overrides(
                    context: context,
                    locale: locale,
                    child: child
                    );
            }

            return(DialogUtils.showDialog(
                       context: context,
                       builder: (BuildContext _context) => { return builder == null ? child : builder(_context, child); }
                       ));
        }
    void Awake()
    {
        if (instance != null)
            Debug.LogError("Translations component must be unique!");
        instance = this;

        if (Application.srcValue.Contains("language=de"))
            mcLanguage = "de";
        else if (Application.srcValue.Contains("language=es"))
            mcLanguage = "es";
        else
            mcLanguage = "en";
        chooseLanguage();
    }
 void OnDestroy()
 {
     if (instance != this)
         Debug.LogError("Translations component must be unique!");
     instance = null;
 }