Esempio n. 1
0
        /// <summary>
        /// Force-localize the widget.
        /// </summary>
        public void Apply()
        {
            if (uiText == null)
            {
                uiText = GetComponent <TextMeshProUGUI>();
            }

            if (mTexts == null || mTexts.Length != keys.Length)
            {
                mTexts = new string[keys.Length];
            }

            for (int i = 0; i < keys.Length; i++)
            {
                var key = keys[i];
                if (Localize.instance.Exists(key))
                {
                    mTexts[i] = Localize.Get(key);
                }
                else
                {
                    mTexts[i] = "";
                }
            }

            uiText.text = string.Format(format, mTexts);
        }
 private void UpdateLanguage()
 {
     Caption.Title  = Localize.Get("0_CONFIG");
     Apply.Content  = Localize.Get("APPLY");
     Cancel.Content = Localize.Get("CANCEL");
     UpdateTab();
 }
Esempio n. 3
0
        private void Program_NotImplementedException(object sender, EventArgs e)
        {
            Notification na = new Notification(MW.ParentGrid, Localize.Get("NOTIMPLEMENTED"),
                                               Constants.ErrorBrush);

            na.ShowMessage();
        }
Esempio n. 4
0
 public static IValidation GetRequiredValidation(string label)
 {
     return(new RequiredValidation()
     {
         Msg = string.Format(Localize.Get("LBL_REQUIRED", "{0} is required"), label)
     });
 }
 public void UpdateTab()
 {
     InfoGrid.Visibility       = Visibility.Hidden;
     FunctionGrid.Visibility   = Visibility.Hidden;
     EnableL.Content           = Localize.Get("ENABLE");
     FunctionItem.Title        = Localize.Get("FUNCTION");
     CleanUpItem.MainLabelText = Localize.Get("CLEANUP");
 }
        public LogWindow()
        {
            InitializeComponent();
            Caption.Title = Localize.Get(Strings.Log);

            Closing    += LogWindow_Closing;
            Closed     += LogWindow_Closed;
            Loaded     += LogWindow_Loaded;
            LogChanged += LogWindow_LogChanged;
        }
Esempio n. 7
0
            public Plugin()
            {
                Action = new Action(() =>
                {
                    Header = Localize.Get(Strings.Plugin);
                });
                Localize.AddLanguageChangedAction(Action);

                UIControl = new UserControls.PluginOption();
            }
Esempio n. 8
0
            public GeneralCategory()
            {
                Action = new Action(() =>
                {
                    Header = Localize.Get("GENERAL");
                });
                Localize.AddLanguageChangedAction(Action);

                UIControl = gen;
            }
        private void Apply_Click(object sender, RoutedEventArgs e)
        {
            bool Restart = false, CloseDlg = false, Rerender = false, ForceRestart = false;

            for (int i = 0; Category.Length > i; i++)
            {
                ApplyInfo ai = Category[i].Apply();

                if (ai.ForceRestartApp)
                {
                    ForceRestart = true;
                }

                if (ai.RestartApp)
                {
                    Restart = true;
                }

                if (ai.CloseDialog)
                {
                    CloseDlg = true;
                }

                if (ai.RerenderFile)
                {
                    Rerender = true;
                }
            }

            cnf.Save(cnf.Current.Path[Enums.Path.SettingFile]);

            if (ForceRestart)
            {
                RestartApp();
            }

            if (Restart)
            {
                if (ClearUC.Dialogs.Dialog.ShowMessageBox(ClearUC.Dialogs.Dialog.Buttons.YesNo,
                                                          Localize.Get("RESTART_T"), Localize.Get("RESTART_M"), false) == ClearUC.Dialogs.Dialog.ClickedButton.Yes)
                {
                    RestartApp();
                }
            }

            if (CloseDlg)
            {
                Close();
            }

            if (Rerender)
            {
                MW.ReRenderFile(true, true);
            }
        }
