Example #1
0
        public void Instantiate(SymbolTable symbolTable, UnboundReferences unboundReferences)
        {
            var parentContainer = ParentItem as AstContainerTaskBaseNode;
            var taskTemplate    = Template as AstTaskTemplateNode;
            var clonedMapping   = new Dictionary <IFrameworkItem, IFrameworkItem>();

            if (taskTemplate != null && parentContainer != null)
            {
                var clonedTasks = new List <AstTaskNode>();
                foreach (var task in taskTemplate.Tasks)
                {
                    clonedTasks.Add((AstTaskNode)task.Clone(parentContainer, clonedMapping));
                }

                parentContainer.Tasks.Replace(this, clonedTasks);
            }

            foreach (var bindingItem in taskTemplate.UnboundReferences)
            {
                var clonedBindingItem = new BindingItem(
                    bindingItem.BoundProperty,
                    bindingItem.XObject,
                    bindingItem.XValue,
                    clonedMapping[bindingItem.ParentItem],
                    bindingItem.BimlFile,
                    this);
                unboundReferences.Add(clonedBindingItem);
            }
        }
Example #2
0
        /// <summary>
        /// Creates a BindingPath for the specified path using a specified DependencyProperty precedence.
        /// </summary>
        /// <param name="path">The path to the property</param>
        /// <param name="fallbackValue">Provides the fallback value to apply when the source is invalid.</param>
        /// <param name="precedence">The precedence value to manipulate if the path matches to a DependencyProperty.</param>
        /// <param name="allowPrivateMembers">Allows for the binding engine to include private properties in the lookup</param>
        internal BindingPath(string path, object fallbackValue, DependencyPropertyValuePrecedences?precedence, bool allowPrivateMembers)
        {
            _path = (path ?? "").Trim();

            var items = _path.Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);

            var parsedItems = ParseDependencyPropertyAccess(items);

            BindingItem bindingItem = null;

            foreach (var item in parsedItems.Reverse())
            {
                bindingItem = new BindingItem(bindingItem, item, fallbackValue, precedence, allowPrivateMembers);
                _chain      = bindingItem;

                if (_value == null)
                {
                    _value = bindingItem;
                }
            }

            if (_value != null)
            {
                _value.ValueChangedListener = this;
            }
        }
        public void Instantiate(SymbolTable symbolTable, UnboundReferences unboundReferences)
        {
            var parentEtl = ParentItem as AstEtlRootNode;
            var transformationTemplate = Template as AstTransformationTemplateNode;
            var clonedMapping          = new Dictionary <IFrameworkItem, IFrameworkItem>();

            if (transformationTemplate != null && parentEtl != null)
            {
                var clonedTransformations = new List <AstTransformationNode>();
                foreach (var transformation in transformationTemplate.Transformations)
                {
                    clonedTransformations.Add((AstTransformationNode)transformation.Clone(parentEtl, clonedMapping));
                }

                parentEtl.Transformations.Replace(this, clonedTransformations);
            }

            foreach (var bindingItem in transformationTemplate.UnboundReferences)
            {
                var clonedBindingItem = new BindingItem(
                    bindingItem.BoundProperty,
                    bindingItem.XObject,
                    bindingItem.XValue,
                    clonedMapping[bindingItem.ParentItem],
                    bindingItem.BimlFile,
                    this);
                unboundReferences.Add(clonedBindingItem);
            }
        }
Example #4
0
 internal BindingItem(BindingItem next, string property, object fallbackValue, DependencyPropertyValuePrecedences?precedence)
 {
     Next           = next;
     PropertyName   = property;
     _precedence    = precedence;
     _fallbackValue = fallbackValue;
 }
