상속: MonoBehaviour
예제 #1
0
        public bool Init(DeviceDescriptor deviceDescriptor,DeviceDescription description)
        {
            base.Init(deviceDescriptor);
            StillImageDevice imageDevice = StillImageDevice as StillImageDevice;
            if (imageDevice != null)
                imageDevice.DeviceEvent += StillImageDevice_DeviceEvent;
            foreach (var property in description.Properties)
            {
                if (!string.IsNullOrEmpty(property.Name))
                {
                    try
                    {
                        MTPDataResponse result = StillImageDevice.ExecuteReadData(CONST_CMD_GetDevicePropDesc, property.Code);

                        ErrorCodes.GetException(result.ErrorCode);
                        uint dataType = BitConverter.ToUInt16(result.Data, 2);
                        int dataLength = StaticHelper.GetDataLength(dataType);

                        var value = new PropertyValue<long> { Code = property.Code, Name = property.Name };
                        foreach (var propertyValue in property.Values)
                        {
                            value.AddValues(propertyValue.Name, propertyValue.Value);
                        }
                        value.ValueChanged += value_ValueChanged;
                        
                        AdvancedProperties.Add(value);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("Error ger property ", ex);
                    }
                }
            }
            return true;
        }
        public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
        {
            ModelPropertyEntryToOwnerActivityConverter ownerActivityConverter = new ModelPropertyEntryToOwnerActivityConverter();
            ModelItem activityItem =
                ownerActivityConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), false, null) as ModelItem;
            EditingContext context = activityItem.GetEditingContext();

            ModelItem parentModelItem =
                ownerActivityConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), true, null) as ModelItem;
            ModelItemDictionary arguments = parentModelItem.Properties[propertyValue.ParentProperty.PropertyName].Dictionary;

            DynamicArgumentDesignerOptions options = new DynamicArgumentDesignerOptions
            {
                Title = propertyValue.ParentProperty.DisplayName
            };

            using (ModelEditingScope change = arguments.BeginEdit("PowerShellParameterEditing"))
            {
                if (DynamicArgumentDialog.ShowDialog(activityItem, arguments, context, activityItem.View, options))
                {
                    change.Complete();
                }
                else
                {
                    change.Revert();
                }
            }
        }
        public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
        {
            ModelPropertyEntryToOwnerActivityConverter propertyEntryConverter =
                new ModelPropertyEntryToOwnerActivityConverter();

            ModelItem activityModelItem =
                (ModelItem)propertyEntryConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), false, null);

            ModelItem parentModelItem =
                (ModelItem)propertyEntryConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), true, null);

            EditingContext context = ((IModelTreeItem)activityModelItem).ModelTreeManager.Context;

            var inputData = parentModelItem.Properties[propertyValue.ParentProperty.PropertyName].Collection;            

            DynamicArgumentDesignerOptions options = new DynamicArgumentDesignerOptions
            { 
                Title = propertyValue.ParentProperty.DisplayName, 
            };

            using (EditingScope scope = context.Services.GetRequiredService<ModelTreeManager>().CreateEditingScope(StringResourceDictionary.Instance.GetString("InvokeMethodParameterEditing"), true))
            {
                if (DynamicArgumentDialog.ShowDialog(activityModelItem, inputData, context, activityModelItem.View, options))
                {
                    scope.Complete();
                }
            }
        }
 public FakeCameraDevice()
 {
     HaveLiveView = false;
     IsBusy = false;
     DeviceName = "Fake camera";
     SerialNumber = "00000000";
     IsConnected = true;
     HaveLiveView = false;
     ExposureStatus = 1;
     ExposureCompensation = new PropertyValue<int>() {IsEnabled = false};
     Mode = new PropertyValue<uint> {IsEnabled = false};
     FNumber = new PropertyValue<int> {IsEnabled = false};
     ShutterSpeed = new PropertyValue<long> {IsEnabled = false};
     WhiteBalance = new PropertyValue<long> {IsEnabled = false};
     FocusMode = new PropertyValue<long> {IsEnabled = false};
     CompressionSetting = new PropertyValue<int> {IsEnabled = false};
     IsoNumber = new PropertyValue<int> {IsEnabled = false};
     ExposureMeteringMode = new PropertyValue<int> {IsEnabled = false};
     Battery = 100;
     Capabilities.Add(CapabilityEnum.CaptureNoAf);
     Capabilities.Add(CapabilityEnum.LiveView);
     LiveViewImageZoomRatio=new PropertyValue<int>();
     LiveViewImageZoomRatio.AddValues("All",0);
     LiveViewImageZoomRatio.Value = "All";
 }
예제 #5
0
 public static ExtendedProperty CreateProperty(string defName, string value, BXC_MasterControlEntities entity, int userId)
 {
     var prop = new ExtendedProperty {User_Id = userId};
     var name = (from n in entity.PropertyNames where n.Name == defName select n).FirstOrDefault();
     if (name != null)
     {
         prop.PropertyNames_Id = name.Id;
     }
     else
     {
         var n = new PropertyName {Name = defName};
         entity.AddObject("PropertyNames", n);
         entity.SaveChanges();
         prop.PropertyNames_Id = n.Id;
     }
     var propValue = (from v in entity.PropertyValues where v.Value == value select v).FirstOrDefault();
     if (propValue != null)
     {
         prop.PropertyValues_Id = propValue.Id;
     }
     else
     {
         var v = new PropertyValue {Value = value};
         entity.AddObject("Propertyvalues", v);
         entity.SaveChanges();
         prop.PropertyValues_Id = v.Id;
     }
     return prop;
 }
예제 #6
0
        public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            var filename = FileName;
            if (!String.IsNullOrWhiteSpace(filename))
            {
                dlg.FileName = filename;
            }

            var dialogtitle = DialogTitle;
            if (!String.IsNullOrWhiteSpace(dialogtitle))
            {
                dlg.Title = dialogtitle;
            }

            var filter = Filter;
            if (!String.IsNullOrWhiteSpace(filter))
            {
                dlg.Filter = filter;
            }

            dlg.FilterIndex = 0;
            dlg.Multiselect = false;
            dlg.FileOk += this.BeforeFileOk;

            if (dlg.ShowDialog() == true)
            {
                this.OnFileOk(dlg.FileName, propertyValue, commandSource);
            }
        }
예제 #7
0
 private IEnumerable<object> GetArgs(
     ConstructorInfo constructor,
     PropertyValue propertyValue)
 {
     foreach (var parameter in constructor.GetParameters())
     {
         yield return GetArg(parameter.ParameterType, propertyValue);
     }
 }
예제 #8
0
        public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
        {
            Microsoft.Win32.OpenFileDialog ofd = new Microsoft.Win32.OpenFileDialog();
            if (ofd.ShowDialog() == true)
            {

                propertyValue.Value = ofd.FileName.Substring(ofd.FileName.LastIndexOf('\\')+1);
            }
        }
        public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
        {
            ModelPropertyEntryToOwnerActivityConverter propertyEntryConverter = new ModelPropertyEntryToOwnerActivityConverter();

            ModelItem modelItem = (ModelItem)propertyEntryConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), false, null);
            EditingContext context = modelItem.GetEditingContext();

            this.ShowDialog(modelItem, context);
        }
예제 #10
0
        public void to_string_with_name_but_no_accessor()
        {
            var value = new PropertyValue(){
                Name = "Key1",
                Value = "Value1"
            };

            value.ToString().ShouldEqual("Key1=Value1");
        }
예제 #11
0
 public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
 {
     var userDataDialog = new UserDataDialog();
     userDataDialog.Set(propertyValue.Value.ToString());
     userDataDialog.ShowDialog();
     if (userDataDialog.DialogResult == true)
     {
         propertyValue.Value = userDataDialog.Get();
     }
 }
예제 #12
0
        private BaseFilter CreateInstance(
            Type filterType,
            PropertyValue propertyValue)
        {
            var constructor = filterType.GetConstructors().Single();

            var args = GetArgs(constructor, propertyValue);

            return (BaseFilter)constructor.Invoke(args.ToArray());
        }
예제 #13
0
 protected override PropertyValue<long> InitExposureDelay()
 {
     PropertyValue<long> res = new PropertyValue<long>() { Name = "Exposure delay mode", IsEnabled = true, Code = 0xD06A };
     res.AddValues("3 sec", 0);
     res.AddValues("2 sec", 1);
     res.AddValues("One sec", 1);
     res.AddValues("OFF", 1);
     res.ValueChanged += (sender, key, val) => SetProperty(CONST_CMD_SetDevicePropValue, new[] { (byte)val }, res.Code, -1);
     return res;
 }
