public SettingsPage()
        {
            this.InitializeComponent();

            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;

            // set app version
            Windows.ApplicationModel.Package        pkg     = Windows.ApplicationModel.Package.Current;
            Windows.ApplicationModel.PackageVersion version = pkg.Id.Version;
            versionNumber.Text = "version: " +
                                 version.Major.ToString() + "." +
                                 version.Minor.ToString() + "." +
                                 version.Build.ToString() + "." +
                                 version.Revision.ToString();

            SetBackgroundMode();
            SetSecondsMode();
            SetColorMode();
            SetSoundMode();
            SetPlacementMode();
            SetFontMode();

            timer          = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(1);
            timer.Tick    += Timer_Tick;
            timer.Start();
        }
Beispiel #2
0
 public void PageRefresh()
 {
     Windows.ApplicationModel.Package        ThisPackage = Windows.ApplicationModel.Package.Current;
     Windows.ApplicationModel.PackageId      ThisId      = ThisPackage.Id;
     Windows.ApplicationModel.PackageVersion ThisVersion = ThisId.Version;
     NameOfApp.Text    = ThisPackage.DisplayName;
     VersionOfApp.Text = String.Format("版本: {0}.{1}.{2}.{3} [{4}]",
                                       ThisVersion.Major, ThisVersion.Minor, ThisVersion.Build, ThisVersion.Revision,
                                       ThisId.Architecture);
     InstalledDateOfApp.Text = Windows.ApplicationModel.Package.Current.InstalledDate.ToString("安装日期: yyyy-MM-dd");
     Debug.WriteLine("刷新了" + this.GetType().ToString() + "的内容");
 }
Beispiel #3
0
        public About()
        {
            this.InitializeComponent();

            this.navigationHelper = new NavigationHelper(this);
            //this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
            //this.navigationHelper.SaveState += this.NavigationHelper_SaveState;

            var myPackage = Windows.ApplicationModel.Package.Current;
            Windows.ApplicationModel.PackageVersion ver = myPackage.Id.Version;
            txtVersion.Text = "Version: " + ver.Major.ToString() + "." + ver.Minor.ToString() + "." + ver.Build.ToString() + "." + ver.Revision.ToString();
 

        }
Beispiel #4
0
        public Adapter()
        {
            byte[] ConfigurationDataPtr;
            if (GetConfiguration(out ConfigurationDataPtr) == ERROR_SUCCESS)
            {
                var temp = System.Text.Encoding.UTF8.GetString(ConfigurationDataPtr);
                m_gateway = new ModbusGateway(System.Text.Encoding.UTF8.GetString(ConfigurationDataPtr));  // The Designated IP address of the Modbus Gateway
            }

            Windows.ApplicationModel.Package        package        = Windows.ApplicationModel.Package.Current;
            Windows.ApplicationModel.PackageId      packageId      = package.Id;
            Windows.ApplicationModel.PackageVersion versionFromPkg = packageId.Version;

            this.Vendor      = "Microsoft";
            this.AdapterName = "Modbus Device System Bridge";

            // the adapter prefix must be something like "com.mycompany" (only alpha num and dots)
            // it is used by the Device System Bridge as root string for all services and interfaces it exposes
            this.ExposedAdapterPrefix   = "com." + this.Vendor.ToLower();
            this.ExposedApplicationGuid = Guid.Parse("{0xd3982475,0x38eb,0x4e53,{0xb8,0xd8,0x54,0x04,0xd8,0x78,0x88,0x1a}}");

            if (null != package && null != packageId)
            {
                this.ExposedApplicationName = packageId.Name;
                this.Version = versionFromPkg.Major.ToString() + "." +
                               versionFromPkg.Minor.ToString() + "." +
                               versionFromPkg.Revision.ToString() + "." +
                               versionFromPkg.Build.ToString();
            }
            else
            {
                this.ExposedApplicationName = "ModbusDeviceSystemBridge";
                this.Version = "0.0.0.0";
            }

            try
            {
                this.Signals         = new List <IAdapterSignal>();
                this.devices         = new List <IAdapterDevice>();
                this.signalListeners = new Dictionary <int, IList <SIGNAL_LISTENER_ENTRY> >();

                //Create Adapter Signals
                this.createSignals();
            }
            catch (OutOfMemoryException ex)
            {
                throw;
            }
        }
        public Adapter()
        {
            Windows.ApplicationModel.Package        package        = Windows.ApplicationModel.Package.Current;
            Windows.ApplicationModel.PackageId      packageId      = package.Id;
            Windows.ApplicationModel.PackageVersion versionFromPkg = packageId.Version;

            this.Vendor      = "Morten Nielsen";
            this.AdapterName = "Philips Hue DSB";

            // the adapter prefix must be something like "com.mycompany" (only alpha num and dots)
            // it is used by the Device System Bridge as root string for all services and interfaces it exposes
            this.ExposedAdapterPrefix   = "com.dotMorten";
            this.ExposedApplicationGuid = Guid.Parse("{0x07c19f14,0x76c6,0x4d2f,{0xb4,0xd1,0x7d,0x4f,0x89,0x24,0x17,0x36}}");

            if (null != package && null != packageId)
            {
                this.ExposedApplicationName = packageId.Name;
                this.Version = versionFromPkg.Major.ToString() + "." +
                               versionFromPkg.Minor.ToString() + "." +
                               versionFromPkg.Revision.ToString() + "." +
                               versionFromPkg.Build.ToString();
            }
            else
            {
                this.ExposedApplicationName = "PhilipsHueDeviceSystemBridge";
                this.Version = "0.0.0.0";
            }

            try
            {
                this.Signals         = new List <IAdapterSignal>();
                this.devices         = new List <IAdapterDevice>();
                this.signalListeners = new Dictionary <int, IList <SIGNAL_LISTENER_ENTRY> >();

                //var EnableJoinMethod = new AdapterMethod("Find Hue Bridges", "Searches for new hue bridges", 0);
                //EnableJoinMethod.InvokeAction = LoadBridges;

                //Create Adapter Signals
                this.createSignals();

                checkForBridgesTimer = new System.Threading.Timer((s) => { LoadBridges(); }, null,
                                                                  0, (int)TimeSpan.FromMinutes(5).TotalMilliseconds);
            }
            catch (OutOfMemoryException)
            {
                throw;
            }
        }