Esempio n. 10
0
        private void InitializeLAPPanel()
        {
            MW.OptionalView.ItemClicked += OptionalView_ItemClicked;
            MW.OptionalView.Items.Clear();

            double PerHeight = 35;

            OpenItem = new ListSubItem();
            OpenItem.MainLabelText      = Localize.Get(Strings.Open);
            OpenItem.SubLabelVisibility = Visibility.Hidden;
            OpenItem.Height             = PerHeight;
            MW.OptionalView.Items.Add(OpenItem);

            MW.OptionalView.Items.Add(new Separator());

            ConfigItem = new ListSubItem();
            ConfigItem.MainLabelText      = Localize.Get(Strings.Config);
            ConfigItem.SubLabelVisibility = Visibility.Hidden;
            ConfigItem.Height             = PerHeight;
            MW.OptionalView.Items.Add(ConfigItem);

            if (InstanceData.LogMode)
            {
                LogWindow                  = new LAP.Dialogs.LogWindow();
                LogItem                    = new ListSubItem();
                LogItem.MainLabelText      = Localize.Get(Strings.Log);
                LogItem.SubLabelVisibility = Visibility.Hidden;
                LogItem.Height             = PerHeight;
                MW.OptionalView.Items.Add(LogItem);
            }

            MW.OptionalView.Items.Add(new Separator());

            CreatorItem = new ListSubItem();
            CreatorItem.MainLabelText      = Localize.Get(Strings.Creator);
            CreatorItem.SubLabelVisibility = Visibility.Hidden;
            CreatorItem.Height             = PerHeight;
            MW.OptionalView.Items.Add(CreatorItem);

            MW.OptionalView.Items.Add(new Separator());

            ExitItem = new ListSubItem();
            ExitItem.MainLabelText      = Localize.Get(Strings.Exit);
            ExitItem.SubLabelVisibility = Visibility.Hidden;
            ExitItem.Height             = PerHeight;
            MW.OptionalView.Items.Add(ExitItem);

            double h = 0;

            for (int i = 0; MW.OptionalView.Items.Count > i; i++)
            {
                h += MW.OptionalView.Items[i].Height;
            }
            MW.OptionalGrid.Height = h;
        }
Esempio n. 11
0
 private void Localize_LanguageChanged()
 {
     OpenItem.MainLabelText   = Localize.Get(Strings.Open);
     ConfigItem.MainLabelText = Localize.Get(Strings.Config);
     if (InstanceData.LogMode)
     {
         LogItem.MainLabelText = Localize.Get(Strings.Log);
     }
     CreatorItem.MainLabelText = Localize.Get(Strings.Creator);
     ExitItem.MainLabelText    = Localize.Get(Strings.Exit);
 }
Esempio n. 12
0
        private void OptionalView_ItemClicked(object sender, ClearUC.ItemClickedEventArgs e)
        {
            if (e.Item == OpenItem)
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Title = Localize.Get(Strings.Open);
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    MW.DirectPlay(ofd.FileName);
                }
            }

            if (e.Item == ConfigItem)
            {
                string[] cats_Str = Config.Current.sArrayValue[Enums.sArrayValue.ConfigCategories];
                List <LAPP.Setting.ISettingItem> Cats = new List <LAPP.Setting.ISettingItem>();
                for (int i = 0; cats_Str.Length > i; i++)
                {
                    switch (cats_Str[i])
                    {
                    case "General":
                        Cats.Add(new Classes.GeneralCategory());
                        break;

                    case "Plugin":
                        Cats.Add(new Classes.Plugin());
                        break;
                    }
                }

                Cats.AddRange(PluginManager.GetSettings());

                new Dialogs.Config(MW, Cats.ToArray()).Show();
            }

            if (e.Item == CreatorItem)
            {
                new Dialogs.Creator().ShowDialog();
            }

            if (e.Item == ExitItem)
            {
                MW.Close();
            }

            if (e.Item == LogItem)
            {
                LogWindow.Show();
            }

            MW.OptionalGrid.Visibility = Visibility.Hidden;
        }
Esempio n. 13
0
 public void UpdateLocalize()
 {
     if (EditMode)
     {
         Caption.Title = Localize.Get("EDITALBUM");
     }
     else
     {
         Caption.Title = Localize.Get("CREATEALBUM");
     }
     ofd.Title             = Localize.Get("0_OPEN");
     AddItem.MainLabelText = Localize.Get("ADDFILE");
     SaveB.Content         = Localize.Get("SAVE");
 }
Esempio n. 14
0
        public Creator()
        {
            InitializeComponent();

            Caption.Title = Localize.Get(Strings.Config);

            LicenseTab.ActiveItemChanged += LicenseTab_ActiveItemChanged;

            LicenseTab.Items.Add(new ClearUC.Tab.TabItem("Ms-PL"));
            LicenseTab.Items.Add(new ClearUC.Tab.TabItem("Icons"));

            LicenseTab.ActiveIndex = 0;

            CreatorL.Content = Localize.Get(Strings.Creator) + " : Kaisei Sunaga";
            VersionL.Content = Localize.Get(Strings.Version) + " : " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
        }
Esempio n. 15
0
        private static void cin_start()
        {
            Vehicle vehicle = null;

            if (uConsole.GetNumParameters() == 1)
            {
                string @string = uConsole.GetString();
                vehicle = Vehicles.FindVehicleWithLabel(@string);
                if (vehicle == null)
                {
                    uConsole.Log("Could not find vehicle with label " + @string);
                    return;
                }
                uConsole.Log("Following " + Localize.Get(vehicle.m_DisplayNameLocKey).ToString() + vehicle.GetTextMeshString().ToString());
            }
            CinemaCamera.SaveStart(vehicle);
        }