예제 #14
0
		/// <summary>
		/// Create property meta information from property value
		/// </summary>
		/// <param name="propValue"></param>
		/// <param name="catalogId"></param>
		/// <param name="categoryId"></param>
		/// <param name="propertyType"></param>
		public Property(PropertyValue propValue, string catalogId, string categoryId, coreModel.PropertyType propertyType)
		{
			Id = propValue.Id;
			CatalogId = catalogId;
			IsManageable = false;
			Name = propValue.PropertyName;
			Type = propertyType;
			ValueType = propValue.ValueType;
			Values = new List<PropertyValue>();
		}
예제 #15
0
 public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value)
 {
     if (this.properties != null)
     {
         foreach (var property in this.properties)
         {
             property.typeInfo.WriteData(collector, property.getter(value));
         }
     }
 }
 /// <summary>
 /// Helper method for registering property box to Ice Object Adapter
 /// </summary>
 /// <param name="type">Name of box</param>
 /// <param name="defaultValue">Default value of box</param>
 /// <param name="valFromPrx">Method which converts property value proxy to property value object</param>
 public void registerPropertyBox(string type, PropertyValue defaultValue, PropertyBoxModuleFactoryCreatorI.ValueFromPrx valFromPrx, string settingModuleIdentifier)
 {
     PropertyBoxModuleFactoryCreatorI newCreator = new PropertyBoxModuleFactoryCreatorI("::Ferda::Modules::" + type,
                                                    defaultValue.ice_ids(),
                                                    type,
                                                    defaultValue,
                                                    valFromPrx,
                                                    propertyReaper,
                                                    _adapter,
                                                    settingModuleIdentifier);
 }
예제 #17
0
        public XComponent LoadTemplate(string filePath)
        {
            var loadProps = new PropertyValue[2];
            loadProps[0] = new PropertyValue { Name = "AsTemplate", Value = new Any(true) };
            loadProps[1] = new PropertyValue { Name = "MacroExecutionMode", Value = new Any(MacroExecMode.ALWAYS_EXECUTE_NO_WARN) };

            return desktop.loadComponentFromURL(
                ConvertToURL(filePath),
                "_blank", 0,
                loadProps);
        }
 ///<summary>
 /// Constructor
 /// </summary>
 /// <param name="factory">A  BoxModuleFactoryPrx</param>
 /// <param name="propertyClassIceId">A  string</param>
 /// <param name="propertyFunctionsIceIds">A  string[]</param>
 /// <param name="identifier">A  string</param>
 public PropertyBoxModuleI(BoxModuleFactoryPrx factory, string propertyClassIceId, string[] propertyFunctionsIceIds, Ice.ObjectAdapter adapter, Ice.Identity myIdentity, Modules.PropertyBoxModuleFactoryCreatorI.ValueFromPrx valueFromPrx, PropertyValue defaultValue)
 {
     this.factory = factory;
     this.propertyClassIceId = propertyClassIceId;
     this.propertyFunctionsIceIds = propertyFunctionsIceIds;
     this.myProxy = BoxModulePrxHelper.uncheckedCast(adapter.add(this,myIdentity));
     this.adapter = adapter;
     this.valueFromPrx = valueFromPrx;
     this.defaultValue = defaultValue;
     this.setProperty("value",defaultValue);
 }
예제 #19
0
		public void TestPublicProperty()
		{
			a obj = new a();
			obj.PropertyA = "a";
			PropertyValue pt = new PropertyValue(obj, "PropertyA");

			Assert.AreEqual("PropertyA", pt.Name);
			Assert.AreEqual(typeof(string), pt.Type);
			Assert.AreEqual("a", pt.Value);
			pt.Value = "b";
			Assert.AreEqual("b", pt.Value);
		}
        public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
        {
            //get the property entry to model item converter
            IValueConverter converter = (ModelPropertyEntryToOwnerActivityConverter)EditorResources.GetResources()["ModelPropertyEntryToOwnerActivityConverter"];
            ModelItem item = (ModelItem)converter.Convert(propertyValue.ParentProperty, typeof(ModelItem), false, null);
            //we need editing context 
            EditingContext ctx = ((IModelTreeItem)item).ModelTreeManager.Context;
            //get the default dialog owner
            DependencyObject owner = ctx.Services.GetService<DesignerView>();

            //create and show dialog with owner, edited expression and context
            (new EditorDialog(owner, propertyValue, ctx, this.DialogTemplate, this.DialogTitle)).ShowOkCancel();
        }
예제 #21
0
		public void TestPublicField()
		{
			a obja = new a();
			b obj = new b();
			obj.PropertyA = "a";
			obj.publicField = obja;
			PropertyValue pt = new PropertyValue(obj, "publicField");

			Assert.AreEqual("publicField", pt.Name);
			Assert.AreEqual(typeof(ia), pt.Type);
			Assert.AreEqual(obja, pt.Value);
			pt.Value = new a();
			Assert.AreNotEqual(obja, pt.Value);
		}
예제 #22
0
        public void write_with_name_but_no_accessor()
        {
            var value = new PropertyValue()
            {
                Name = "Key1",
                Value = "Value1"
            };

            var writer = MockRepository.GenerateMock<IFlatFileWriter>();

            value.Write(writer);

            writer.AssertWasCalled(x => x.WriteProperty("Key1", "Value1"));
        }
 public override string getPropertyAbout(PropertyValue value, Ice.Current __current)
 {
     string[] stringSeq = ((StringSeqT)value).stringSeqValue;
     if(stringSeq.Length > 0)
     {
         string result = stringSeq[0];
         for(int i = 1;i<stringSeq.Length;i++)
         {
             result += "," + stringSeq[i];
         }
         return result;
     }
     else
         return "";
 }
예제 #24
0
 protected override PropertyValue<long> CaptureAreaCrop()
 {
     PropertyValue<long> res = new PropertyValue<long>()
     {
         Name = "Capture area crop",
         IsEnabled = true,
         Code = 0xD030,
         SubType = typeof(sbyte)
     };
     res.AddValues("DX", 0);
     res.AddValues("1.3x", 1);
     res.ValueChanged +=
         (sender, key, val) => SetProperty(CONST_CMD_SetDevicePropValue, BitConverter.GetBytes(val), res.Code);
     return res;
 }
예제 #25
0
        private void LoadProperties()
        {
            try
            {
                IsoNumber = new PropertyValue<int> {Available = false};
                FNumber = new PropertyValue<int> {Available = false};
                ExposureCompensation = new PropertyValue<int> {Available = false};
                FocusMode = new PropertyValue<long> {Available = false};
                ShutterSpeed = new PropertyValue<long> {Available = false};
                WhiteBalance = new PropertyValue<long> {Available = false};

                Properties.Add(AddNames("photo_size", "Photo size"));
                Properties.Add(AddNames("precise_selftime", "Capture delay"));
                Properties.Add(AddNames("burst_capture_number", "Burst capture number"));
                Properties.Add(AddNames("auto_low_light", "Auto low light"));
                
                AdvancedProperties.Add(AddNames("video_resolution", "Video resolution"));
                AdvancedProperties.Add(AddNames("led_mode", "Led mode"));
                AdvancedProperties.Add(AddNames("auto_power_off", "Auto power off"));
                AdvancedProperties.Add(AddNames("loop_record", "Loop record"));
                AdvancedProperties.Add(AddNames("warp_enable", "Lens correction"));
                AdvancedProperties.Add(AddNames("buzzer_ring", "Find device"));

                CompressionSetting.ValueChanged +=
                    (sender, key, val) => { Protocol.SendValue(CompressionSetting.Tag, key); };
                SendCommand(9, CompressionSetting.Tag);

                Mode.ValueChanged += Mode_ValueChanged;
                SendCommand(9, Mode.Tag);

                ExposureMeteringMode.ValueChanged +=
                    (sender, key, val) => { Protocol.SendValue(ExposureMeteringMode.Tag, key); };
                SendCommand(9, ExposureMeteringMode.Tag);

                foreach (var property in Properties)
                {
                    SendCommand(9, property.Tag);
                }
                foreach (var property in AdvancedProperties)
                {
                    SendCommand(9, property.Tag);
                }
            }
            catch (Exception ex)
            {
                Log.Error("Unable to load data", ex);
            }
        }
