aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Touch/Keyboard/KeyboardDefinition.cs
blob: 1486b6717b67aca592395b702e9942717e38a1a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <connectionStrings>
    <add name="LocalDB" connectionString="metadata=res://*/DB.LocalADO.csdl|res://*/DB.LocalADO.ssdl|res://*/DB.LocalADO.msl;provider=System.Data.SQLite.EF6;provider connection string=&quot;data source=D:\Development\Tango\Software\DB\Tango.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.EF6" />
      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
      <remove invariant="System.Data.SQLite" />
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
    </DbProviderFactories>
  </system.data>
</configuration>
d='n257' href='#n257'>257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;

namespace Tango.Touch.Keyboard
{
    public class KeyboardDefinition
    {
        public String Name { get; set; }

        public String LanguageCode { get; set; }

        public String EnterText { get; set; }

        public String TabText { get; set; }

        public List<KeysLineDefinition> KeysLinesDefinitions { get; set; }

        public KeyboardDefinition()
        {
            KeysLinesDefinitions = new List<KeysLineDefinition>();
        }

        private static KeyboardDefinition _default;

        public static KeyboardDefinition Default
        {
            get
            {
                if (_default == null)
                {
                    _default = CreateDefaultAlphaNumeric();
                }

                return _default;
            }
            set { _default = value; }
        }

        internal static KeyboardDefinition CreateDefaultHebrewAlphaNumeric()
        {
            KeyboardDefinition definition = new KeyboardDefinition();

            definition.Name = "Hebrew";
            definition.LanguageCode = "HE";
            definition.EnterText = "בצע";
            definition.TabText = "הבא";

            KeysLineDefinition line1 = new KeysLineDefinition();

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = ",",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = ".",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ק",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ר",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "א",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ט",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ו",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ן",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ם",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "פ",
            });

