示例#1
0
 internal void OpenGraph(Exporter exporter)
 {
     autoLoad      = false;
     this.exporter = exporter;
     this.ruleObj  = exporter.ruleObj;
     this.psdPath  = exporter.psdFile;
 }
示例#2
0
 private RuleObjectViewModel ViewModelResolver(RuleObject model)
 {
     if (model is RuleGroup)
     {
         return(new RuleGroupViewModel(model as RuleGroup, this.CanUseProposedValues));
     }
     else if (model is AttributeChangeRule)
     {
         return(new AttributeChangeRuleViewModel(model as AttributeChangeRule, this.CanUseProposedValues));
     }
     else if (model is AttributePresenceRule)
     {
         return(new AttributePresenceRuleViewModel(model as AttributePresenceRule, this.CanUseProposedValues));
     }
     else if (model is ValueComparisonRule)
     {
         return(new ValueComparisonRuleViewModel(model as ValueComparisonRule, this.CanUseProposedValues));
     }
     else if (model is AdvancedComparisonRule)
     {
         return(new AdvancedComparisonRuleViewModel(model as AdvancedComparisonRule, this.CanUseProposedValues));
     }
     else if (model is ObjectChangeRule)
     {
         return(new ObjectChangeRuleViewModel(model as ObjectChangeRule, this.CanUseProposedValues));
     }
     else if (model is EventRule)
     {
         return(new EventRuleViewModel(model as EventRule, this.CanUseProposedValues));
     }
     else
     {
         throw new ArgumentException("The object type is unknown", "model");
     }
 }
示例#3
0
        private static Expression GetExpression <T>(
            Expression parameterExpression,
            RuleObject ruleObject,
            string ruleAttribute)
        {
            switch (ruleObject)
            {
            case RuleObject.ObjectProperty:
                var property = typeof(T).GetProperty(ruleAttribute);

                if (property == null)
                {
                    throw new ArgumentException($"{typeof (T)} does not have a property named: {ruleAttribute}");
                }

                return(Expression.Property(parameterExpression, property));

            case RuleObject.ObjectMethod:
                var method = typeof(T).GetMethod(ruleAttribute);

                if (method == null)
                {
                    throw new ArgumentException($"{typeof(T)} does not have a method named: {ruleAttribute}");
                }

                return(Expression.Call(parameterExpression, method));

            default:
                throw new ArgumentOutOfRangeException(nameof(ruleObject));
            }
        }
示例#4
0
 private void OnEnable()
 {
     if (autoLoad)
     {
         psdPath = EditorPrefs.GetString(Prefs_pdfPath);
         ruleObj = RuleHelper.GetRuleObj();
     }
 }
示例#5
0
 public PSDImportCtrl(Canvas canvas, RuleObject rule, Vector2 canvasSize)
 {
     this.canvas     = canvas;
     this.rule       = rule;
     this.canvas     = canvas;
     this.canvasSize = canvasSize;
     uinode          = new UGUINode(canvas.transform, null);
     InitDrawers();
 }
示例#6
0
 /// <summary>
 /// 加载图片导入规则
 /// </summary>
 /// <param name="importer"></param>
 /// <param name="rule"></param>
 private static void ChargeTextureImportRule(TextureImporter textureImporter, RuleObject rule)
 {
     textureImporter.spritePixelsPerUnit = rule.spritePixelsPerUnit;
     textureImporter.textureCompression  = rule.textureCompression;
     textureImporter.mipmapEnabled       = rule.mipmapEnabled;
     textureImporter.isReadable          = rule.isReadable;
     textureImporter.wrapMode            = rule.wrapMode;
     textureImporter.filterMode          = rule.filterMode;
 }
示例#7
0
    public void PrintRule(RuleObject ruleObject)
    {
        if (null == SelectedRuleObject)
        {
            return;
        }

        ruleObject.Print();
        ruleObject.Update();
    }