예제 #26
0
        public EntityRecord GetEntityRecord(Entity entity, params string[] key)
        {
            var keys = new object[key.Length];
            for (int i = 0; i < key.Length; i++)
            {
                keys[i] = new PropertyValue(entity.Keys[i]).ToObject(key[i]);
            }
            var item = GetRecord(entity, keys);
            if (item == null)
            {
                _notificator.Error(IlaroAdminResources.EntityNotExist);
                return null;
            }

            return entity.CreateRecord(item);
        }
예제 #27
0
        public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value)
        {
            var bookmark = collector.BeginBufferedArray();

            var count = 0;
            IEnumerable enumerable = (IEnumerable)value.ReferenceValue;
            if (enumerable != null)
            {
                foreach (var element in enumerable)
                {
                    this.elementInfo.WriteData(collector, elementInfo.PropertyValueFactory(element));
                    count++;
                }
            }

            collector.EndBufferedArray(bookmark, count);
        }
예제 #28
0
        public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value)
        {
            var bookmark = collector.BeginBufferedArray();

            var count = 0;
            Array array = (Array)value.ReferenceValue;
            if (array != null)
            {
                count = array.Length;
                for (int i = 0; i < array.Length; i++)
                {
                    this.elementInfo.WriteData(collector, elementInfo.PropertyValueFactory(array.GetValue(i)));
                }
            }

            collector.EndBufferedArray(bookmark, count);
        }
 public override PropertyValue run(PropertyValue valueBefore, BoxModulePrx boxModuleParam, String[] localePrefs, ManagersEnginePrx manager, out String about, Ice.Current __current)
 {
     Ferda.FrontEnd.StringSeqForm f = new Ferda.FrontEnd.StringSeqForm();
     f.Items = ((StringSeqTI)valueBefore).stringSeqValue;
     f.ShowInTaskbar = false;
     System.Windows.Forms.DialogResult result = this.ownerOfAddIn.ShowDialog(f);
     if(result == System.Windows.Forms.DialogResult.OK)
     {
         PropertyValue resultValue = new StringSeqTI(f.Items);
         about = this.getPropertyAbout(resultValue);
         return resultValue;
     }
     else
     {
         about = this.getPropertyAbout(valueBefore);
         return valueBefore;
     }
 }
 public PropertyBoxModuleFactoryI(string propertyClassIceId,
     string[] propertyFunctionsIceIds,
     BoxModuleFactoryCreatorPrx myFactoryCreatorProxy,
     string[] localePrefs,
     PropertyValue defaultValue,
     PropertyBoxModuleFactoryCreatorI.ValueFromPrx valueFromPrx,
     Ice.ObjectAdapter adapter,
     string settingModuleIdentifier)
 {
     this.propertyClassIceId = propertyClassIceId;
     this.propertyFunctionsIceIds = propertyFunctionsIceIds;
     //this.localePrefs = localePrefs;
     this.myFactoryCreatorProxy = myFactoryCreatorProxy;
     this.defaultValue = defaultValue;
     this.valueFromPrx = valueFromPrx;
     this.myProxy = BoxModuleFactoryPrxHelper.uncheckedCast(adapter.addWithUUID(this));
     this.settingModuleIdentifier = settingModuleIdentifier;
 }
예제 #31
0
 /// <summary>
 /// Returns true if property with the specified name is found in the ETAPU11Data class.
 /// </summary>
 /// <param name="property">The property name.</param>
 /// <returns>Returns true if property is found.</returns>
 public static bool IsProperty(string property) => PropertyValue.GetPropertyInfo(typeof(EM300LRData), property) != null;
예제 #32
0
 /// <summary>
 /// Returns the value for the property with the specified name.
 /// </summary>
 /// <param name="property">The property name.</param>
 /// <returns>The property value.</returns>
 public object GetPropertyValue(string property) => PropertyValue.GetPropertyValue(this, property);
예제 #33
0
        public void Render(Graphics g, PlotCollectionSet dataset, int nLookahead)
        {
            List <int> rgX              = m_gx.TickPositions;
            int        nStartIdx        = m_gx.StartPosition;
            int        nMinLevelVisible = 0;

            if (m_config.Properties != null)
            {
                PropertyValue prop = m_config.Properties.Find("MinLevelVisible");
                if (prop != null)
                {
                    nMinLevelVisible = (int)prop.Value;
                }
            }

            for (int i = nMinLevelVisible; i < 3; i++)
            {
                int nIdx = i * 2;

                if (nIdx + 1 >= dataset.Count)
                {
                    break;
                }

                PlotCollection plotsLow  = dataset[nIdx + 0];
                PlotCollection plotsHigh = dataset[nIdx + 1];

                if (plotsLow == null || plotsHigh == null)
                {
                    continue;
                }

                Pen   pHigh  = (i < 2) ? Pens.DarkGreen : Pens.DarkBlue;
                Pen   pLow   = (i < 2) ? Pens.DarkRed : Pens.Purple;
                Brush brHigh = (i < 1) ? Brushes.Lime : (i < 2) ? Brushes.Green : Brushes.Blue;
                Brush brLow  = (i < 1) ? Brushes.Red : (i < 2) ? Brushes.LightSalmon : Brushes.Fuchsia;

                for (int j = 0; j < rgX.Count; j++)
                {
                    int nIdx1 = nStartIdx + j;

                    if (nIdx1 < plotsLow.Count && nIdx1 < plotsHigh.Count)
                    {
                        Plot plotHigh = plotsHigh[nIdx1];
                        if (plotHigh.Active)
                        {
                            float fX = rgX[j];
                            float fY = m_gy.ScaleValue(plotHigh.Y, true);
                            drawPlot(TYPE.HIGH, i, g, fX, fY, pHigh, brHigh);
                        }

                        Plot plotLow = plotsLow[nIdx1];
                        if (plotLow.Active)
                        {
                            float fX = rgX[j];
                            float fY = m_gy.ScaleValue(plotLow.Y, true);
                            drawPlot(TYPE.LOW, i, g, fX, fY, pLow, brLow);
                        }
                    }
                }
            }
        }
예제 #34
0
 public DashedLineStyle(Color32 color, float width, float dashLength, float spaceLength) : base(color, width)
 {
     DashLength  = GetDashLengthProperty(dashLength);
     SpaceLength = GetSpaceLengthProperty(spaceLength);
 }
예제 #35
0
 public Line3DStyle(float width, float elevation) : base(default, width)
 {
     Elevation = GetElevationProperty(elevation);
 }
        public override void ShowDialog(PropertyValue propertyValue, IInputElement commandSource)
        {
            ModelPropertyEntryToOwnerActivityConverter ownerActivityConverter = new ModelPropertyEntryToOwnerActivityConverter();
            ModelItem activityItem = ownerActivityConverter.Convert(propertyValue.ParentProperty, typeof(ModelItem), false, null) as ModelItem;
            var       av           = activityItem.GetCurrentValue() as SendBusinessObjectsReportToEmail;
            var       currReportUn = string.Empty;

            if (av != null && av.Report_id != null)
            {
                var literal = av.Report_id.Expression as Literal <string>;
                if (literal == null)
                {
                    return;
                }
                currReportUn = literal.Value;
            }

            var dialog = new ReportBusinessObjectsIdDialog(activityItem);

            var lv = dialog.lvReports;

            lv.ItemsSource = null;
            List <Info_Report_Stimul> reports = null;

            try
            {
                reports = ServiceFactory.ArmServiceInvokeSync <List <Info_Report_Stimul> >("REP_GetStimulReports");
            }
            catch (Exception ex)
            {
                Manager.UI.ShowMessage(ex.Message);
                return;
            }

            if (reports == null)
            {
                return;
            }

            lv.ItemsSource = reports;

            if (!string.IsNullOrEmpty(currReportUn))
            {
                var selectedReport = reports.FirstOrDefault(r => r.Report_UN == currReportUn);
                if (selectedReport != null)
                {
                    lv.SelectedItem = selectedReport;
                }
            }


            if (dialog.ShowOkCancel())
            {
                var selectedReport = lv.SelectedItem as Info_Report_Stimul;
                if (selectedReport == null)
                {
                    return;
                }

                if (Equals(selectedReport.Report_UN, currReportUn))
                {
                    return;
                }

                propertyValue.Value = new InArgument <string>(selectedReport.Report_UN);
                if (!string.IsNullOrEmpty(currReportUn) && av != null && !string.IsNullOrEmpty(av.Args))
                {
                    Manager.UI.ShowMessage("Изменилась бизнес модель. Объекты для построения отчета необходимо выбрать заново!");
                    av.Args = string.Empty;
                }
            }
        }