Example #5
0
            //NOTE : Requires  [{daycolor|always}] variable in xml element 'windowCompass' in file windows.xml

            static void Postfix(XUiC_CompassWindow __instance, ref string value, ref BindingItem binding)
            {
                string fieldName = binding.FieldName;

                if (fieldName != null && fieldName == "daycolor")
                {
                    value = "FFFFFF";
                    if (XUi.IsGameRunning())
                    {
                        int v4      = GameUtils.WorldTimeToDays(GameManager.Instance.World.worldTime);
                        int warning = GameStats.GetInt(EnumGameStats.BloodMoonWarning);
                        if (warning != -1)
                        {
                            int bloodMoon = GameStats.GetInt(EnumGameStats.BloodMoonDay);
                            if (v4 == bloodMoon)
                            {
                                value = "FF0000";
                            }

                            // Only highlight previous 2 days if the BM is on a fixed cycle, i.e. every 3 days otherwise the warning willm spoil the suprise!
                            if (GamePrefs.GetInt(EnumGamePrefs.BloodMoonRange) == 0)
                            {
                                if (v4 == bloodMoon - 1)
                                {
                                    value = "FFA500";
                                }
                                else if (v4 == bloodMoon - 2)
                                {
                                    value = "FFFF00";
                                }
                            }
                        }
                    }
                }
            }
Example #6
0
        public void Instantiate(SymbolTable symbolTable, UnboundReferences unboundReferences)
        {
            var rootNode        = ParentItem as AstRootNode;
            var packageTemplate = Template as AstPackageTemplateNode;
            var clonedMapping   = new Dictionary <IFrameworkItem, IFrameworkItem>();

            if (packageTemplate != null && rootNode != null)
            {
                var clonedPackage = (AstPackageNode)packageTemplate.Package.Clone(rootNode, clonedMapping);
                clonedPackage.Emit = this.Emit;

                // TODO: Some of the ViewModel stuff might not fully support Replace - so simulating with Remove and Insert
                int index = rootNode.Packages.IndexOf(this);
                rootNode.Packages.Remove(this);
                rootNode.Packages.Insert(index, clonedPackage);
            }

            foreach (var bindingItem in packageTemplate.UnboundReferences)
            {
                var clonedBindingItem = new BindingItem(
                    bindingItem.BoundProperty,
                    bindingItem.XObject,
                    bindingItem.XValue,
                    clonedMapping[bindingItem.ParentItem],
                    bindingItem.BimlFile,
                    this);
                unboundReferences.Add(clonedBindingItem);
            }
        }
Example #7
0
    public override bool GetBindingValue(ref string value, BindingItem binding)
    {
        string fieldName = binding.FieldName;

        if (fieldName != null)
        {
            if (fieldName == "respondentname")
            {
                if (base.xui.Dialog.otherEntitySDX != null)
                {
                    EntityAliveSDX myEntity = base.xui.Dialog.otherEntitySDX as EntityAliveSDX;
                    if (myEntity)
                    {
                        if (myEntity.GetHireCost() <= 0)
                        {
                            value = myEntity.EntityName;
                        }
                        else
                        {
                            value = myEntity.EntityName;// + " ( Hire for " + myEntity.GetHireCost() + " " + myEntity.GetHireCurrency().ItemClass.Name + " )";
                        }
                        return(true);
                    }
                }
                value = ((!(base.xui.Dialog.Respondent != null)) ? string.Empty : Localization.Get(base.xui.Dialog.Respondent.EntityName, string.Empty));
                return(true);
            }
        }
        return(false);
    }
        public static bool Prefix(ref string value, BindingItem binding, ItemClass ___itemClass)
        {
            // Check if this feature is enabled.
            if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
            {
                return(true);
            }

            if (___itemClass == null)
            {
                return(true);
            }

            string text = binding.FieldName;

            if (text == "itemRepairDescription")
            {
                AdvLogging.DisplayLog(AdvFeatureClass, "Reading Custom Repair description");

                string descriptionKey2 = ___itemClass.DescriptionKey;
                if (Localization.Exists(descriptionKey2, ""))
                {
                    value = Localization.Get(descriptionKey2, "");
                }

                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append(Localization.Get("lblRepairItems", ""));

                List <ItemStack> stack = new List <ItemStack>();
                // Check if ScrapItems is specified
                if (___itemClass.Properties.Classes.ContainsKey("RepairItems"))
                {
                    DynamicProperties dynamicProperties3 = ___itemClass.Properties.Classes["RepairItems"];
                    stack = ItemsUtilities.ParseProperties(dynamicProperties3);
                }
                else if (___itemClass.Properties.Contains("RepairItems")) // to support <property name="RepairItems" value="resourceWood,10,resourceForgedIron,10" />
                {
                    string strData = ___itemClass.Properties.Values["RepairItems"].ToString();
                    stack = ItemsUtilities.ParseProperties(strData);
                }
                else if (___itemClass.RepairTools == null || ___itemClass.RepairTools.Length <= 0)
                {
                    Recipe recipe = ItemsUtilities.GetReducedRecipes(___itemClass.GetItemName(), 2);
                    stack = recipe.ingredients;
                }
                if (stack.Count > 0)
                {
                    stringBuilder.Append(ItemsUtilities.GetStackSummary(stack));
                    value = stringBuilder.ToString();
                }
                else
                {
                    stringBuilder.Append(" You cannot repair this.");
                    value = stringBuilder.ToString();
                }
                return(false);
            }
            return(true);
        }
