Exemple #1
0
        //[Description( "Name of the template file without extension" )]
        //[EditorAttribute( typeof( DSLFactory.Candle.SystemModel.Editor.TemplateNameEditor ), typeof( System.Drawing.Design.UITypeEditor ) )]
        //public string T4Template
        //{
        //    get { return _template; }
        //    set { _template = value; }
        //}

        #region Members
        public void Execute()
        {
            try
            {
                PresentationLayer layer = CurrentElement as PresentationLayer;
                if (Context.GenerationPass != GenerationPass.CodeGeneration || layer == null)
                {
                    return;
                }

                // Création d'un service web pour tous les ports du layer.
                foreach (ClassImplementation port in layer.Classes)
                {
                    string asmxFile = CallT4Template(Context.Project,
                                                     "asmx.T4",
                                                     port,
                                                     String.Format("~{0}.asmx", port.Name));

                    string codeFile = CallT4Template(Context.Project,
                                                     "webservice.T4",
                                                     port);
                }
            }
            catch (Exception ex)
            {
                LogError(ex);
            }
        }
        public static void Main(string[] args)
        {
            var dal = new DataacessLayer();
            var bl  = new BusinesslogicLayer(dal);
            var pl  = new PresentationLayer(bl);

            pl.Show(args);
        }
        private void OnTreeViewItemDoubleClick(PresentationLayer.ViewModels.OperationNodeViewModel nodeViewModel)
        {
            if (this.DataContext == null)
            {
                return;
            }

            var viewModel = this.DataContext as MainViewModel;

            if (viewModel != null)
            {
                viewModel.OnTreeViewItemDoubleClick(nodeViewModel);
            }
        }
Exemple #4
0
        /// <summary>
        /// Creates the layer.
        /// </summary>
        /// <param name="component">The component.</param>
        /// <param name="package">The package.</param>
        /// <returns></returns>
        public SoftwareLayer CreateLayer(SoftwareComponent component, LayerPackage package)
        {
            SoftwareLayer layer = null;

            if (rbPres.Checked)
            {
                layer = new PresentationLayer(component.Store);
            }
            else if (rbUI.Checked)
            {
                layer = new UIWorkflowLayer(component.Store);
            }
            else if (rbDAL.Checked)
            {
                layer = new DataAccessLayer(component.Store);
            }
            else if (rbBLL.Checked)
            {
                layer = new BusinessLayer(component.Store);
            }
            else if (rbModels.Checked)
            {
                layer = new DataLayer(component.Store);
            }
            else if (rbInterface.Checked)
            {
                layer = new InterfaceLayer(component.Store);
                ((InterfaceLayer)layer).Level = (short)(package.Level + 1);
                package.InterfaceLayer        = (InterfaceLayer)layer;
            }

            Layer tmp = layer as Layer;

            if (tmp != null)
            {
                package = component.LayerPackages.Find(delegate(LayerPackage p) { return(p.Level == tmp.Level); });
                if (package == null)
                {
                    package       = new LayerPackage(component.Store);
                    package.Level = tmp.Level;
                    component.LayerPackages.Add(package);
                }
                package.Layers.Add(tmp);
            }

            component.Layers.Add(layer);
            return(layer);
        }
Exemple #5
0
        public void CreateArcAnimationForKey(string key, double fromValue, double toValue, CAAnimationDelegate @delegate)
        {
            var _fromValue = new NSNumber(fromValue);
            var _toValue   = new NSNumber(toValue);
            var _key       = new NSString(key);

            var arcAnimation = CABasicAnimation.FromKeyPath(key);
            var currentAngle = _fromValue;

            if (PresentationLayer != null)
            {
                currentAngle = (NSNumber)PresentationLayer.ValueForKey(_key);
            }
            arcAnimation.Duration       = 1.0f;
            arcAnimation.From           = currentAngle;
            arcAnimation.To             = _toValue;
            arcAnimation.Delegate       = @delegate;
            arcAnimation.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.Default);
            AddAnimation(arcAnimation, key);
            SetValueForKey(_toValue, _key);
        }