예제 #37
0
 public PropertyValue(PropertyValue v)
 {
     val  = v.val;
     used = v.used;
 }
예제 #38
0
 public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value)
 {
     collector.AddScalar(value);
 }
 public PropertyReferenceProperty(ObjectSetBase objectSet, PropertyReference propertyReference, AttributeCollection attributes, PropertyValue parentValue, Type proxyType)
     : base(parentValue)
 {
     if (attributes == null)
     {
         DependencyPropertyReferenceStep propertyReferenceStep = propertyReference.LastStep as DependencyPropertyReferenceStep;
         if (propertyReferenceStep != null)
         {
             attributes = propertyReferenceStep.Attributes;
         }
     }
     this.proxyType         = proxyType;
     this.attributes        = attributes;
     this.objectSet         = objectSet;
     this.propertyReference = propertyReference;
     if (propertyReference.LastStep.IsAttachable)
     {
         this.SetName(propertyReference.LastStep.DeclaringType.Name + "." + propertyReference.LastStep.Name);
     }
     else
     {
         this.SetName(propertyReference.LastStep.Name);
     }
     this.InitializeConverter(this.PropertyName);
     this.InitializeValueEditorParameters();
     if (!JoltHelper.TypeHasEnumValues(this.PropertyTypeId))
     {
         return;
     }
     this.objectSet.DesignerContext.ProjectManager.ProjectOpened += new EventHandler <ProjectEventArgs>(this.ProjectManager_ProjectOpened);
 }
        /// <summary>
        /// Attempts to find a property on an objec using reflection attributes.
        /// </summary>
        /// <param name="value"></param>
        /// <param name="property"></param>
        /// <returns></returns>
        public static PropertyValue FindProperty(object value, string property)
        {
            PropertyValue actualProperty  = null;
            object        currentValue    = value;
            MemberInfo    currentProperty = null;
            int           lastIndex       = 0;

            if (value != null)
            {
                PropertyPart[] parts    = SplitPropertyName(property);
                int            position = 0;
                while ((position < parts.Length) && (currentValue != null))
                {
                    actualProperty = null;
                    if (currentProperty != null)
                    {
                        currentValue    = GetValue(currentProperty, currentValue);
                        currentProperty = null;
                    }

                    var curValue = currentValue as IEnumerable;
                    if (curValue != null)
                    {
                        currentValue = FindTypedValue(curValue, parts[position].Name);
                    }
                    else
                    {
                        currentProperty = FindActualProperty(currentValue, parts[position].Name);
                        if (!string.IsNullOrEmpty(parts[position].KeyName))
                        {
                            IEnumerable values = GetValue(currentProperty, currentValue) as IEnumerable;
                            currentValue    = FindKeyedValue(values, parts[position].KeyName, parts[position].KeyValue);
                            currentProperty = null;
                        }
                        else if (parts[position].Index >= 0)
                        {
                            // If the current item is expecting an indexed value then treat the source as an array
                            Array values = GetValue(currentProperty, currentValue) as Array;
                            if (values != null)
                            {
                                lastIndex = parts[position].Index;
                                if (lastIndex < values.GetLength(0))
                                {
                                    // Generate the property here, it will get wiped later if there are further parts
                                    actualProperty  = new PropertyValue(currentValue, currentProperty, lastIndex);
                                    currentValue    = values.GetValue(lastIndex);
                                    currentProperty = null;
                                }
                            }
                            currentProperty = null;
                        }
                    }

                    position++;
                }
                if (currentProperty != null)
                {
                    actualProperty = new PropertyValue(currentValue, currentProperty, lastIndex);
                }
            }

            return(actualProperty);
        }
예제 #41
0
 /// <summary>
 ///   Initializes a new instance of the <see cref = "PropertyValueDescriptor" /> class.
 /// </summary>
 /// <param name = "propertyValue">The property value.</param>
 public PropertyValueDescriptor(PropertyValue propertyValue)
     : base(propertyValue.Name, new Attribute[0])
 {
     CustomField    = propertyValue;
     _componentType = typeof(PublishableDomainObject);
 }
 /// <summary>
 /// Refer to TraceLoggingTypeInfo.WriteObjectData for information about this
 /// method.
 /// </summary>
 /// <param name="collector">
 /// Refer to TraceLoggingTypeInfo.WriteObjectData for information about this
 /// method.
 /// </param>
 /// <param name="value">
 /// Refer to TraceLoggingTypeInfo.WriteObjectData for information about this
 /// method.
 /// </param>
 public abstract void WriteData(
     TraceLoggingDataCollector collector,
     PropertyValue value);
예제 #43
0
 public SimpleSearchCondition(PropertyValue propertyValueDelegate,
                              AutomationElementProperty automationElementProperty)
 {
     this.propertyValueDelegate     = propertyValueDelegate;
     this.automationElementProperty = automationElementProperty;
 }
예제 #44
0
		private void EndGroup()
		{
			RtfDestination destination = this.state.Destination;
			switch (destination)
			{
			case RtfDestination.Field:
				if (this.state.ParentDestination != RtfDestination.Field)
				{
					this.skipFieldResult = false;
					if (this.includePictureField)
					{
						PropertyValue propertyValue = new PropertyValue(LengthUnits.Twips, this.pictureHeight);
						PropertyValue propertyValue2 = new PropertyValue(LengthUnits.Twips, this.pictureWidth);
						this.output.OutputImage(this.imageUrl, this.imageAltText, propertyValue2.PixelsInteger, propertyValue.PixelsInteger);
						this.includePictureField = false;
						this.imageUrl = null;
						this.imageAltText = null;
						return;
					}
					if (this.hyperLinkActive)
					{
						if (!this.urlCompareSink.IsMatch)
						{
							this.output.CloseAnchor();
						}
						else
						{
							this.output.CancelAnchor();
						}
						this.hyperLinkActive = false;
					}
				}
				break;
			case RtfDestination.FieldResult:
				break;
			case RtfDestination.FieldInstruction:
				if (this.state.ParentDestination == RtfDestination.Field)
				{
					bool flag;
					BufferString bufferString;
					TextMapping textMapping;
					char ucs32Literal;
					short num;
					if (RtfSupport.IsHyperlinkField(ref this.scratch, out flag, out bufferString))
					{
						if (!flag)
						{
							if (this.hyperLinkActive)
							{
								if (!this.urlCompareSink.IsMatch)
								{
									this.output.CloseAnchor();
								}
								else
								{
									this.output.CancelAnchor();
								}
								this.hyperLinkActive = false;
								this.urlCompareSink.Reset();
							}
							bufferString.TrimWhitespace();
							if (bufferString.Length != 0)
							{
								string text = bufferString.ToString();
								this.output.OpenAnchor(text);
								this.hyperLinkActive = true;
								if (this.urlCompareSink == null)
								{
									this.urlCompareSink = new UrlCompareSink();
								}
								this.urlCompareSink.Initialize(text);
							}
						}
					}
					else if (RtfSupport.IsIncludePictureField(ref this.scratch, out bufferString))
					{
						bufferString.TrimWhitespace();
						if (bufferString.Length != 0)
						{
							this.includePictureField = true;
							bufferString.TrimWhitespace();
							if (bufferString.Length != 0)
							{
								this.imageUrl = bufferString.ToString();
							}
							this.pictureWidth = 0;
							this.pictureHeight = 0;
						}
					}
					else if (RtfSupport.IsSymbolField(ref this.scratch, out textMapping, out ucs32Literal, out num))
					{
						if (this.output.LineEmpty && this.lineIndent >= 120 && this.lineIndent < 7200)
						{
							this.output.OutputSpace(this.lineIndent / 120);
						}
						this.output.OutputNonspace((int)ucs32Literal, textMapping);
						this.skipFieldResult = true;
					}
					this.scratch.Reset();
					return;
				}
				break;
			default:
				switch (destination)
				{
				case RtfDestination.Picture:
					if (this.state.ParentDestination != RtfDestination.Picture && !this.includePictureField)
					{
						PropertyValue propertyValue3 = new PropertyValue(LengthUnits.Twips, this.pictureHeight);
						PropertyValue propertyValue4 = new PropertyValue(LengthUnits.Twips, this.pictureWidth);
						this.output.OutputImage(null, null, propertyValue4.PixelsInteger, propertyValue3.PixelsInteger);
						return;
					}
					break;
				case RtfDestination.PictureProperties:
					break;
				case RtfDestination.ShapeName:
					if (this.state.ParentDestination != RtfDestination.ShapeName)
					{
						BufferString bufferString2 = this.scratch.BufferString;
						bufferString2.TrimWhitespace();
						this.descriptionProperty = bufferString2.EqualsToLowerCaseStringIgnoreCase("wzdescription");
						this.scratch.Reset();
						return;
					}
					break;
				case RtfDestination.ShapeValue:
					if (this.state.ParentDestination != RtfDestination.ShapeValue && this.descriptionProperty)
					{
						BufferString bufferString3 = this.scratch.BufferString;
						bufferString3.TrimWhitespace();
						if (bufferString3.Length != 0)
						{
							this.imageAltText = bufferString3.ToString();
						}
						this.scratch.Reset();
						return;
					}
					break;
				default:
					return;
				}
				break;
			}
		}