Example #9
0
 internal BindingItem(BindingItem next, string property, object fallbackValue, DependencyPropertyValuePrecedences?precedence, bool allowPrivateMembers)
 {
     Next                 = next;
     PropertyName         = property;
     _precedence          = precedence;
     _fallbackValue       = fallbackValue;
     _allowPrivateMembers = allowPrivateMembers;
 }
Example #10
0
            public void Add(BindingItem pItm)
            {
                if (list == null)
                {
                    return;
                }

                pItm.context = this;
                list.Add(pItm);
            }
Example #11
0
            public DataRow getBindingItemRecord(View pView)
            {
                BindingItem b = getBindingItem(pView);

                if (b != null)
                {
                    return(b.DataRecord);
                }

                return(null);
            }
Example #12
0
 public void CreateDialog(BindingItem item)
 {
     _bindingKeys.Clear();
     _bindingKeys.AddRange(item.KeyList);
     txtModuleId.Text = item.ModuleId.ToString();
     txtParam.Text    = item.Param.ToString();
     UpdateKeyString();
     cmbBindingType.SelectedValue = item.KeyType & BindingType.Mask;
     cbExclusive.Checked          = item.KeyType.HasFlag(BindingType.IsOtherNotPress);
     cbEnableHandled.Checked      = item.KeyType.HasFlag(BindingType.IsEnableHandled);
 }
Example #13
0
            public int getBindingItemPosition(View pView)
            {
                BindingItem b = getBindingItem(pView);

                if (b != null)
                {
                    return(b.Position);
                }

                return(-1);
            }
Example #14
0
        private void button9_Click(object sender, EventArgs e)
        {
            KeyBindingForm form = new KeyBindingForm(man);

            form.CreateDialog(bi);
            if (form.ShowDialog() == DialogResult.OK)
            {
                bi = form.ResultItem;
            }
            form.Close();
        }
