Exemplo n.º 1
0
        internal override void Reload(Rainmeter.API api, ref double maxValue)
        {
            base.Reload(api, ref maxValue);

            string parentName = api.ReadString("ParentName", "");
            IntPtr skin       = api.GetSkin();

            // Find parent using name AND the skin handle to be sure that it's the right one
            RuntimeTypeHandle parentType = typeof(ParentMeasure).TypeHandle;

            foreach (KeyValuePair <uint, Measure> pair in Plugin.Measures)
            {
                if (System.Type.GetTypeHandle(pair.Value).Equals(parentType))
                {
                    ParentMeasure parentMeasure = (ParentMeasure)pair.Value;
                    if (parentMeasure.Name.Equals(parentName) &&
                        parentMeasure.Skin.Equals(skin))
                    {
                        HasParent = true;
                        ParentID  = pair.Key;
                        return;
                    }
                }
            }

            HasParent = false;
            API.Log(API.LogType.Error, "ParentChild.dll: ParentName=" + parentName + " not valid");
        }
Exemplo n.º 2
0
        public override void Reload(RainmeterAPI api, ref double maxValue)
        {
            base.Reload(api, ref maxValue);

            string parentName = api.ReadString("ParentName", "");
            IntPtr skinPtr    = api.GetSkin();


            ParentMeasure = null;
            foreach (PluginSkin skin in Skin.SkinHandler.PluginSkins)
            {
                if (skin.Ptr == Skin.Ptr)
                {
                    foreach (PluginMeasure measure in skin.PluginMeasures)
                    {
                        ParentMeasure pMeasure = measure as ParentMeasure;
                        if (pMeasure != null && pMeasure.Name == parentName)
                        {
                            ParentMeasure = pMeasure;
                        }
                    }
                }
            }

            if (ParentMeasure == null)
            {
                RainmeterAPI.Log(RainmeterAPI.LogType.Error, "ParentChild.dll: ParentName=" + parentName + " not valid");
            }
        }
Exemplo n.º 3
0
        internal override double Update()
        {
            if (HasParent)
            {
                ParentMeasure parent = (ParentMeasure)Plugin.Measures[ParentID];
                return(parent.GetValue(Type));
            }

            return(0.0);
        }
        public static void Initialize(ref IntPtr data, IntPtr rm)
        {
            Rainmeter.API api = new Rainmeter.API(rm);

            string  parent = api.ReadString("ParentName", "");
            Measure measure;

            if (String.IsNullOrEmpty(parent))
            {
                measure = new ParentMeasure();
            }
            else
            {
                measure = new ChildMeasure();
            }

            data = GCHandle.ToIntPtr(GCHandle.Alloc(measure));
        }
        internal override void Reload(Rainmeter.API api, ref double maxValue)
        {
            base.Reload(api, ref maxValue);

            string parentName = api.ReadString("ParentName", "");
            IntPtr skin       = api.GetSkin();

            // Find parent using name AND the skin handle to be sure that it's the right one.
            ParentMeasure = null;
            foreach (ParentMeasure parentMeasure in ParentMeasure.ParentMeasures)
            {
                if (parentMeasure.Skin.Equals(skin) && parentMeasure.Name.Equals(parentName))
                {
                    ParentMeasure = parentMeasure;
                }
            }

            if (ParentMeasure == null)
            {
                api.Log(API.LogType.Error, "ParentChild.dll: ParentName=" + parentName + " not valid");
            }
        }
        public static void Initialize(ref IntPtr data, IntPtr rm)
        {
            Rainmeter.API api = new Rainmeter.API(rm);

            string parent = api.ReadString("ParentName", "");
            Measure measure;
            if (String.IsNullOrEmpty(parent))
            {
                measure = new ParentMeasure();
            }
            else
            {
                measure = new ChildMeasure();
            }

            data = GCHandle.ToIntPtr(GCHandle.Alloc(measure));
        }
        internal override void Reload(Rainmeter.API api, ref double maxValue)
        {
            base.Reload(api, ref maxValue);

            string parentName = api.ReadString("ParentName", "");
            IntPtr skin = api.GetSkin();

            // Find parent using name AND the skin handle to be sure that it's the right one.
            ParentMeasure = null;
            foreach (ParentMeasure parentMeasure in ParentMeasure.ParentMeasures)
            {
                if (parentMeasure.Skin.Equals(skin) && parentMeasure.Name.Equals(parentName))
                {
                    ParentMeasure = parentMeasure;
                }
            }

            if (ParentMeasure == null)
            {
                API.Log(API.LogType.Error, "ParentChild.dll: ParentName=" + parentName + " not valid");
            }
        }