예제 #45
0
 public override void WriteData(PropertyValue value)
 {
 }
예제 #46
0
 public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value)
 {
     collector.AddScalar((double)value.ScalarValue.AsDecimal);
 }
예제 #47
0
        public void setProperty(string key, string val)
        {
            //
            // Trim whitespace
            //
            if (key != null)
            {
                key = key.Trim();
            }
            if (key == null || key.Length == 0)
            {
                throw new Ice.InitializationException("Attempt to set property with empty key");
            }

            //
            // Check if the property is legal.
            //
            Logger logger = Ice.Util.getProcessLogger();
            int    dotPos = key.IndexOf('.');

            if (dotPos != -1)
            {
                string prefix = key.Substring(0, dotPos);
                for (int i = 0; IceInternal.PropertyNames.validProps[i] != null; ++i)
                {
                    string pattern = IceInternal.PropertyNames.validProps[i][0].pattern();
                    dotPos = pattern.IndexOf('.');
                    Debug.Assert(dotPos != -1);
                    string propPrefix   = pattern.Substring(1, dotPos - 2);
                    bool   mismatchCase = false;
                    string otherKey     = "";
                    if (!propPrefix.ToUpper().Equals(prefix.ToUpper()))
                    {
                        continue;
                    }

                    bool found = false;
                    for (int j = 0; IceInternal.PropertyNames.validProps[i][j] != null && !found; ++j)
                    {
                        Regex r = new Regex(IceInternal.PropertyNames.validProps[i][j].pattern());
                        Match m = r.Match(key);
                        found = m.Success;
                        if (found && IceInternal.PropertyNames.validProps[i][j].deprecated())
                        {
                            logger.warning("deprecated property: " + key);
                            if (IceInternal.PropertyNames.validProps[i][j].deprecatedBy() != null)
                            {
                                key = IceInternal.PropertyNames.validProps[i][j].deprecatedBy();
                            }
                        }

                        if (!found)
                        {
                            r = new Regex(IceInternal.PropertyNames.validProps[i][j].pattern().ToUpper());
                            m = r.Match(key.ToUpper());
                            if (m.Success)
                            {
                                found        = true;
                                mismatchCase = true;
                                otherKey     = IceInternal.PropertyNames.validProps[i][j].pattern().Replace("\\", "").
                                               Replace("^", "").
                                               Replace("$", "");
                                break;
                            }
                        }
                    }
                    if (!found)
                    {
                        logger.warning("unknown property: " + key);
                    }
                    else if (mismatchCase)
                    {
                        logger.warning("unknown property: `" + key + "'; did you mean `" + otherKey + "'");
                    }
                }
            }

            lock (this)
            {
                //
                //
                // Set or clear the property.
                //
                if (val != null && val.Length > 0)
                {
                    PropertyValue pv;
                    if (_properties.TryGetValue(key, out pv))
                    {
                        pv.val = val;
                    }
                    else
                    {
                        pv = new PropertyValue(val, false);
                    }
                    _properties[key] = pv;
                }
                else
                {
                    _properties.Remove(key);
                }
            }
        }
예제 #48
0
 public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value)
 {
     return;
 }
예제 #49
0
        public static void SetProperty(global::System.Runtime.InteropServices.HandleRef handle, int index, PropertyValue propertyValue)
        {
            if (handle.Handle == System.IntPtr.Zero)
            {
                throw new System.InvalidOperationException("Error! NUI's native dali object is already disposed. OR the native dali object handle of NUI becomes null!");
            }

            Interop.Handle.Handle_SetProperty(handle, index, PropertyValue.getCPtr(propertyValue));
            if (NDalicPINVOKE.SWIGPendingException.Pending)
            {
                throw NDalicPINVOKE.SWIGPendingException.Retrieve();
            }
        }
예제 #50
0
 public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value)
 {
     collector.AddScalar(value.ScalarValue.AsTimeSpan.Ticks);
 }
예제 #51
0
        /// <summary>
        /// Compose the out visual map.
        /// </summary>
        /// <since_tizen> 3 </since_tizen>
        protected override void ComposingPropertyMap()
        {
            if (((_startPosition != null && _endPosition != null) || (_center != null && _radius != null)) && _stopColor != null)
            {
                _outputVisualMap = new PropertyMap();
                PropertyValue temp = new PropertyValue((int)Visual.Type.Gradient);
                _outputVisualMap.Add(Visual.Property.Type, temp);
                temp.Dispose();

                temp = new PropertyValue(_stopColor);
                _outputVisualMap.Add(GradientVisualProperty.StopColor, temp);
                temp.Dispose();

                if (_startPosition != null)
                {
                    temp = new PropertyValue(_startPosition);
                    _outputVisualMap.Add(GradientVisualProperty.StartPosition, temp);
                    temp.Dispose();
                }

                if (_endPosition != null)
                {
                    temp = new PropertyValue(_endPosition);
                    _outputVisualMap.Add(GradientVisualProperty.EndPosition, temp);
                    temp.Dispose();
                }

                if (_center != null)
                {
                    temp = new PropertyValue(_center);
                    _outputVisualMap.Add(GradientVisualProperty.Center, temp);
                    temp.Dispose();
                }

                if (_radius != null)
                {
                    temp = new PropertyValue((float)_radius);
                    _outputVisualMap.Add(GradientVisualProperty.Radius, temp);
                    temp.Dispose();
                }

                if (_stopOffset != null)
                {
                    temp = new PropertyValue(_stopOffset);
                    _outputVisualMap.Add(GradientVisualProperty.StopOffset, temp);
                    temp.Dispose();
                }

                if (_units != null)
                {
                    temp = new PropertyValue((int)_units);
                    _outputVisualMap.Add(GradientVisualProperty.Units, temp);
                    temp.Dispose();
                }

                if (_spreadMethod != null)
                {
                    temp = new PropertyValue((int)_spreadMethod);
                    _outputVisualMap.Add(GradientVisualProperty.SpreadMethod, temp);
                    temp.Dispose();
                }
                base.ComposingPropertyMap();
            }
        }
예제 #52
0
 public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value)
 {
     collector.AddNullTerminatedString((string?)value.ReferenceValue);
 }