Example #15
0
        private void GenerateItem()
        {
            BindingType type = (BindingType)cmbBindingType.SelectedValue;

            if (cbExclusive.Checked)
            {
                type |= BindingType.IsOtherNotPress;
            }
            if (cbEnableHandled.Checked)
            {
                type |= BindingType.IsEnableHandled;
            }
            int moduleId = int.Parse(txtModuleId.Text);
            int param    = int.Parse(txtParam.Text);

            ResultItem = new BindingItem(_bindingKeys, type, moduleId, param);
        }
    public override bool GetBindingValue(ref string value, BindingItem binding)
    {
        EntityPlayer player = base.xui.playerUI.entityPlayer;

        if (player == null)
        {
            return(false);
        }

        int entityID = 0;

        if (player.Buffs.HasCustomVar("CurrentNPC"))
        {
            entityID = (int)player.Buffs.GetCustomVar("CurrentNPC");
        }

        if (entityID == 0)
        {
            return(false);
        }

        string fieldName = binding.FieldName;

        if (fieldName != null)
        {
            if (fieldName == "respondentname")
            {
                EntityAliveSDX myEntity = player.world.GetEntity(entityID) as EntityAliveSDX;
                if (myEntity)
                {
                    if (EntityUtilities.GetHireCost(entityID) <= 0)
                    {
                        value = myEntity.EntityName;
                    }
                    else
                    {
                        value = myEntity.EntityName;// + " ( Hire for " + myEntity.GetHireCost() + " " + myEntity.GetHireCurrency().ItemClass.Name + " )";
                    }
                    return(true);
                }
                value = ((!(base.xui.Dialog.Respondent != null)) ? string.Empty : Localization.Get(base.xui.Dialog.Respondent.EntityName, string.Empty));
                return(true);
            }
        }
        return(false);
    }
        public List <BindingItem> GetVendorItems([FromForm] int CategoryId, [FromForm] List <VendorTypeValue> Values, [FromForm] string UserId, [FromForm] int page = 1)
        {
            IPagedList <VendorItem> vendors = new List <VendorItem>().ToPagedList();
            var values = Newtonsoft.Json.JsonConvert.DeserializeObject <List <VendorTypeValue> >(Request.Form["Values"].ToString());

            if (values.Count > 0)
            {
                vendors = _context.VendorItems.Include(x => x.VendorItemReviews).Include(x => x.Gallery).Where(x => x.Categories.Where(y => y.VendorCategory.Id == CategoryId).Count() > 0 && x.VendorItemTypeValues.Where(y => values.Contains(y.VendorTypeValue)).Count() > 0).OrderBy(x => x.Title).ToPagedList(page, PageSize);
            }
            else
            {
                vendors = _context.VendorItems.Include(x => x.VendorItemReviews).Include(x => x.Gallery).Where(x => x.Categories.Where(y => y.VendorCategory.Id == CategoryId).Count() > 0).OrderBy(x => x.Title).ToPagedList(page, PageSize);
            }
            var bindings = new List <BindingItem>();

            foreach (var row in vendors)
            {
                row.Thumb = "https://planmy.me/Media/" + row.Thumb;
                foreach (var g in row.Gallery)
                {
                    g.Image = "https://planmy.me/Media/" + g.Image;
                }
                string favImg = "fav.png";
                if (!string.IsNullOrEmpty(UserId))
                {
                    var rec = _context.WishLists.Where(x => x.VendorItemId == row.Id && x.UserId == UserId).FirstOrDefault();
                    if (rec != null)
                    {
                        favImg = "favselected.png";
                    }
                    else
                    {
                        favImg = "fav.png";
                    }
                }
                string rendered = WebUtility.HtmlDecode(Regex.Replace(row.HtmlDescription, "<.*?>", ""));
                rendered = rendered.Length > 100 ? rendered.Substring(0, 100) + "more..." : rendered;
                string title = WebUtility.HtmlDecode(row.Title);
                //string src = post.Thumb != null ? Statics.MediaLink + post.Thumb : "";
                BindingItem binding = new BindingItem {
                    Desc = rendered, Title = title, item = row, Src = row.Thumb, FavImg = favImg, Id = row.Id
                };
                bindings.Add(binding);
            }
            return(bindings);
        }
Example #18
0
        private void TestForm_Load(object sender, EventArgs e)
        {
            mc = new MixerControl();
            // mc.Init();
            checkBox1.Checked = mc.Mute;
            trackBar1.Value   = (int)mc.MasterVolume;

            // mo = new MouseHook();
            //  mo.SetHook();
            // mo.MouseDown += Mo_MouseDown;

            ke = new KeyboardHook();
            ke.SetHook();
            ke.KeyDown += Ke_KeyDown;

            man = new BindingManager();
            man.InitHook();

            bi = new BindingItem((new [] { Keys.ControlKey, Keys.K }).ToList(), BindingType.Press, 1, 0);
        }
        public void AddDataBindingSource(string name = null, Type type = null)
        {
            if (!Project.MasterConfigurationList.Any())
            {
                AddMasterConfig("Default");
            }

            //var item = Project.BindingSourcesList.AddNew();
            //item.Name = "New item " + (Project.BindingSourcesList.Count());
            var item = new BindingItem()
            {
                Name         = name ?? "New Binding Item " + Project.BindingSourceList.Count(),
                Type         = type,
                MasterConfig = _masterConfig ?? Project.MasterConfigurationList.LastOrDefault()
            };

            foreach (var master in Project.MasterConfigurationList)
            {
                item.ValueDictionary.Add(master, null);
            }
            Project.BindingSourceList.Add(item);
        }
        public List <BindingItem> GetVendorItems([FromForm] string term, [FromForm] string UserId, [FromForm] int page = 1)
        {
            IPagedList <VendorItem> vendors = new List <VendorItem>().ToPagedList();
            string q = term.ToLower();

            vendors = _context.VendorItems.Include(x => x.VendorItemReviews).Include(x => x.Gallery).Where(x => x.Title.ToLower().Contains(q) || x.HtmlDescription.ToLower().Contains(q)).OrderBy(x => x.Title).ToPagedList(page, PageSize);
            var bindings = new List <BindingItem>();

            foreach (var row in vendors)
            {
                row.Thumb = "https://planmy.me/Media/" + row.Thumb;
                foreach (var g in row.Gallery)
                {
                    g.Image = "https://planmy.me/Media/" + g.Image;
                }
                string favImg = "fav.png";
                if (!string.IsNullOrEmpty(UserId))
                {
                    var rec = _context.WishLists.Where(x => x.VendorItemId == row.Id && x.UserId == UserId).FirstOrDefault();
                    if (rec != null)
                    {
                        favImg = "favselected.png";
                    }
                    else
                    {
                        favImg = "fav.png";
                    }
                }
                string rendered = WebUtility.HtmlDecode(Regex.Replace(row.HtmlDescription, "<.*?>", ""));
                rendered = rendered.Length > 100 ? rendered.Substring(0, 100) + "more..." : rendered;
                string title = WebUtility.HtmlDecode(row.Title);
                //string src = post.Thumb != null ? Statics.MediaLink + post.Thumb : "";
                BindingItem binding = new BindingItem {
                    Desc = rendered, Title = title, item = row, Src = row.Thumb, FavImg = favImg, Id = row.Id
                };
                bindings.Add(binding);
            }
            return(bindings);
        }
