Page Index Toggle Pages: 1 [2]  Send TopicPrint
Very Hot Topic (More than 25 Replies) Unable to load custom themes (Read 10934 times)
Harshvir
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 36
Joined: Aug 26th, 2020
Re: Unable to load custom themes
Reply #15 - Sep 14th, 2020 at 4:20pm
Print Post  
Thanks I already looked at that sample but our use case is that we need to show all three characters.
  
Back to top
 
IP Logged
 
Harshvir
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 36
Joined: Aug 26th, 2020
Re: Unable to load custom themes
Reply #16 - Sep 19th, 2020 at 1:09am
Print Post  
Hi,
I was trying to use the suggestion you gave about accessing the CapitalCase property, but I am not able to find any sample of how to access that from my color converter.

Code
Select All
<TextBlock Text="{Binding UpperCase}" Foreground="{Binding UpperCase, Converter={StaticResource UpperCaseColorConverter}}"/> 



I have similar converter's defined for Lower and Alter case as well.


Thanks,
Harshvir
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Unable to load custom themes
Reply #17 - Sep 21st, 2020 at 12:33pm
Print Post  
Hi,

Try binding to the Key instance instead of its UpperCase specifically, then you should have access to all Key's properties in the value converter.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Harshvir
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 36
Joined: Aug 26th, 2020
Re: Unable to load custom themes
Reply #18 - Sep 21st, 2020 at 4:47pm
Print Post  
Hi,
I think I am not able to explain my problem clearly.
I have attached keyboard image and circled few keys which are showing problem.
Keyboard language used is French.
Key in Red, is highlighting both characters.
Key in Green, is highlighting none characters.
Key in blue is highlighting lower case, but sending upper case key. This happen only when Caps lock is enabled.

I have issues with Random keys on different languages.
I have used combination of shifts and caps.
Checking for char.isLetter and IsEffectedByCapsLock (Code Below).

Code
Select All
        private bool IsEffectedByCapsLock(string data, bool isLetter)
        {
            if (Regex.IsMatch(data, @"\p{IsCyrillic}"))
            {
                return true;
            }
            else if (isLetter && Regex.IsMatch(data, @"\p{IsGreek}"))
            {
                return true;
            }
            else if (isLetter && (Regex.IsMatch(data, @"\p{IsBasicLatin}", RegexOptions.None) || Regex.IsMatch(data, @"\p{IsLatin-1Supplement}", RegexOptions.None)))
            {
                return true;
            }
            return false;
        } 



The issue do not happen for English language, but for non-english languages.
  

KeyboardProblem.png ( 114 KB | 150 Downloads )
KeyboardProblem.png
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Unable to load custom themes
Reply #19 - Sep 22nd, 2020 at 4:18pm
Print Post  
Please attach a test project (here or with PM) containing your converter code and templates.
  
Back to top
 
IP Logged
 
Harshvir
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 36
Joined: Aug 26th, 2020
Re: Unable to load custom themes
Reply #20 - Sep 22nd, 2020 at 10:00pm
Print Post  
I sent that in a PM.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Unable to load custom themes
Reply #21 - Sep 23rd, 2020 at 10:28am
Print Post  
You can get the key instance itself using multi-binding, keeping CurrentCase property binding to trigger updates. E.g. this highlights / unhighlights the French μ in my test:

Code
Select All
<TextBlock Text="{Binding UpperCase}">
    <TextBlock.Foreground>
        <MultiBinding Converter="{StaticResource TestUppercaseConverter}" >
            <Binding Path="." />
            <Binding Path="CurrentCase" />
        </MultiBinding>
    </TextBlock.Foreground>
</TextBlock>

public class TestUppercaseConverter : IMultiValueConverter
{
    public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
    {
        var key = values[0] as RegularKey;
        if (key != null && key.UpperCase == key.CurrentCase)
            return OSKKeyTextColors.Highlighted;
        return OSKKeyTextColors.Dimmed;
    }

    object[] IMultiValueConverter.ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
} 



Other converters should be equivalent, or maybe you could pass which property to compare with CurrentCase as converter parameter instead of using multiple classes.

Regards,
Slavcho
  
Back to top
 
IP Logged
 
Harshvir
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 36
Joined: Aug 26th, 2020
Re: Unable to load custom themes
Reply #22 - Sep 23rd, 2020 at 3:26pm
Print Post  
Thanks Slavcho.
That was what I needed, and it's working as expected for me now but for special keys only.
For Text Keys (when both Caps and Shift are on), its highlighting capital case, and sending lower case.
« Last Edit: Sep 23rd, 2020 at 5:36pm by Harshvir »  
Back to top
 
IP Logged
 
Harshvir
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 36
Joined: Aug 26th, 2020
Re: Unable to load custom themes
Reply #23 - Sep 23rd, 2020 at 7:24pm
Print Post  
Please check with both Caps and Shift on. When we use the method provided, then it messes up some other keys.
Here is an example for French Keyboard.
I added the following log statement to both Upper and Lower case converters.
Code
Select All
Debug.WriteLine("UpperCaseColorConverter -- " + "Uppercase: " + key.UpperCase + ", CurrentCase: " + key.CurrentCase + ", LowerCase: " + key.LowerCase + " -- Value From key: " + values[1]);
 



Here is the output.
Code
Select All
UpperCaseColorConverter -- Uppercase: §, CurrentCase: §, LowerCase: ! -- Value From key: §
LowerCaseColorConverter -- Uppercase: §, CurrentCase: §, LowerCase: ! -- Value From key: § 



You can see that in both Upper and Lower case values. I get same CurrentCase value along with the value[1] which is mapped to CurrentCase.
But what it types in UI, is !.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Unable to load custom themes
Reply #24 - Sep 24th, 2020 at 7:19am
Print Post  
Here CurrentCase should reflect combined Caps + Shift:
https://mindfusion.eu/_temp/vkb_currentcase.zip
  
Back to top
 
IP Logged
 
Harshvir
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 36
Joined: Aug 26th, 2020
Re: Unable to load custom themes
Reply #25 - Sep 24th, 2020 at 4:33pm
Print Post  
Thanks for sharing the DLLs, do you know what is your next release cycle, so we can get the tested Control/DLL, rather than temporary file share?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3147
Joined: Oct 19th, 2005
Re: Unable to load custom themes
Reply #26 - Sep 25th, 2020 at 5:25am
Print Post  
We have released this with a small update here we were just preparing for another client -
https://mindfusion.eu/Forum/YaBB.pl?num=1600942278/0#0

Shift + Caps seems to work nice with CurrentCase-based converters, we've tested English and French so far.
  
Back to top
 
IP Logged
 
Harshvir
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 36
Joined: Aug 26th, 2020
Re: Unable to load custom themes
Reply #27 - Sep 25th, 2020 at 6:24am
Print Post  
Thanks Slavcho. It's good to know that there are no untested changes.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send TopicPrint