예제 #53
0
        protected override SqlCommand[] BuildCreateTableCommands(ISyntaxProvider syntax, EntityMetadata metadata)
        {
            var sb = new StringBuilder();

            sb.AppendFormat("create table {0}\n(\n", metadata.TableName);

            //获取实体类型中所有可持久化的属性,不包含引用类型的属性
            var properties        = PropertyUnity.GetPersistentProperties(metadata.EntityType).ToArray();
            var primaryPeoperties = PropertyUnity.GetPrimaryProperties(metadata.EntityType).ToArray();
            var count             = properties.Length;

            for (var i = 0; i < count; i++)
            {
                var property = properties[i];
                sb.AppendFormat(" {0}", property.Info.FieldName);

                //数据类型及长度精度等
                sb.AppendFormat(" {0}", syntax.Column((DbType)property.Info.DataType,
                                                      property.Info.Length,
                                                      property.Info.Precision,
                                                      property.Info.Scale));

                //自增
                if (property.Info.GenerateType == IdentityGenerateType.AutoIncrement &&
                    !string.IsNullOrEmpty(syntax.IdentityColumn))
                {
                    sb.AppendFormat(" {0}", syntax.IdentityColumn);
                }

                //不可空
                if (!property.Info.IsNullable)
                {
                    sb.AppendFormat(" not null");
                }

                //默认值
                if (!PropertyValue.IsEmpty(property.Info.DefaultValue))
                {
                    if (property.Type == typeof(string))
                    {
                        sb.AppendFormat(" default '{0}'", property.Info.DefaultValue);
                    }
                    else if (property.Type.IsEnum)
                    {
                        sb.AppendFormat(" default {0}", (int)property.Info.DefaultValue);
                    }
                    else if (property.Type == typeof(bool) || property.Type == typeof(bool?))
                    {
                        sb.AppendFormat(" default {0}", (bool)property.Info.DefaultValue ? 1 : 0);
                    }
                    else
                    {
                        sb.AppendFormat(" default {0}", property.Info.DefaultValue);
                    }
                }

                if (i != count - 1)
                {
                    sb.Append(",");
                }

                sb.AppendLine();
            }

            //主键
            if (primaryPeoperties.Length > 0)
            {
                sb.Append(",");
                sb.AppendFormat("constraint PK_{0} primary key (", metadata.TableName);

                for (var i = 0; i < primaryPeoperties.Length; i++)
                {
                    if (i != 0)
                    {
                        sb.Append(",");
                    }

                    sb.Append(primaryPeoperties[i].Info.FieldName);
                }

                sb.Append(")");
            }

            sb.Append(");\n");

            return(new SqlCommand[] { sb.ToString() });
        }
예제 #54
0
 public override void WriteData(TraceLoggingDataCollector collector, PropertyValue value)
 {
     collector.AddArray(value, elementSize);
 }
예제 #55
0
 /// <summary>
 /// Sets the value for the property with the specified name.
 /// </summary>
 /// <param name="property">The property name.</param>
 /// <param name="value">The property value.</param>
 public void SetPropertyValue(string property, object value) => PropertyValue.SetPropertyValue(this, property, value);
예제 #56
0
        private ComponentProperty ReadPropertyNode(XElement propertyElement, LoadContext lc)
        {
            IXmlLineInfo elementLine = propertyElement as IXmlLineInfo;

            string propertyName = propertyElement.Attribute("name").Value;
            string type         = propertyElement.Attribute("type").Value;
            string defaultValue = propertyElement.Attribute("default").Value;
            string serializeAs  = propertyElement.Attribute("serialize").Value;
            string display      = propertyElement.Attribute("display").Value;

            PropertyType propertyType;

            switch (type.ToLowerInvariant())
            {
            case "double":
                propertyType = PropertyType.Decimal;
                if (lc.FormatVersion >= new Version(1, 2))
                {
                    lc.Errors.Add(new LoadError(lc.FileName, elementLine.LineNumber, elementLine.LinePosition, LoadErrorCategory.Warning,
                                                "Property type 'double' is deprecated, use 'decimal' instead"));
                }
                break;

            case "decimal":
                propertyType = PropertyType.Decimal;
                break;

            case "int":
                propertyType = PropertyType.Integer;
                break;

            case "bool":
                propertyType = PropertyType.Boolean;
                break;

            default:
                propertyType = PropertyType.String;
                break;
            }

            var propertyDefaultValue = PropertyValue.Parse(defaultValue, propertyType.ToPropertyType());

            List <string> propertyOptions = null;

            if (type == "enum")
            {
                propertyOptions = new List <string>();
                var optionNodes = propertyElement.Elements(ComponentNamespace + "option");
                foreach (var optionNode in optionNodes)
                {
                    propertyOptions.Add(optionNode.Value);
                }
            }

            List <ComponentPropertyFormat> formatRules = new List <ComponentPropertyFormat>();

            if (propertyElement.Attribute("format") != null)
            {
                formatRules.Add(new ComponentPropertyFormat(propertyElement.Attribute("format").Value, ConditionTree.Empty));
            }
            else
            {
                var formatRuleNodes = propertyElement.Elements(ComponentNamespace + "formatting")
                                      .SelectMany(x => x.Elements(ComponentNamespace + "format"));
                foreach (var formatNode in formatRuleNodes)
                {
                    IXmlLineInfo line = formatNode as IXmlLineInfo;

                    IConditionTreeItem conditionCollection = ConditionTree.Empty;
                    if (formatNode.Attribute("conditions") != null)
                    {
                        try
                        {
                            conditionCollection = lc.ConditionParser.Parse(formatNode.Attribute("conditions").Value, lc.ParseContext);
                        }
                        catch (ConditionFormatException ex)
                        {
                            lc.Errors.Add(new LoadError(lc.FileName, line.LineNumber, line.LinePosition + formatNode.Name.LocalName.Length + 2 + ex.PositionStart, LoadErrorCategory.Error, ex.Message));
                            return(null);
                        }
                    }

                    formatRules.Add(new ComponentPropertyFormat(formatNode.Attribute("value").Value, conditionCollection));
                }
            }

            Dictionary <PropertyOtherConditionType, IConditionTreeItem> otherConditions = new Dictionary <PropertyOtherConditionType, IConditionTreeItem>();
            var otherConditionsNodes = propertyElement.Elements(ComponentNamespace + "other")
                                       .SelectMany(x => x.Elements(ComponentNamespace + "conditions"));

            foreach (var otherConditionNode in otherConditionsNodes)
            {
                if (otherConditionNode != null && otherConditionNode.Attribute("for") != null && otherConditionNode.Attribute("value") != null)
                {
                    IXmlLineInfo line = otherConditionNode as IXmlLineInfo;

                    string             conditionsFor    = otherConditionNode.Attribute("for").Value;
                    string             conditionsString = otherConditionNode.Attribute("value").Value;
                    IConditionTreeItem conditionCollection;

                    try
                    {
                        conditionCollection = lc.ConditionParser.Parse(conditionsString, lc.ParseContext);
                    }
                    catch (ConditionFormatException ex)
                    {
                        lc.Errors.Add(new LoadError(lc.FileName, line.LineNumber, line.LinePosition + otherConditionNode.Name.LocalName.Length + 2 + ex.PositionStart, LoadErrorCategory.Error, ex.Message));
                        return(null);
                    }

                    if (Enum.IsDefined(typeof(PropertyOtherConditionType), conditionsFor))
                    {
                        otherConditions.Add((PropertyOtherConditionType)Enum.Parse(typeof(PropertyOtherConditionType), conditionsFor, true), conditionCollection);
                    }
                }
            }

            ComponentProperty property = new ComponentProperty(propertyName, serializeAs, display, propertyType, propertyDefaultValue, formatRules.ToArray(), otherConditions, (propertyOptions == null ? null : propertyOptions.ToArray()));

            return(property);
        }
예제 #57
0
 /// <summary>
 /// Returns the <see cref="PropertyInfo"/> data for the property with the specified name.
 /// </summary>
 /// <param name="property">The property name.</param>
 /// <returns>The property info.</returns>
 public static PropertyInfo GetPropertyInfo(string property) => PropertyValue.GetPropertyInfo(typeof(EM300LRData), property);