Example #21
0
        /// <summary>
        /// Creates a BindingPath for the specified path using a specified DependencyProperty precedence.
        /// </summary>
        /// <param name="path">The path to the property</param>
        /// <param name="fallbackValue">Provides the fallback value to apply when the source is invalid.</param>
        /// <param name="precedence">The precedence value to manipulate if the path matches to a DependencyProperty.</param>
        /// <param name="allowPrivateMembers">Allows for the binding engine to include private properties in the lookup</param>
        internal BindingPath(string path, object fallbackValue, DependencyPropertyValuePrecedences?precedence, bool allowPrivateMembers)
        {
            _path = (path ?? "").Trim();

            BindingItem bindingItem = null;

            foreach (var item in SplitPath(_path).Reverse())
            {
                bindingItem = new BindingItem(bindingItem, item, fallbackValue, precedence, allowPrivateMembers);
                _chain      = bindingItem;

                if (_value == null)
                {
                    _value = bindingItem;
                }
            }

            if (_value != null)
            {
                _value.ValueChangedListener = this;
            }
        }
Example #22
0
    public override bool GetBindingValue(ref string value, BindingItem binding)
    {
        EntityPlayer player = base.xui.playerUI.entityPlayer;

        if (player == null)
        {
            return(false);
        }

        int entityID = 0;

        if (player.Buffs.HasCustomVar("CurrentNPC"))
        {
            entityID = (int)player.Buffs.GetCustomVar("CurrentNPC");
        }

        if (entityID == 0)
        {
            return(false);
        }

        string fieldName = binding.FieldName;

        if (fieldName != null)
        {
            if (fieldName == "statement")
            {
                EntityAliveSDX myEntity = player.world.GetEntity(entityID) as EntityAliveSDX;
                if (myEntity)
                {
                    value = EntityUtilities.DisplayEntityStats(entityID);
                }
                return(false);
            }
        }
        return(false);
    }
Example #23
0
    public override bool GetBindingValue(ref string value, BindingItem binding)
    {
        UnityEngine.Debug.Log("GetBindingValue(): " + binding.FieldName);
        if (!entity)
        {
            return(false);
        }

        int    EntityID  = this.entity.entityId;
        string fieldName = binding.FieldName;

        switch (fieldName)
        {
        case "npchealth":
            value = this.entity.Health.ToString();
            return(true);

        case "npcmaxhealth":
            value = this.entity.GetMaxHealth().ToString();
            return(true);

        case "npchealthtitle":
            value = "Health";
            return(true);

        case "":
            value = this.entity.Stats.Water.Value.ToString();
            return(true);

        case "playerfood":
            value = this.entity.Stats.Stamina.Value.ToString();
            return(true);
        }

        return(base.GetBindingValue(ref value, binding));
    }