示例#8
0
        /// <summary>
        /// 从区域对象获取所在场馆部门名称
        /// </summary>
        /// <param name="area">区域对象</param>
        /// <param name="rules">规则集</param>
        /// <returns>区域对象所在场馆部门名称</returns>
        public static string GetDepartmentName(RuleObject area, IEnumerable <RuleObject> rules)
        {
            RuleObject target = area;

            while (null != target && string.IsNullOrWhiteSpace(target.BindingNo))
            {
                target = rules.FirstOrDefault(r => r.RuleNo == target.ParentRuleNo);
            }
            return(target == null ? null : ErpService.CompanyManagement.GetDepartmentNameByNo(target.BindingNo));
        }
示例#9
0
    public void DeleteRuleObject()
    {
        if (null == mDeletedRuleObject)
        {
            return;
        }

        SelectRule(null);
        mRuleList.Remove(mDeletedRuleObject);
        mDeletedRuleObject = null;
    }
示例#10
0
        private static void FindChild(TreeNode node, IEnumerable <RuleObject> rules)
        {
            RuleObject current = (RuleObject)node.Tag;

            foreach (RuleObject rule in rules.Where(r => r.ParentRuleNo == current.RuleNo && !r.Name.EndsWith(@"区1") && r.Name != @"首尔印象区"))
            {
                TreeNode child = node.Nodes.Add(rule.Name);
                child.Tag = rule;
                FindChild(child, rules);
            }
        }
示例#11
0
    public RuleObject CreateNew(int id)
    {
        RuleObject ruleObject = FindRuleObject(id);

        if (null != ruleObject)
        {
            return(ruleObject);
        }

        ruleObject = CreateInstance <RuleObject>();
        ruleObject.RuleHost.SetID(id);
        mRuleList.Add(ruleObject);
        return(ruleObject);
    }
示例#12
0
        public void CRUD_Saving()
        {
            if (ChkSelectedItemUnitAll.Checked)
            {
                SelectionLST = new List <DataGrdItemUnitListSelection>();
                DataGrdItemUnitListSelection o = new DataGrdItemUnitListSelection();
                NAS.DAL.Nomenclature.Item.ItemUnit.Populate();
                NAS.DAL.Nomenclature.Item.ItemUnit iu =
                    session.FindObject <NAS.DAL.Nomenclature.Item.ItemUnit>(
                        new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_DEFAULT_SELECTEDALL, BinaryOperatorType.Equal));
                o.ItemUnitId = iu.ItemUnitId;
                SelectionLST.Add(o);
            }

            RuleObject.SaveRuleCondition(session, KeyValue, SelectionLST);
        }
示例#13
0
 protected override void OnFirstCallback()
 {
     // subscribe to import rules
     _ruleCache = IntClient.Target.CreateCache(delegate(CacheChangeData update)
     {
         Interlocked.Increment(ref _dispatchedEventCount);
         MainThreadQueue.Dispatch(update, ProcessRuleUpdate);
     }, null);
     _ruleCache.Subscribe <AlertRule>(
         RuleObject.MakeRuleFilter(
             EnvHelper.EnvName(IntClient.Target.ClientInfo.ConfigEnv),
             IntClient.Target.ClientInfo.HostName,
             AppName,
             IntClient.Target.ClientInfo.UserName));
     // start a 30 second timer to periodically check the rules
     _timer = new Timer(RecvTimerEvent, null, TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(30));
 }
        public void CRUD_Saving()
        {
            if (ChkSelectedManufacturerAll.Checked)
            {
                SelectionLST = new List <DataGrdManufacturerListSelection>();
                DataGrdManufacturerListSelection o = new DataGrdManufacturerListSelection();
                NAS.DAL.Nomenclature.Organization.ManufacturerOrg.Populate();
                NAS.DAL.Nomenclature.Organization.ManufacturerOrg m =
                    session.FindObject <NAS.DAL.Nomenclature.Organization.ManufacturerOrg>(
                        new BinaryOperator("Code", Utility.Constant.NAAN_DEFAULT_CODE_SELECTEDALL, BinaryOperatorType.Equal));
                o.OrganizationId = m.OrganizationId;
                o.Code           = m.Code;
                o.Name           = m.Name;
                SelectionLST.Add(o);
            }

            RuleObject.SaveRuleCondition(session, KeyValue, SelectionLST);
        }