Beispiel #6
0
        public BridgeAdapter(string adapterName)
        {
            Windows.ApplicationModel.Package        package        = Windows.ApplicationModel.Package.Current;
            Windows.ApplicationModel.PackageId      packageId      = package.Id;
            Windows.ApplicationModel.PackageVersion versionFromPkg = packageId.Version;

            this.Vendor      = "win10";
            this.AdapterName = adapterName;

            // the adapter prefix must be something like "com.mycompany" (only alpha num and dots)
            // it is used by the Device System Bridge as root string for all services and interfaces it exposes
            this.ExposedAdapterPrefix   = "com." + this.Vendor.ToLower();
            this.ExposedApplicationGuid = Guid.Parse("{0x6516a3e3,0xcc3e,0x4c67,{0xb7,0x5f,0x73,0x75,0x8b,0x09,0x23,0xae}}");

            if (null != package && null != packageId)
            {
                this.ExposedApplicationName = packageId.Name;
                this.Version = versionFromPkg.Major.ToString() + "." +
                               versionFromPkg.Minor.ToString() + "." +
                               versionFromPkg.Revision.ToString() + "." +
                               versionFromPkg.Build.ToString();
            }
            else
            {
                this.ExposedApplicationName = "DeviceSystemBridge";
                this.Version = "0.0.0.0";
            }

            this.Signals         = new List <IAdapterSignal>();
            this.devices         = new List <IAdapterDevice>();
            this.signalListeners = new Dictionary <int, IList <SIGNAL_LISTENER_ENTRY> >();

            // Device Arrival Signal
            var deviceArrivalSignal  = new BridgeAdapterSignal(Constants.DEVICE_ARRIVAL_SIGNAL);
            var deviceHandle_arrival = new BridgeAdapterValue(Constants.DEVICE_ARRIVAL__DEVICE_HANDLE, null);

            deviceArrivalSignal.Params.Add(deviceHandle_arrival);
            this.Signals.Add(deviceArrivalSignal);

            // Device Removal Signal
            var deviceRemovalSignal  = new BridgeAdapterSignal(Constants.DEVICE_REMOVAL_SIGNAL);
            var deviceHandle_removal = new BridgeAdapterValue(Constants.DEVICE_REMOVAL__DEVICE_HANDLE, null);

            deviceRemovalSignal.Params.Add(deviceHandle_removal);
            this.Signals.Add(deviceRemovalSignal);
        }
Beispiel #7
0
        public Adapter()
        {
            Windows.ApplicationModel.Package        package        = Windows.ApplicationModel.Package.Current;
            Windows.ApplicationModel.PackageId      packageId      = package.Id;
            Windows.ApplicationModel.PackageVersion versionFromPkg = packageId.Version;

            this.DeviceName  = GetDeviceName();
            this.Vendor      = "glovebox";
            this.AdapterName = "rover";

            // the adapter prefix must be something like "com.mycompany" (only alpha num and dots)
            // it is used by the Device System Bridge as root string for all services and interfaces it exposes
            this.ExposedAdapterPrefix   = "com." + this.Vendor.ToLower();
            this.ExposedApplicationGuid = Guid.Parse("{0xc1e7ce4a,0x66fb,0x40e6,{0xb4,0xb7,0x74,0x2b,0x88,0x71,0x83,0x27}}");

            if (null != package && null != packageId)
            {
                this.ExposedApplicationName = packageId.Name;
                this.Version = versionFromPkg.Major.ToString() + "." +
                               versionFromPkg.Minor.ToString() + "." +
                               versionFromPkg.Revision.ToString() + "." +
                               versionFromPkg.Build.ToString();
            }
            else
            {
                this.ExposedApplicationName = "DeviceSystemBridge";
                this.Version = "0.0.0.0";
            }

            try
            {
                this.Signals         = new List <IAdapterSignal>();
                this.devices         = new List <IAdapterDevice>();
                this.signalListeners = new Dictionary <int, IList <SIGNAL_LISTENER_ENTRY> >();

                //Create Adapter Signals
                this.createSignals();
            }
            catch (OutOfMemoryException ex)
            {
                throw;
            }
        }