Example #24
0
        void SynchronizeSceneBindings()
        {
            if (targets.Length > 1)
            {
                return;
            }

            var director      = (PlayableDirector)target;
            var playableAsset = m_PlayableAsset.objectReferenceValue as PlayableAsset;

            hasUnused = false;
            m_BindingItems.Clear();
            UpdatePlayableBindingsIfRequired(playableAsset, director);

            var mainAssetPath = AssetDatabase.GetAssetPath(director.playableAsset);

            for (int i = 0; i < m_SceneBindings.arraySize; ++i)
            {
                var property  = m_SceneBindings.GetArrayElementAtIndex(i);
                var keyObject = property.FindPropertyRelative("key").objectReferenceValue;

                // Don't show completely null keys.
                if (((object)keyObject) == null)
                {
                    continue;
                }

                var assetPath  = AssetDatabase.GetAssetPath(keyObject);
                var cacheValue = new BindingItem()
                {
                    property      = property,
                    AssetPath     = assetPath,
                    IsMainAsset   = !string.IsNullOrEmpty(assetPath) && mainAssetPath == assetPath,
                    masterAsset   = !string.IsNullOrEmpty(assetPath) ? AssetDatabase.LoadMainAssetAtPath(assetPath) as PlayableAsset : null,
                    propertyIndex = i,
                };
                cacheValue.binding = FindBinding(cacheValue.masterAsset, keyObject);

                hasUnused |= !cacheValue.IsMainAsset;

                if (showUnused || cacheValue.IsMainAsset)
                {
                    m_BindingItems.Add(cacheValue);
                }
            }

            m_BindingItems.Sort((a, b) =>
            {
                if (a.IsMainAsset == b.IsMainAsset)
                {
                    return(-string.CompareOrdinal(a.AssetPath, b.AssetPath));
                }
                if (a.IsMainAsset)
                {
                    return(-1);
                }
                return(1);
            }
                                );

            if (showUnused)
            {
                bool addHeader = false;
                for (int i = 0; i < m_BindingItems.Count - 1; i++)
                {
                    if (m_BindingItems[i].masterAsset != m_BindingItems[i + 1].masterAsset)
                    {
                        m_BindingItems.Insert(i + 1, new BindingItem()
                        {
                            masterAsset = m_BindingItems[i + 1].masterAsset, propertyIndex = -1
                        }
                                              );
                        addHeader = true;
                    }
                }

                if (addHeader && m_BindingItems.Count > 0)
                {
                    m_BindingItems.Insert(0, new BindingItem()
                    {
                        masterAsset   = m_BindingItems[0].masterAsset,
                        propertyIndex = -1,
                        IsMainAsset   = m_BindingItems[0].masterAsset == director.playableAsset,
                    }
                                          );
                }
            }
        }
Example #25
0
        private void AddToAssistToolbar(dynamic module, BindingItem item)
        {
            assistToolbarPBCount++;
            string imageName = e0571.web.core.Utils.TypeConverter.ChangeString(module.Picture).Trim();
            Image  image;

            if (imageName == string.Empty)
            {
                image = Properties.Resources.coffee;
            }
            else
            {
                image = (System.Drawing.Image)Properties.Resources.ResourceManager.GetObject(imageName.ToString());
            }
            string assistToolbarContentKey = module.ModuleId.ToString();
            string pageKey;
            string pageText;
            string pageUrl;
            string pageOpenTarget = module.OpenTarget.ToString();
            string pageCode       = module.ModuleCode.ToString();

            if (item == null)
            {
                pageText = module.AliasName.ToString();
                pageUrl  = module.AccessUrl.ToString();
                pageKey  = "_tab_" + module.ModuleId.ToString();
            }
            else
            {
                pageText = item.Text;
                pageUrl  = item.Value;
                pageKey  = "_tab_" + module.ModuleId.ToString() + "$" + item.Text;
            }

            Size  assistToolbarSize     = new Size(48, 48);
            Point assistToolbarLocation = Point.Empty;
            int   index = pnlAssistToolbar.Controls.Count;

            if (index % 2 == 0)
            {
                assistToolbarLocation = new Point(1, ((index / 2) + 1) * 3 + (index / 2) * 48);
            }
            else
            {
                assistToolbarLocation = new Point(50, ((index / 2) + 1) * 3 + (index / 2) * 48);
            }

            PictureBox pb = new PictureBox();

            pb.Size        = assistToolbarSize;
            pb.Location    = assistToolbarLocation;
            pb.Image       = image;
            pb.BackColor   = SystemColors.MenuHighlight;
            pb.MouseEnter += new EventHandler(pb_MouseEnter);
            pb.MouseLeave += new EventHandler(pb_MouseLeave);
            pb.Click      += new EventHandler((s, e) =>
            {
                if (assistToolbarPB == null)
                {
                    assistToolbarPB           = s as PictureBox;
                    assistToolbarPB.BackColor = Color.Red;
                }
                else
                {
                    if (assistToolbarPB == s)
                    {
                        if (pb.BackColor == SystemColors.MenuHighlight)
                        {
                            assistToolbarPB.BackColor = Color.Red;
                        }
                        else
                        {
                            assistToolbarPB.BackColor = SystemColors.MenuHighlight;
                        }
                    }
                    else
                    {
                        assistToolbarPB.BackColor = SystemColors.MenuHighlight;
                        assistToolbarPB           = s as PictureBox;
                        pb.BackColor = Color.Red;
                    }
                }

                OpenTarget(pageKey, pageText, pageUrl, pageOpenTarget, pageCode);
            });
            pnlAssistToolbar.Controls.Add(pb);
            xTooltip.SetToolTip(pb, pageText);
        }