            KeysLineDefinition line2 = new KeysLineDefinition();

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ש",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ד",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ג",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "כ",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ע",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "י",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ח",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ל",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ך",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ף",
            });

            KeysLineDefinition line3 = new KeysLineDefinition();

            line3.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ז",
            });

            line3.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ס",
            });

            line3.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ב",
            });

            line3.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ה",
            });

            line3.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "נ",
            });

            line3.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "מ",
            });

            line3.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "צ",
            });

            line3.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ת",
            });

            line3.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "ץ",
            });

            line3.SpecialRightKeyDefinitions.Add(new SpecialKeyDefinition()
            {
                Type = SpecialKeyType.StandardText,
                VectorMarkup = "M561 76.5H178.5c-17.85 0-30.6 7.65-40.8 22.95L0 306l137.7 206.55c10.2 12.75 22.95 22.95 40.8 22.95H561    c28.05 0 51-22.95 51-51v-357C612 99.45 589.05 76.5 561 76.5z M484.5 397.8l-35.7 35.7L357 341.7l-91.8 91.8l-35.7-35.7    l91.8-91.8l-91.8-91.8l35.7-35.7l91.8 91.8l91.8-91.8l35.7 35.7L392.7 306L484.5 397.8z",
                Output = "{BACKSPACE}",
            });

            definition.KeysLinesDefinitions.Add(line1);
            definition.KeysLinesDefinitions.Add(line2);
            definition.KeysLinesDefinitions.Add(line3);

            return definition;
        }

        private static KeyboardDefinition CreateDefaultAlphaNumeric()
        {
            KeyboardDefinition definition = new KeyboardDefinition();

            definition.Name = "English";
            definition.LanguageCode = "EN";
            definition.EnterText = "GO";
            definition.TabText = "NEXT";

            KeysLineDefinition line1 = new KeysLineDefinition();

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "q",
                CapsText = "Q",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "w",
                CapsText = "W",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "e",
                CapsText = "E",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "r",
                CapsText = "R",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "t",
                CapsText = "T",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "y",
                CapsText = "Y",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "u",
                CapsText = "U",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "i",
                CapsText = "I",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "o",
                CapsText = "O",
            });

            line1.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "p",
                CapsText = "P",
            });

            KeysLineDefinition line2 = new KeysLineDefinition();

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "a",
                CapsText = "A",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "s",
                CapsText = "S",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "d",
                CapsText = "D",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "f",
                CapsText = "F",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "g",
                CapsText = "G",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "h",
                CapsText = "H",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "j",
                CapsText = "J",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "k",
                CapsText = "K",
            });

            line2.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "l",
                CapsText = "L",
            });

            KeysLineDefinition line3 = new KeysLineDefinition();

            line3.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "z",
                CapsText = "Z",
            });

            line3.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "x",
                CapsText = "X",
            });

            line3.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "c",
                CapsText = "C",
            });

            line3.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "v",
                CapsText = "V",
            });

            line3.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "b",
                CapsText = "B",
            });

            line3.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "n",
                CapsText = "N",
            });

            line3.KeyDefinitions.Add(new KeyDefinition()
            {
                StandardText = "m",
                CapsText = "M",
            });

            line3.SpecialLeftKeyDefinitions.Add(new SpecialKeyDefinition()
            {
                VectorMarkup = "M235.252 13.406l-0.447-0.998c-3.417-7.622-11.603-12.854-19.677-12.375l-0.3 0.016l-0.302-0.016    C214.194 0.011 213.856 0 213.524 0c-7.706 0-15.386 5.104-18.674 12.413l-0.452 0.998L13.662 176.079    c-6.871 6.183-6.495 12.657-4.971 16.999c2.661 7.559 10.361 13.373 18.313 13.82l1.592 0.297c0.68 0.168 1.356 0.348 2.095 0.427    c23.036 2.381 45.519 2.876 64.472 3.042l5.154 0.048V407.93c0 11.023 7.221 15.152 11.522 16.635l0.967 0.33l0.77 0.671    c3.105 2.717 7.02 4.093 11.644 4.093h179.215c4.626 0 8.541-1.376 11.639-4.093l0.771-0.671l0.965-0.33    c4.307-1.482 11.532-5.611 11.532-16.635V210.706l5.149-0.048c18.961-0.17 41.446-0.666 64.475-3.042    c0.731-0.079 1.407-0.254 2.082-0.422l1.604-0.302c7.952-0.447 15.65-6.262 18.312-13.82c1.528-4.336 1.899-10.811-4.972-16.998    L235.252 13.406z M344.114 173.365c-11.105 0.18-22.216 0.254-33.337 0.254c-5.153 0-9.363 1.607-12.507 4.768    c-3.372 3.4-5.296 8.48-5.266 13.932l0.005 0.65l-0.157 0.629c-0.437 1.767-0.64 3.336-0.64 4.928v194.001H137.458V198.526    c0-1.597-0.201-3.161-0.638-4.928l-0.157-0.629l0.005-0.65c0.031-5.456-1.892-10.537-5.271-13.937    c-3.141-3.161-7.353-4.763-12.507-4.768c-11.124 0-22.224-0.074-33.337-0.254l-13.223-0.218L214.834 44.897l142.503 128.249    L344.114 173.365z",
                Output = "{CAPSLOCK}",
                Type = SpecialKeyType.CapsLock,
            });

            line3.SpecialRightKeyDefinitions.Add(new SpecialKeyDefinition()
            {
                Type = SpecialKeyType.StandardText,
                VectorMarkup = "M561 76.5H178.5c-17.85 0-30.6 7.65-40.8 22.95L0 306l137.7 206.55c10.2 12.75 22.95 22.95 40.8 22.95H561    c28.05 0 51-22.95 51-51v-357C612 99.45 589.05 76.5 561 76.5z M484.5 397.8l-35.7 35.7L357 341.7l-91.8 91.8l-35.7-35.7    l91.8-91.8l-91.8-91.8l35.7-35.7l91.8 91.8l91.8-91.8l35.7 35.7L392.7 306L484.5 397.8z",
                Output = "{BACKSPACE}",
                ColumnSpan = 2,
            });

            definition.KeysLinesDefinitions.Add(line1);
            definition.KeysLinesDefinitions.Add(line2);
            definition.KeysLinesDefinitions.Add(line3);

            return definition;
        }

        internal static List<KeysLineDefinition> CreateDefaultSpecialCharacters()
        {
            KeysLineDefinition line1 = CreateLine("+", "x", "÷", "=", "%", "/", "\\", "$", "€", "£");
            KeysLineDefinition line2 = CreateLine("@", "*", "!", "#", ":", ";", "&", "_", "(", ")");
            KeysLineDefinition line3 = CreateLine("-", "'", "\"", ",", ".", "?");

            line3.SpecialRightKeyDefinitions.Add(new SpecialKeyDefinition()
            {
                Type = SpecialKeyType.StandardText,
                VectorMarkup = "M561 76.5H178.5c-17.85 0-30.6 7.65-40.8 22.95L0 306l137.7 206.55c10.2 12.75 22.95 22.95 40.8 22.95H561    c28.05 0 51-22.95 51-51v-357C612 99.45 589.05 76.5 561 76.5z M484.5 397.8l-35.7 35.7L357 341.7l-91.8 91.8l-35.7-35.7    l91.8-91.8l-91.8-91.8l35.7-35.7l91.8 91.8l91.8-91.8l35.7 35.7L392.7 306L484.5 397.8z",
                Output = "{BACKSPACE}",
                ColumnSpan = 2,
            });

            return new List<KeysLineDefinition>()
            {
                line1,
                line2,
                line3
            };
        }

        private static KeysLineDefinition CreateLine(params String[] chars)
        {
            KeysLineDefinition line = new KeysLineDefinition();

            foreach (var c in chars)
            {
                line.KeyDefinitions.Add(new KeyDefinition()
                {
                    StandardText = c,
                });
            }

            return line;
        }
    }
}