Esempio n. 16
0
        /// <summary>
        /// Receiver for bluetooth status changes.
        /// </summary>
        /// <param name="state">State.</param>
        public void OnBluetoothState(string state)
        {
            // TODO: LOCALIZATION!!!
            switch (state)
            {
            case "ON":
                bluetoothOn            = true;
                BluetoothMessage.text  = Localize.Get("FTUE.BluetoothMessage.On");
                PlayButtonMessage.text = Localize.Get("FTUE.PlayButton.On");
                break;

            case "OFF":
                bluetoothOn            = false;
                BluetoothMessage.text  = Localize.Get("FTUE.BluetoothMessage.Off");
                PlayButtonMessage.text = Localize.Get("FTUE.PlayButton.Off");
                break;
            }
        }
Esempio n. 17
0
        private void UpdateLang()
        {
            LangC.Items.Clear();
            Langs     = null;
            LangFiles = null;

            if (Directory.Exists(Config.Current.Path[Enums.Path.LanguageDirectory]))
            {
                string[] files = Directory.GetFiles(Config.Current.Path[Enums.Path.LanguageDirectory],
                                                    "*.loc").Where(item => Path.GetExtension(item).ToLower() == ".loc").ToArray();
                Langs = new LAPP.Management.Localize[files.Length];

                for (int i = 0; files.Length > i; i++)
                {
                    string name = Path.GetFileName(files[i]);
                    LAPP.Management.Localize loc = LAPP.Management.Localize.Load(files[i]);
                    Langs[i] = loc;

                    if (loc.Info.ContainsKey("Language"))
                    {
                        LangC.Items.Add(loc.Info["Language"]);
                    }
                    else
                    {
                        LangC.Items.Add(Localize.Get(Strings.Unknown) + "(" + name + ")");
                    }

                    if (!string.IsNullOrEmpty(Localize.CurrentFilePath))
                    {
                        if (Localize.CurrentFilePath == files[i])
                        {
                            LangC.SelectedIndex = i;
                        }
                    }
                }

                LangFiles = files;
            }
        }
Esempio n. 18
0
        private void InstallLangB_Click(object sender, RoutedEventArgs e)
        {
            string dir = Config.Current.Path[Enums.Path.LanguageDirectory];

            if (File.Exists(dir))
            {
                Config.Current.Path.Reset(Enums.Path.LanguageDirectory);
                dir = Config.Current.Path[Enums.Path.LanguageDirectory];
            }

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
            ofd.Filter   = Localize.Get("LOCALIZE_FILE") + "|*.loc";
            ofd.FileName = null;
            ofd.Title    = Localize.Get(Strings.Open);
            if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string Dest = dir + Path.GetFileName(ofd.FileName);

                if (File.Exists(Dest))
                {
                    if (ClearUC.Dialogs.Dialog.ShowMessageBox(ClearUC.Dialogs.Dialog.Buttons.YesNo,
                                                              Localize.Get("OVERWRITE_T"), Localize.Get("OVERWRITE_M")) == ClearUC.Dialogs.Dialog.ClickedButton.No)
                    {
                        return;
                    }
                }

                File.Copy(ofd.FileName, Dest, true);
            }

            UpdateLang();
        }
Esempio n. 19
0
 public string GetString()
 {
     return(Localize.Get(stringRef.Value));
 }
Esempio n. 20
0
 private void Localize_LanguageChanged()
 {
     InstallLangB.Content = Localize.Get("INSTALL_LANG");
     LangL.Content        = Localize.Get("LANGUAGE");
     UpdateLang();
 }
Esempio n. 21
0
        public void AddButtons()
        {
            PlayPauseButton         = new ThumbnailToolBarButton(ToIcon(Resources.Taskbar.Play), Localize.Get(Strings.Play));
            PlayPauseButton.Click  += PlayPauseButton_Click;
            PlayPauseButton.Visible = false;

            NextButton         = new ThumbnailToolBarButton(ToIcon(Resources.Taskbar.FastForward), Localize.Get(Strings.Next));
            NextButton.Click  += NextButton_Click;
            NextButton.Visible = false;

            BackButton         = new ThumbnailToolBarButton(ToIcon(Resources.Taskbar.Rewind), Localize.Get(Strings.Back));
            BackButton.Click  += BackButton_Click;
            BackButton.Visible = false;

            TaskbarManager.Instance.ThumbnailToolBars.AddButtons(new WindowInteropHelper(ParentWindow).Handle,
                                                                 new ThumbnailToolBarButton[] { BackButton, PlayPauseButton, NextButton });
        }