Example #26
0
        private void readBindings()
        {
            //var info = (Dictionary<string, object>)projInfoFile.getInfo("Valis");
            //foreach (var binding in info.Keys)
            //{
            //    var bindedRow = binding.ToString();
            //    var bind_ID = info[binding].ToString();
            //    var bindvaliName = thisValiInstance.allValisbyID[bind_ID].Name;
            //    cellAccessfromRow(int.Parse(bindedRow));
            //    updateVali2Datagrid(bindvaliName, int.Parse(bindedRow));
            //    if (UpdateValiIDs.ContainsKey(selectedValiObj.toBindRow))
            //    {
            //        UpdateValiIDs.Remove(selectedValiObj.toBindRow);
            //    }

            //    UpdateValiIDs.Add(selectedValiObj.toBindRow, int.Parse(bind_ID));
            //}
            #region Restore valis

            var info = (Dictionary <string, object>)projInfoFile.getInfo("Valis1");
            if (thisValiInstance != null && info != null)
            {
                foreach (var bindingKey in info.Keys.ToList())
                {
                    Dictionary <string, object> dict = projInfoFile.extractDict(info, bindingKey);
                    string        varSTKName         = (string)dict["Name"];
                    Int64         bindId             = (Int64)dict["Id"];
                    int           testRow            = int.Parse(dict["Row"].ToString());
                    List <string> parents            = projInfoFile.extractList(dict, "Parents");

                    int bindRow = mapNewRow4Binding(varSTKName, testRow, parents);
                    if (bindRow != testRow && UpdateValiIDs.ContainsKey(testRow))
                    {
                        UpdateValiIDs.Remove(testRow);
                    }

                    var bindvaliName = thisValiInstance.allValisbyID[bindId.ToString()].Name;
                    cellAccessfromRow(bindRow);
                    updateVali2Datagrid(bindvaliName, bindRow, BindingAction.ADD);

                    if (UpdateValiIDs.ContainsKey(selectedValiObj.toBindRow))
                    {
                        UpdateValiIDs.Remove(selectedValiObj.toBindRow);
                    }


                    UpdateValiIDs.Add(selectedValiObj.toBindRow, bindId);
                }
            }
            #endregion

            var infoDatasets = (Dictionary <string, object>)projInfoFile.getInfo("Datasets");
            if (thisValiInstance != null && infoDatasets != null)
            {
                foreach (var bindingKey in infoDatasets.Keys)
                {
                    Dictionary <string, object> dict = projInfoFile.extractDict(infoDatasets, bindingKey);
                    BindingItem item = parseBindingDict(dict);

                    m_datasetWin.DatasetBindings.Add(item.bindID, item);
                    m_datasetWin.l_bindings.Add(item);
                    DSBindingsbyID.Add(int.Parse(item.bindID), item);
                    DSBindingGridXAML.ItemsSource = m_datasetWin.l_bindings;
                    DSBindingGridXAML.Items.Refresh();
                    clear_MidPanel();
                }
            }
        }
Example #27
0
 public BindingItem(BindingItem next, string property, object fallbackValue) :
     this(next, property, fallbackValue, null, false)
 {
 }