예제 #58
0
        private string GetSecureNotice(EventHandlerEnvironment env)
        {
            ReportInput input = new ReportInput();

            Writelog(env.Input + "GetSecureNotice :");
            try
            {
                input = JsonConvert.DeserializeObject <ReportInput>(env.Input);
            }
            catch (Exception ex)
            {
                Writelog(env.Input + "GetSecureNotice error:" + ex.Message);
                return(JsonConvert.SerializeObject("-1", Formatting.None));
            }
            #region search issuenotice
            var conditions = new SearchConditions();
            {
                var condition = new SearchCondition();
                condition.ConditionType = MFConditionType.MFConditionTypeEqual;
                condition.Expression.DataPropertyValuePropertyDef = (int)MFBuiltInPropertyDef.MFBuiltInPropertyDefClass;
                condition.TypedValue.SetValueToLookup(new Lookup {
                    Item = ClassSecureNotice.ID
                });
                conditions.Add(-1, condition);
            }
            {
                var condition = new SearchCondition();
                condition.ConditionType = MFConditionType.MFConditionTypeGreaterThanOrEqual;
                condition.Expression.DataPropertyValuePropertyDef = PropCheckDate.ID;
                condition.TypedValue.SetValue(MFDataType.MFDatatypeDate, input.startDate);
                conditions.Add(-1, condition);
            }
            {
                var condition = new SearchCondition();
                condition.ConditionType = MFConditionType.MFConditionTypeLessThanOrEqual;
                condition.Expression.DataPropertyValuePropertyDef = PropCheckDate.ID;
                condition.TypedValue.SetValue(MFDataType.MFDatatypeDate, input.endDate);
                conditions.Add(-1, condition);
            }
            if (input.principal != 0)
            {
                var condition = new SearchCondition();

                condition.ConditionType = MFConditionType.MFConditionTypeEqual;
                condition.Expression.DataPropertyValuePropertyDef = PropPrincipal.ID;
                condition.TypedValue.SetValueToLookup(new Lookup {
                    Item = input.principal
                });
                conditions.Add(-1, condition);
            }
            if (input.receiver != 0)
            {
                var condition = new SearchCondition();

                condition.ConditionType = MFConditionType.MFConditionTypeEqual;
                condition.Expression.DataPropertyValuePropertyDef = PropSecureReceiver.ID;
                condition.TypedValue.SetValueToLookup(new Lookup {
                    Item = input.receiver
                });
                conditions.Add(-1, condition);
            }
            var allwork = env.Vault.ObjectSearchOperations.SearchForObjectsByConditionsEx(conditions,
                                                                                          MFSearchFlags.MFSearchFlagNone, false, 0, 0).GetAsObjectVersions();
            #endregion search issuenotice

            var templatefile = GetTemplateFile(env);
            if (string.IsNullOrEmpty(templatefile))
            {
                return(JsonConvert.SerializeObject("-2", Formatting.None));
            }
            try
            {
                var app    = new Microsoft.Office.Interop.Word.Application();
                var unknow = Type.Missing;
                //  var msocoding = MsoEncoding.msoEncodingSimplifiedChineseGB18030;
                var doc = app.Documents.Open(templatefile,
                                             ref unknow, false, ref unknow, ref unknow, ref unknow,
                                             //        ref unknow, ref unknow, ref unknow, ref unknow, msocoding,
                                             ref unknow, ref unknow, ref unknow, ref unknow, ref unknow,
                                             ref unknow, ref unknow, ref unknow, ref unknow, ref unknow);
                //var num = 0;
                //foreach (Table table in doc.Tables)
                //{
                //    Writelog(string.Format("table[{0}],Columns[{1}],,Rows[{2}]", num, table.Columns.Count, table.Rows.Count));
                //    for (int i = 0; i < table.Columns.Count; i++)
                //    {
                //        for (int j = 0; j < table.Rows.Count; j++)
                //        {
                //            try
                //            {
                //                var text = table.Cell(j, i).Range.Text;

                //                Writelog(string.Format("table[{0}],Columns[{1}],Rows[{2}],text[{3}]", num, i, j, text));
                //            }
                //            catch (Exception ex)
                //            {
                //                Writelog(string.Format("table[{0}],Columns[{1}],Rows[{2}],message[{3}]", num, i, j, ex.Message));
                //            }
                //        }
                //    }
                //    num++;
                //}
                //Writelog("num=" + num);


                var page       = 0;
                var tableindex = 0;
                var temppath   = System.IO.Path.GetTempPath();
                doc.Tables[1].Range.Copy();
                var issuename       = string.Empty;
                var secureissuename = string.Empty;

                foreach (ObjectVersion objectVersion in allwork)
                {
                    if (page > 0)
                    {
                        doc.Content.InsertParagraphAfter();
                        doc.Content.InsertAfter(" ");
                        object WdLine   = Microsoft.Office.Interop.Word.WdUnits.wdLine; //换一行;
                        var    movedown = app.Selection.MoveDown(ref WdLine, 21);       //移动焦点
                        Writelog(string.Format(" before paste table num=[{0}],count=[{1}],down==[{2}]", doc.Tables.Count.ToString(), movedown));
                        app.Selection.Paste();
                    }

                    var onepvs = env.Vault.ObjectPropertyOperations.GetProperties(objectVersion.ObjVer);
                    page++;
                    tableindex++;
                    issuename = onepvs.SearchForProperty(0).GetValueAsLocalizedText();

                    doc.Tables[tableindex].Cell(4, 2).Range.Text = issuename;
                    doc.Tables[tableindex].Cell(4, 4).Range.Text = DateTime.Now.ToShortDateString();
                    doc.Tables[tableindex].Cell(4, 6).Range.Text = page.ToString();
                    doc.Tables[tableindex].Cell(0, 1).Range.Text = "整改期限:" + onepvs.SearchForProperty(PropZhengGaiQiXin.ID).GetValueAsLocalizedText();
                    doc.Tables[tableindex].Cell(0, 2).Range.Text = "接收人:" + onepvs.SearchForProperty(PropSecureReceiver.ID).GetValueAsLocalizedText();
                    doc.Tables[tableindex].Cell(0, 3).Range.Text = "检查负责人:" + onepvs.SearchForProperty(PropPrincipal.ID).GetValueAsLocalizedText();
                    doc.Tables[tableindex].Cell(0, 4).Range.Text = "复查人:" + onepvs.SearchForProperty(PropFuChaRen.ID).GetValueAsLocalizedText();

                    var serial = 1;
                    var lus    = onepvs.SearchForProperty(PropSecureIssues.ID).Value.GetValueAsLookups();
                    foreach (Lookup lookup in lus)
                    {
                        var rowindex = 6 + serial;
                        var objid    = new ObjID();
                        objid.SetIDs(OtSecureIssue.ID, lookup.Item);
                        var issuepvs = env.Vault.ObjectOperations.GetLatestObjectVersionAndProperties(objid, true).Properties;
                        secureissuename = issuepvs.SearchForProperty(0).GetValueAsLocalizedText();
                        doc.Tables[tableindex].Cell(rowindex, 1).Range.Text = serial.ToString();
                        doc.Tables[tableindex].Cell(rowindex, 2).Range.Text = secureissuename;
                        doc.Tables[tableindex].Cell(rowindex, 3).Range.Text = issuepvs.SearchForProperty(PropAdjustMeasure.ID).GetValueAsLocalizedText();
                        doc.Tables[tableindex].Cell(rowindex, 4).Range.Text = issuepvs.SearchForProperty(PropAdjustMan.ID).GetValueAsLocalizedText();
                        doc.Tables[tableindex].Cell(rowindex, 5).Range.Text = issuepvs.SearchForProperty(PropSecureAdjustDate.ID).GetValueAsLocalizedText();

                        var beforepictures = issuepvs.SearchForProperty(PropBeforePictures.ID).Value.GetValueAsLookups();
                        foreach (Lookup beforepicture in beforepictures)
                        {
                            var objver =
                                env.Vault.ObjectOperations.GetLatestObjVer(
                                    new ObjID {
                                ID = beforepicture.Item, Type = beforepicture.ObjectType
                            }, true);
                            var files = env.Vault.ObjectFileOperations.GetFiles(objver);
                            foreach (ObjectFile objectFile in files)
                            {
                                var apicture = temppath + objectFile.GetNameForFileSystem();
                                env.Vault.ObjectFileOperations.DownloadFile(objectFile.ID,
                                                                            objectFile.Version, apicture);
                                object unite   = Microsoft.Office.Interop.Word.WdUnits.wdStory;
                                object nothing = System.Reflection.Missing.Value;
                                //    doc.Content.InsertParagraphAfter();
                                doc.Content.InsertAfter(string.Format("{3}安全隐患整改名称:{0},{3}安全问题名称:{1},{3}整改前照片名称:{2}{3}", issuename, secureissuename, beforepicture.DisplayValue, Environment.NewLine));
                                app.Selection.EndKey(ref unite, ref nothing);//将光标移至文末

                                object LinkToFile       = false;
                                object SaveWithDocument = true;
                                object Anchor           = app.Selection.Range;

                                doc.InlineShapes.AddPicture(apicture, ref LinkToFile, ref SaveWithDocument, ref Anchor);
                            }
                        }

                        var afterpictures = issuepvs.SearchForProperty(PropAfterPictures.ID).Value.GetValueAsLookups();
                        foreach (Lookup after in afterpictures)
                        {
                            var objver =
                                env.Vault.ObjectOperations.GetLatestObjVer(
                                    new ObjID {
                                ID = after.Item, Type = after.ObjectType
                            }, true);
                            var files = env.Vault.ObjectFileOperations.GetFiles(objver);
                            foreach (ObjectFile objectFile in files)
                            {
                                var apicture = temppath + objectFile.GetNameForFileSystem();
                                env.Vault.ObjectFileOperations.DownloadFile(objectFile.ID,
                                                                            objectFile.Version, apicture);
                                object unite   = Microsoft.Office.Interop.Word.WdUnits.wdStory;
                                object nothing = System.Reflection.Missing.Value;
                                //      doc.Content.InsertParagraphAfter();
                                doc.Content.InsertAfter(string.Format("{3}安全隐患整改名称:{0},{3}安全问题名称:{1},{3}复查现场照片名称:{2}{3}", issuename, secureissuename, after.DisplayValue, Environment.NewLine));
                                app.Selection.EndKey(ref unite, ref nothing);//将光标移至文末

                                object LinkToFile       = false;
                                object SaveWithDocument = true;
                                object Anchor           = app.Selection.Range;

                                doc.InlineShapes.AddPicture(apicture, ref LinkToFile, ref SaveWithDocument, ref Anchor);
                            }
                        }

                        serial++;
                        if (serial > 12)
                        {
                            doc.Content.InsertParagraphAfter();
                            doc.Content.InsertAfter(" ");
                            object WdLine   = Microsoft.Office.Interop.Word.WdUnits.wdLine; //换一行;
                            var    movedown = app.Selection.MoveDown(ref WdLine, 21);       //移动焦点
                            Writelog(string.Format(" before paste table num=[{0}],count=[{1}],down==[{2}]", doc.Tables.Count.ToString(), movedown));
                            app.Selection.Paste();
                            page++;
                            tableindex++;
                            doc.Tables[tableindex].Cell(4, 2).Range.Text = "project name";
                            doc.Tables[tableindex].Cell(4, 4).Range.Text = DateTime.Now.ToShortDateString();
                            doc.Tables[tableindex].Cell(4, 6).Range.Text = page.ToString();
                            doc.Tables[tableindex].Cell(0, 1).Range.Text = "整改期限:" + onepvs.SearchForProperty(PropZhengGaiQiXin.ID).GetValueAsLocalizedText();
                            doc.Tables[tableindex].Cell(0, 2).Range.Text = "接收人:" + onepvs.SearchForProperty(PropSecureReceiver.ID).GetValueAsLocalizedText();
                            doc.Tables[tableindex].Cell(0, 3).Range.Text = "检查负责人:" + onepvs.SearchForProperty(PropPrincipal.ID).GetValueAsLocalizedText();
                            doc.Tables[tableindex].Cell(0, 4).Range.Text = "复查人:" + onepvs.SearchForProperty(PropFuChaRen.ID).GetValueAsLocalizedText();
                        }
                    }
                }

                doc.Close();
                app.Quit();
            }
            catch (Exception ex)
            {
                Writelog(ex.Message);
            }


            var pvs = new PropertyValues();
            var pv  = new PropertyValue();
            pv.PropertyDef = 0;
            pv.Value.SetValue(MFDataType.MFDatatypeText, "securenoticereport");
            pvs.Add(-1, pv);
            pv.PropertyDef = 100;
            pv.Value.SetValueToLookup(new Lookup {
                Item = ClassSecureReport
            });
            pvs.Add(-1, pv);
            var file = new SourceObjectFile();
            file.Title          = "report";
            file.SourceFilePath = templatefile;
            file.Extension      = "docx";

            var t   = env.Vault.ObjectOperations.CreateNewSFDObject(0, pvs, file, true);
            var f   = env.Vault.ObjectFileOperations.GetFiles(t.ObjVer);
            var rpd = new ReportPrintData();
            rpd.objid       = t.ObjVer.ID;
            rpd.objtype     = t.ObjVer.Type;
            rpd.objversion  = t.ObjVer.Version;
            rpd.fileid      = f[1].FileVer.ID;
            rpd.fileversion = f[1].FileVer.Version;

            return(JsonConvert.SerializeObject(rpd, Formatting.None));
        }