Exemple #6
0
        // Création du fichier de mapping nhibernate en utilisant le mécanisme de
        // mappage filtrée
        public void Execute()
        {
            try
            {
                DataLayer ml = CurrentElement as DataLayer;
                if (ml != null && Context.GenerationPass == GenerationPass.MetaModelUpdate && GenerateConfigurationSettings)
                {
                    GenerateNHibernateConfiguration(ml);

                    return;
                }

                PresentationLayer layer = CurrentElement as PresentationLayer;
                if (layer != null && Context.GenerationPass == GenerationPass.MetaModelUpdate)
                {
                    if (layer.HostingContext == HostingContext.Web && GeneratePredefinedSessionManager)
                    {
                        layer.AddXmlConfigurationContent("nhibernatehttpModule", @"<configuration>
<system.web><httpModules><add name=""NHibernateSessionModule"" type=""NHibernate.Web.NHibernateSessionModule""/></httpModules></system.web>
</configuration>");
                    }
                    else
                    {
                        layer.AddXmlConfigurationContent("nhibernatehttpModule", null);
                    }
                    return;
                }

                // DAO
                if (CurrentElement is DataAccessLayer && GeneratePredefinedSessionManager)
                {
                    DataAccessLayer dal = CurrentElement as DataAccessLayer;
                    CallT4Template(Context.Project, "NHibernateSessionManager", dal, "NHibernateSessionManager.cs");
                    PresentationLayer l = dal.Component.GetMainLayer() as PresentationLayer;
                    if (l != null && l.HostingContext == HostingContext.Web)
                    {
                        CallT4Template(Context.Project, "NHibernateHttpModule", dal, "NHibernateHttpModule.cs");
                    }
                    return;
                }

                ClassImplementation clazz = CurrentElement as ClassImplementation;
                if (clazz != null && !String.IsNullOrEmpty(DAOTemplate))
                {
                    DataAccessLayer dal = clazz.Layer as DataAccessLayer;
                    if (dal != null && dal.SoftwareComponent.IsDataLayerExists)
                    {
                        TemplateProperties properties = new TemplateProperties();
                        CallT4Template(Context.Project, DAOTemplate, clazz, clazz.Name + "Base");
                    }
                    return;
                }

                Entity entity = CurrentElement as Entity;
                if (entity != null && EntityIsPersistableProperty.GetValue(entity) && !String.IsNullOrEmpty(EntityTemplate))
                {
                    CallT4Template(Context.Project, EntityTemplate, entity, entity.Name);
                }

                Enumeration enumeration = CurrentElement as Enumeration;
                if (enumeration != null && !String.IsNullOrEmpty(EnumTemplate))
                {
                    CallT4Template(Context.Project, EnumTemplate, enumeration, enumeration.Name);
                }

                // Mappings
                if (CurrentElement is DataLayer && Context.GenerationPass == GenerationPass.CodeGeneration && GenerateHbmFile)
                {
                    // Nom du fichier de sortie
                    string fileName           = String.Format("{0}.hbm.xml", System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Context.Project.FileName), Context.Project.Name));
                    NHibernate3Strategy strat = new NHibernate3Strategy();
                    if (File.Exists(fileName))
                    {
                        ServiceLocator.Instance.ShellHelper.EnsureCheckout(fileName);
                    }

                    strat.Execute(Context, fileName);

                    if (File.Exists(fileName))
                    {
                        ProjectItem item = ServiceLocator.Instance.ShellHelper.AddFileToProject(Context.Project, fileName);

                        try
                        {
                            item.Properties.Item("BuildAction").Value = _hbmFileBuildAction;
                        }
                        catch { }

                        if (_hbmFileBuildAction != VSLangProj.prjBuildAction.prjBuildActionEmbeddedResource)
                        {
                            ((DataLayer)CurrentElement).AddReference(fileName, ArtifactType.Content);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogError(ex);
            }
        }
Exemple #7
0
        protected void Exit(bool animated, Action completionBlock)
        {
            base.Exit(animated);

            if (!animated)
            {
                RemoveAllAnimations();
                CATransaction.Begin();
                CATransaction.DisableActions = true;
                Opacity = 0;
                //__weak MDCLegacyInkLayerForegroundRipple * weakSelf = self;
                CATransaction.CompletionBlock = new Action(() =>
                {
                    this.RemoveFromSuperLayer();

                    if (this.animationDelegate != null)
                    {
                        animationDelegate.AnimationDidStop(null, this, true);
                    }
                });
                CATransaction.Commit();
                return;
            }

            if (Bounded)
            {
                ForegroundOpacityAnim.Values   = new NSNumber[] { 1, 0 };
                ForegroundOpacityAnim.Duration = kInkLayerForegroundBoundedOpacityExitDuration;

                // Bounded ripples move slightly towards the center of the tap target. Unbounded ripples
                // move to the center of the tap target.

                nfloat xOffset = (nfloat)(TargetFrame.X - InkLayer?.Frame.X);
                nfloat yOffset = (nfloat)(TargetFrame.Y - InkLayer?.Frame.Y);

                CGPoint startPoint = new CGPoint(Point.X + xOffset, Point.Y + yOffset);
                CGPoint endPoint   = MDCLegacyInkLayerRectGetCenter(TargetFrame);

                if (UseCustomInkCenter)
                {
                    endPoint = new CGPoint(CustomInkCenter, CustomInkCenter);
                }
                endPoint = new CGPoint(endPoint.X + xOffset, endPoint.Y + yOffset);
                CGPoint      centerOffsetPoint = MDCLegacyInkLayerInterpolatePoint(startPoint, endPoint, 0.3f);
                UIBezierPath movePath          = new UIBezierPath();
                movePath.MoveTo(startPoint);
                movePath.AddLineTo(centerOffsetPoint);

                ForegroundPositionAnim =
                    PositionAnimWithPath(movePath.CGPath,
                                         duration: kInkLayerForegroundBoundedPositionExitDuration,
                                         timingFunction: LogDecelerateEasing());
                ForegroundScaleAnim.Values   = new NSNumber[] { 0, 1 };
                ForegroundScaleAnim.KeyTimes = new NSNumber[] { 0, 1 };
                ForegroundScaleAnim.Duration = kInkLayerForegroundBoundedRadiusExitDuration;
            }
            else
            {
                NSNumber opacityVal = (NSNumber)PresentationLayer.ValueForKey((NSString)kInkLayerOpacity);
                if (opacityVal == null)
                {
                    opacityVal = NSNumber.FromFloat(0.0f);
                }
                nfloat adjustedDuration = kInkLayerForegroundBoundedPositionExitDuration;
                nfloat normOpacityVal   = opacityVal.FloatValue;
                nfloat opacityDuration  = normOpacityVal / 3.0f;
                ForegroundOpacityAnim.Values   = new NSNumber[] { opacityVal, 0 };
                ForegroundOpacityAnim.Duration = opacityDuration + adjustedDuration;

                NSNumber scaleVal = (NSNumber)PresentationLayer.ValueForKey((NSString)kInkLayerScale);
                if (scaleVal == null)
                {
                    scaleVal = NSNumber.FromFloat(0.0f);
                }
                nfloat unboundedDuration = (nfloat)Math.Sqrt(((1.0f - scaleVal.FloatValue) * Radius) /
                                                             (kInkLayerForegroundWaveTouchDownAcceleration +
                                                              kInkLayerForegroundWaveTouchUpAcceleration));
                ForegroundPositionAnim.Duration = unboundedDuration + adjustedDuration;
                ForegroundScaleAnim.Values      = new NSNumber[] { scaleVal, 1 };
                ForegroundScaleAnim.Duration    = unboundedDuration + adjustedDuration;
            }

            ForegroundOpacityAnim.KeyTimes = new NSNumber[] { 0, 1 };
            if (ForegroundOpacityAnim.Duration < ForegroundScaleAnim.Duration)
            {
                ForegroundScaleAnim.Delegate = this;
            }
            else
            {
                ForegroundOpacityAnim.Delegate = this;
            }

            ForegroundOpacityAnim.TimingFunction =
                CAMediaTimingFunction.FromName(CAMediaTimingFunction.Linear);
            ForegroundPositionAnim.TimingFunction = LogDecelerateEasing();
            ForegroundScaleAnim.TimingFunction    = LogDecelerateEasing();

            CATransaction.Begin();
            if (completionBlock != null)
            {
                CATransaction.CompletionBlock = new Action(() =>
                {
                    if (RippleState != MDCInkRippleState.kInkRippleCancelled)
                    {
                        completionBlock();
                    }
                });
            }

            AddAnimation(ForegroundOpacityAnim, kInkLayerForegroundOpacityAnim);
            AddAnimation(ForegroundPositionAnim, kInkLayerForegroundPositionAnim);
            AddAnimation(ForegroundScaleAnim, kInkLayerForegroundScaleAnim);
            CATransaction.Commit();
        }
    static void Main()
    {
        PresentationLayer Pl = new PresentationLayer();

        Pl.Start();
    }
 public static void Main(string[] args)
 {
     PresentationLayer.Show(args);
 }