示例#15
0
        protected override void OnFirstCallback()
        {
            // subscribe to import rules
            _importRuleSet = IntClient.Target.CreateCache(delegate(CacheChangeData update)
            {
                Interlocked.Increment(ref _updateRequestsDispatched);
                MainThreadQueue.Dispatch(update, ProcessRuleUpdate);
            }, null);
            _importRuleSet.Subscribe <FileImportRule>(
                RuleObject.MakeRuleFilter(
                    EnvHelper.EnvName(IntClient.Target.ClientInfo.ConfigEnv),
                    IntClient.Target.ClientInfo.HostName,
                    AppName,
                    IntClient.Target.ClientInfo.UserName));

            // start a 1 minute timer to periodically check the rules
            _timer = new Timer(RecvTimerEvent, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1));
        }
示例#16
0
        private void DrawConfigs(Rect configRect)
        {
            var titleRect   = new Rect(configRect.x, configRect.y, configRect.width * 0.1f, configRect.height);
            var contentRect = new Rect(configRect.x + configRect.width * 0.1f, configRect.y, configRect.width * 0.5f, configRect.height);
            var noticeRect  = new Rect(configRect.x + configRect.width * 0.6f, configRect.y, configRect.width * 0.3f, configRect.height);
            var createRect  = new Rect(configRect.x + configRect.width - 60, configRect.y, 60, EditorGUIUtility.singleLineHeight);

            EditorGUI.SelectableLabel(titleRect, "使用规则: ");
            EditorGUI.LabelField(noticeRect, "[psd文件导出 + ui界面生成]");
            ruleObj = EditorGUI.ObjectField(contentRect, ruleObj, typeof(RuleObject), false) as RuleObject;
            if (GUI.Button(createRect, "创建", EditorStyles.miniButtonRight))
            {
                if (EditorUtility.DisplayDialog("创建新规则", "确认后将生成新的规则文件!", "确认", "取消"))
                {
                    exporter.ruleObj = RuleHelper.CreateRuleObject();
                }
            }
        }
示例#17
0
 private void btnChangeArea_Click(object sender, EventArgs e)
 {
     new FrmAreaPicker
     {
         AfterPick = node =>
         {
             try
             {
                 RuleObject area = (RuleObject)node.Tag;
                 DressManager.ChangeArea(Barcode, area, venueName, Information.CurrentUser.EmployeeNO2, Information.CurrentUser.EmployeeDepartmentNO);
                 MessageBoxEx.Info(@"变更成功!");
             }
             catch (Exception ex)
             {
                 MessageBoxEx.Error(ex.Message);
             }
         }
     }.Show();
 }
示例#18
0
 internal static Texture GetPreviewIcon(PreviewItem item, RuleObject rule)
 {
     if (rule == null || item.layerType != LayerType.Group)
     {
         return(previewIcons[item.layerType.ToString()]);
     }
     else
     {
         GroupType groupType = GroupType.EMPTY;
         string[]  args;
         /*string name = */ rule.AnalysisGroupName(item.name, out groupType, out args);
         if (previewIcons.ContainsKey(groupType.ToString()) && previewIcons[groupType.ToString()] != null)
         {
             return(previewIcons[groupType.ToString()]);
         }
         else
         {
             return(previewIcons[LayerType.Group.ToString()]);
         }
     }
 }
示例#19
0
        /// <summary>
        /// 快速创建控制器
        /// </summary>
        /// <param name="arg"></param>
        /// <param name="uiSize"></param>
        /// <param name="defultCanvas"></param>
        /// <returns></returns>
        public static PSDImportCtrl CreatePsdImportCtrlSafty(RuleObject arg, Vector2 uiSize, Canvas defultCanvas = null)
        {
            Canvas canvas = null;

            if (defultCanvas != null)
            {
                canvas = defultCanvas;
            }
            else
            {
                canvas = new GameObject("Canvas", typeof(Canvas), typeof(CanvasScaler), typeof(GraphicRaycaster)).GetComponent <Canvas>();
                canvas.GetComponent <CanvasScaler>().uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
                canvas.renderMode = RenderMode.ScreenSpaceOverlay;
            }
            PSDImportCtrl import = new PSDImportCtrl(canvas, arg, uiSize);

            UnityEngine.UI.CanvasScaler scaler = canvas.GetComponent <UnityEngine.UI.CanvasScaler>();
            scaler.referenceResolution = new Vector2(uiSize.x, uiSize.y);

            return(import);
        }