예제 #59
0
        /// <summary>
        /// Adds a group visual animation (transition) map with the input parameters.
        /// </summary>
        /// <param name="target">The visual map to animation.</param>
        /// <param name="property">The property of visual to animation.</param>
        /// <param name="destinationValue">The destination value of property after animation.</param>
        /// <param name="startTime">The start time of visual animation.</param>
        /// <param name="endTime">The end time of visual animation.</param>
        /// <param name="alphaFunction">The alpha function of visual animation.</param>
        /// <param name="initialValue">The initial property value of visual animation.</param>
        /// <since_tizen> 3 </since_tizen>
        public void AnimateVisualAdd(VisualMap target, string property, object destinationValue, int startTime, int endTime, AlphaFunction.BuiltinFunctions?alphaFunction = null, object initialValue = null)
        {
            string _alphaFunction = null;

            if (alphaFunction != null)
            {
                switch (alphaFunction)
                {
                case Tizen.NUI.AlphaFunction.BuiltinFunctions.Linear:
                {
                    _alphaFunction = "LINEAR";
                    break;
                }

                case Tizen.NUI.AlphaFunction.BuiltinFunctions.Reverse:
                {
                    _alphaFunction = "REVERSE";
                    break;
                }

                case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSquare:
                {
                    _alphaFunction = "EASE_IN_SQUARE";
                    break;
                }

                case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSquare:
                {
                    _alphaFunction = "EASE_OUT_SQUARE";
                    break;
                }

                case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseIn:
                {
                    _alphaFunction = "EASE_IN";
                    break;
                }

                case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOut:
                {
                    _alphaFunction = "EASE_OUT";
                    break;
                }

                case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOut:
                {
                    _alphaFunction = "EASE_IN_OUT";
                    break;
                }

                case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInSine:
                {
                    _alphaFunction = "EASE_IN_SINE";
                    break;
                }

                case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutSine:
                {
                    _alphaFunction = "EASE_OUT_SINE";
                    break;
                }

                case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseInOutSine:
                {
                    _alphaFunction = "EASE_IN_OUT_SINE";
                    break;
                }

                case Tizen.NUI.AlphaFunction.BuiltinFunctions.Bounce:
                {
                    _alphaFunction = "BOUNCE";
                    break;
                }

                case Tizen.NUI.AlphaFunction.BuiltinFunctions.Sin:
                {
                    _alphaFunction = "SIN";
                    break;
                }

                case Tizen.NUI.AlphaFunction.BuiltinFunctions.EaseOutBack:
                {
                    _alphaFunction = "EASE_OUT_BACK";
                    break;
                }

                default:
                {
                    _alphaFunction = "DEFAULT";
                    break;
                }
                }
            }

            foreach (var item in _visualDictionary.ToList())
            {
                if (item.Value.Name == target.Name)
                {
                    PropertyMap _animator = new PropertyMap();
                    if (_alphaFunction != null)
                    {
                        _animator.Add("alphaFunction", new PropertyValue(_alphaFunction));
                    }

                    PropertyMap _timePeriod = new PropertyMap();
                    _timePeriod.Add("duration", new PropertyValue((endTime - startTime) / 1000.0f));
                    _timePeriod.Add("delay", new PropertyValue(startTime / 1000.0f));
                    _animator.Add("timePeriod", new PropertyValue(_timePeriod));

                    StringBuilder sb = new StringBuilder(property);
                    sb[0] = (char)(sb[0] | 0x20);
                    string _str = sb.ToString();
                    if (_str == "position")
                    {
                        _str = "offset";
                    }

                    PropertyValue destVal = PropertyValue.CreateFromObject(destinationValue);

                    PropertyMap _transition = new PropertyMap();
                    _transition.Add("target", new PropertyValue(target.Name));
                    _transition.Add("property", new PropertyValue(_str));
                    if (initialValue != null)
                    {
                        PropertyValue initVal = PropertyValue.CreateFromObject(initialValue);
                        _transition.Add("initialValue", new PropertyValue(initVal));
                    }
                    _transition.Add("targetValue", destVal);
                    _transition.Add("animator", new PropertyValue(_animator));

                    _animateArray.Add(new PropertyValue(_transition));
                }
            }
        }
예제 #60
0
        public override string ToString()
        {
            PropertyValue pageDescription = this._page.Properties[Properties.Page.PAGE_NOMINATIOMN];

            return(string.Format("{0} <{1}>", this._page.Name, pageDescription.IsEmpty ? "..." : pageDescription.ToLocaleText()));
        }