Beispiel #1
0
        public static InArgument <T> CreateInstanceOfInArgument <T>(Random rndGen)
        {
            if (!CanCreateInstanceOf(typeof(T)))
            {
                throw new ArgumentException($"InArgument<{typeof(T).Name}> not supported");
            }
            var value   = (T)CreatePrimitiveInstance(typeof(T), rndGen);
            var literal = new System.Activities.Expressions.Literal <T>(value);
            var inArg   = new System.Activities.InArgument <T>(literal);

            return(inArg);
        }
Beispiel #2
0
        public void RetrieveFieldImage_Click(object Sender, EventArgs evt)
        {
            string ScreenPath = string.Empty;

            if ((lblImagePath.Content != null) && (lblImagePath.Content is System.Activities.InArgument <string>))
            {
                System.Activities.InArgument <string> strval = (System.Activities.InArgument <string>)lblImagePath.Content;
                if (strval.Expression != null)
                {
                    ScreenPath = SelectHelper.ProjectLocation + "\\Images\\" + strval.Expression.ToString();
                    if ((ScreenPath != null) && (ScreenPath != string.Empty))
                    {
                        if (File.Exists(ScreenPath))
                        {
                            Bitmap bmp   = new Bitmap(ScreenPath);
                            Form2  form2 = new Form2();
                            form2.Text         = "";
                            form2.ControlImage = bmp;

                            form2.Width  = bmp.Width + 20;
                            form2.Height = bmp.Height + 50;
                            int width = (int)X - form2.Width - 50;
                            int Top   = (int)Y;
                            if ((X - form2.Width - 50) > 0)
                            {
                                form2.Location = new System.Drawing.Point(width, Top);
                            }
                            else
                            {
                                form2.Location = new System.Drawing.Point(250, 150);
                            }

                            form2.ShowDialog();
                        }
                    }
                }
            }
        }