示例#20
0
    private void InitData()
    {
        //if (null != mRuleList)
        //	return;

        mRuleList = new List <RuleObject>();
        XmlData root = XmlTool.GetXmlData(ERuleParam4Editor.RuleConfigUrlForEditor);

        if (null == root)
        {
            return;
        }

        foreach (var data in root.Childs)
        {
            RuleObject ruleObject = new RuleObject();
            if (!ruleObject.XmlDeserilize(data))
            {
                continue;
            }

            mRuleList.Add(ruleObject);
        }
    }
 public void Callback(RuleObject sender)
 {
     m_callbackCalled = true;
 }
示例#22
0
 /// <summary>
 /// 更换礼服所在场馆
 /// </summary>
 /// <param name="barcode">礼服条码</param>
 /// <param name="area">场馆对象</param>
 /// <param name="oldeVeunue"></param>
 /// <param name="empId"></param>
 /// <param name="department"></param>
 public static void ChangeArea(string barcode, RuleObject area, string oldeVeunue, string empId, string department)
 {
     ErpService.DressManagement.ChangeArea(barcode, area, GetDepartmentName(area, GetRules()), oldeVeunue, empId, department);
 }
示例#23
0
 private void BindEvents()
 {
     //
     // txtCustomCode
     //
     txtCustomCode.LostFocus += (sender, args) => DressToNew.CustomCode = ((TextBox)sender).Text;
     //
     // txtBarCode
     //
     txtBarCode.LostFocus += (sender, args) => DressToNew.BarCode = ((TextBox)sender).Text;
     //
     // cmbType
     //
     cmbType.SelectedIndexChanged += (sender, args) =>
     {
         ComboBox   cmb  = (ComboBox)sender;
         RuleObject type = (RuleObject)cmb.SelectedItem;
         if (null == type)
         {
             DressToNew.TypeNo = null;
             Categories        = null;
         }
         else
         {
             DressToNew.TypeNo = type.RuleNo.ToString();
             Categories        = DressManager.FilterRules(Rules, type.RuleNo).ToList();
         }
     };
     //
     // cmbColor
     //
     cmbColor.LostFocus += (sender, args) => DressToNew.ColorName = ((ComboBox)sender).Text;
     //
     // cmbCategory
     //
     cmbCategory.SelectedIndexChanged += (sender, args) =>
     {
         ComboBox   cmb      = (ComboBox)sender;
         RuleObject category = (RuleObject)cmb.SelectedItem;
         DressToNew.CategoryNo = null == category ? null : category.RuleNo.ToString();
     };
     //
     // cmbBrand
     //
     cmbBrand.LostFocus += (sender, args) => DressToNew.BrandName = ((ComboBox)sender).Text;
     //
     // cmbOrnamental
     //
     cmbOrnamental.LostFocus += (sender, args) => DressToNew.OrnamentalName = ((ComboBox)sender).Text;
     //
     // cmbUpperStyle
     //
     cmbUpperStyle.LostFocus += (sender, args) => DressToNew.UpperStyleName = ((ComboBox)sender).Text;
     //
     // cmbLowerStyle
     //
     cmbLowerStyle.LostFocus += (sender, args) => DressToNew.LowerStyleName = ((ComboBox)sender).Text;
     //
     // cmbUpperMaterial
     //
     cmbUpperMaterial.LostFocus += (sender, args) => DressToNew.UpperMaterialName = ((ComboBox)sender).Text;
     //
     // cmbLowerMaterial
     //
     cmbLowerMaterial.LostFocus += (sender, args) => DressToNew.LowerMaterialName = ((ComboBox)sender).Text;
     //
     // cmbUse
     //
     cmbUse.LostFocus += (sender, args) => DressToNew.UseName = ((ComboBox)sender).Text;
     //
     // cmbSupplier
     //
     cmbSupplier.LostFocus += (sender, args) => DressToNew.SupplierName = ((ComboBox)sender).Text;
     //
     // cmbLevel
     //
     cmbLevel.LostFocus += (sender, args) =>
     {
         ComboBox cmb   = (ComboBox)sender;
         Level    level = (Level)cmb.SelectedItem;
         DressToNew.LevelNo = null == level ? null : level.No;
     };
     //
     // txtBuyer
     //
     txtBuyer.LostFocus += (sender, args) => DressToNew.SupplierName = ((TextBox)sender).Text;
     //
     // numUsedToday
     //
     numUsedToday.LostFocus += (sender, args) =>
     {
         NumericUpDown numric = (NumericUpDown)sender;
         DressToNew.NumOfUsedToday = string.IsNullOrWhiteSpace(numric.Text) ? 0 : Convert.ToInt32(numric.Value);
     };
     //
     // numNOTime
     //
     numNOTime.LostFocus += (sender, args) =>
     {
         NumericUpDown numric = (NumericUpDown)sender;
         DressToNew.NOTime = string.IsNullOrWhiteSpace(numric.Text) ? 0 : Convert.ToInt32(numric.Value);
     };
     //
     // txtCost
     //
     txtCost.LostFocus += (sender, args) =>
     {
         CashTextBox txt = (CashTextBox)sender;
         if (string.IsNullOrWhiteSpace(txt.Text))
         {
             DressToNew.CostPrice = decimal.Zero;
         }
         else
         {
             decimal cost;
             if (decimal.TryParse(txt.Text, out cost))
             {
                 DressToNew.CostPrice = cost;
             }
             else
             {
                 MessageBoxEx.Error(@"价格输入有误!");
                 txt.Highlight();
             }
         }
     };
     //
     // txtRent
     //
     txtRent.LostFocus += (sender, args) =>
     {
         CashTextBox txt = (CashTextBox)sender;
         if (string.IsNullOrWhiteSpace(txt.Text))
         {
             DressToNew.RentPrice = decimal.Zero;
         }
         else
         {
             decimal rent;
             if (decimal.TryParse(txt.Text, out rent))
             {
                 DressToNew.RentPrice = rent;
             }
             else
             {
                 MessageBoxEx.Error(@"价格输入有误!");
                 txt.Highlight();
             }
         }
     };
     //
     // txtSale
     //
     txtSale.LostFocus += (sender, args) =>
     {
         CashTextBox txt = (CashTextBox)sender;
         if (string.IsNullOrWhiteSpace(txt.Text))
         {
             DressToNew.SalePrice = decimal.Zero;
         }
         else
         {
             decimal sale;
             if (decimal.TryParse(txt.Text, out sale))
             {
                 DressToNew.SalePrice = sale;
             }
             else
             {
                 MessageBoxEx.Error(@"价格输入有误!");
                 txt.Highlight();
             }
         }
     };
     //
     // txtSource
     //
     txtSource.LostFocus += (sender, args) => DressToNew.Source = ((TextBox)sender).Text;
     //
     // txtDescription
     //
     txtDescription.LostFocus += (sender, args) => DressToNew.Description = ((TextBox)sender).Text;
     //
     // txtNote
     //
     txtNote.LostFocus += (sender, args) => DressToNew.Notes = ((TextBox)sender).Text;
     //
     // cmbServer
     //
     cmbServerPath.LostFocus += (sender, args) => ServerPath = ((ComboBox)sender).Text;
     //
     // photoPicker
     //
     photoPicker.PhotoFilePathChanged += (sender, args) => PhotoFilePath = ((SinglePhotoPicker)sender).PhotoFilePath;
 }
示例#24
0
 private void SelectRule(RuleObject ruleObject)
 {
     SelectedRuleObject     = ruleObject;
     Selection.activeObject = SelectedRuleObject;
 }
示例#25
0
 private bool _SaveSingleRule(RuleObject ruleObject)
 {
     return(XmlTool.ReplaceXmlData(ERuleParam4Editor.RuleConfigUrlForEditor, ruleObject, string.Format("root/node[@id='{0}']", ruleObject.RuleHost.RuleID)));
 }
 public void CRUD_Opening()
 {
     SelectionLST = RuleObject.LoadRuleCondition(session, KeyValue) as List <DataGrdManufacturerListSelection>;
     grdManufacturerListPreview.DataSource = SelectionLST;
     grdManufacturerListPreview.DataBind();
 }
示例#27
0
 public void SetRule(RuleObject rule)
 {
     this.rule = rule;
 }