Beispiel #8
0
        public Adapter()
        {
            Windows.ApplicationModel.Package        package        = Windows.ApplicationModel.Package.Current;
            Windows.ApplicationModel.PackageId      packageId      = package.Id;
            Windows.ApplicationModel.PackageVersion versionFromPkg = packageId.Version;

            this.Vendor      = VENDOR_NAME;
            this.AdapterName = ADAPTER_NAME;

            this.ExposedAdapterPrefix   = ADAPTER_PREFIX + this.Vendor.ToLower();
            this.ExposedApplicationGuid = Guid.Parse(APLICATION_GUID);

            if (null != package && null != packageId)
            {
                this.ExposedApplicationName = packageId.Name;
                this.Version = versionFromPkg.Major.ToString() + "." +
                               versionFromPkg.Minor.ToString() + "." +
                               versionFromPkg.Revision.ToString() + "." +
                               versionFromPkg.Build.ToString();
            }
            else
            {
                this.ExposedApplicationName = EXPOSED_APPLICATION_NAME;
                this.Version = VERSION_NUMBER;
            }

            try
            {
                this.Signals         = new List <IAdapterSignal>();
                this.devices         = new List <IAdapterDevice>();
                this.signalListeners = new Dictionary <int, IList <SIGNAL_LISTENER_ENTRY> >();

                //Create Adapter Signals
                this.createSignals();
            }
            catch (OutOfMemoryException ex)
            {
                Debug.WriteLine("Out of memory while trying to allocate adapter value parameter containers." + ex.Message);
                throw;
            }
        }
Beispiel #9
0
        public Adapter()
        {
            Windows.ApplicationModel.Package        package        = Windows.ApplicationModel.Package.Current;
            Windows.ApplicationModel.PackageId      packageId      = package.Id;
            Windows.ApplicationModel.PackageVersion versionFromPkg = packageId.Version;

            this.Vendor      = AdapterHelper.ADAPTER_VENDOR;
            this.AdapterName = AdapterHelper.ADAPTER_NAME;

            // the adapter prefix must be something like "com.mycompany" (only alpha num and dots)
            // it is used by the Device System Bridge as root string for all services and interfaces it exposes
            this.ExposedAdapterPrefix   = AdapterHelper.ADAPTER_DOMAIN + "." + this.Vendor.ToLower();
            this.ExposedApplicationGuid = Guid.Parse(AdapterHelper.ADAPTER_APPLICATION_GUID);

            if (null != package && null != packageId)
            {
                this.ExposedApplicationName = packageId.Name;
                this.Version = versionFromPkg.Major.ToString() + "." +
                               versionFromPkg.Minor.ToString() + "." +
                               versionFromPkg.Revision.ToString() + "." +
                               versionFromPkg.Build.ToString();
            }
            else
            {
                this.ExposedApplicationName = AdapterHelper.ADAPTER_DEFAULT_APPLICATION_NAME;
                this.Version = AdapterHelper.ADAPTER_DEFAULT_VERSION;
            }

            try
            {
                this.Signals           = new List <IAdapterSignal>();
                this.m_signalListeners = new Dictionary <int, IList <SIGNAL_LISTENER_ENTRY> >();
            }
            catch (OutOfMemoryException ex)
            {
                Debug.WriteLine(ex);
                throw;
            }
        }
 public static string GetVersionApp()
 {
     Windows.ApplicationModel.Package        thisPackage = Windows.ApplicationModel.Package.Current;
     Windows.ApplicationModel.PackageVersion version     = thisPackage.Id.Version;
     return($"{version.Major}.{version.Minor}.{version.Build}.{version.Revision}");
 }
Beispiel #11
0
 public KnxAdapter() : base("KnxNetIP")
 {
     Windows.ApplicationModel.Package        package        = Windows.ApplicationModel.Package.Current;
     Windows.ApplicationModel.PackageId      packageId      = package.Id;
     Windows.ApplicationModel.PackageVersion versionFromPkg = packageId.Version;
 }
Beispiel #12
0
 public static Version ToVersion(this Windows.ApplicationModel.PackageVersion packageVersion)
 {
     return(new(packageVersion.Major, packageVersion.Minor, packageVersion.Build, packageVersion.Revision));
 }
 /// <summary>
 /// Format the application version number to be sent to analytics.
 /// </summary>
 /// <param name="version">Version of the application.</param>
 /// <returns>Formatted string containing the version number.</returns>
 internal static string FormatVersion(Windows.ApplicationModel.PackageVersion version)
 {
     return(String.Join(".", version.Major, version.Minor, version.Build, version.Revision));
 }