Ejemplo n.º 1
0
		protected override bool PreConfiguration(Binding.IBuild build)
		{
			Platform.Application application = build.Application;
			if (application.NotNull())
			{
				Platform.Module module = application["License"];
				if (module is Icop.Client.Module)
				{
					string value = (module as Icop.Client.Module)["media.directshow.elecard." + this.identifier] as string;
					if (value.NotEmpty())
						this.OnPreConfigure += configurator =>
					{
						byte[] key = Convert.FromBase64String(value.Replace('-', '/'));
						byte[] correct = new byte[16];
						byte[] secret = new byte[] { 89, 254, 202, 212, 234, 216, 54, 120, 194, 196, 150, 207, 127, 96, 54, 189 };
						for (int i = 0; i < 16; i++)
							correct[i] = (byte)(secret[i] ^ key[i]);
						Guid activationKey = new Guid(correct);
						//Console.WriteLine(activationKey);
						configurator.SetParamValue(ref activationKey, null);
					};
				}
			}
			if (this.OnPreConfigure.NotNull())
			{
				global::Elecard.Utilities.ModuleConfig moduleConfigurator = this.backend.GetConfigInterface();
				if (moduleConfigurator.NotNull())
				{
					this.OnPreConfigure(moduleConfigurator);
					moduleConfigurator.Dispose();
				}
			}
			return base.PreConfiguration(build);
		}
 /// <summary>
 /// Adds the specified keybind to the specified action.
 /// </summary>
 public static void AddKeybind(PlayerAction action, Binding bind)
 {
     if (binds.ContainsKey(action))
         binds[action] = bind;
     else
         binds.Add(action, bind);
 }
Ejemplo n.º 3
0
 public BindingExpression(BindingMode mode, Binding.Parsing.Expressions.BindingPathExpression path, RedwoodProperty sourceProperty = null, RedwoodBindable source = null)
 {
     Path = path;
     Mode = mode;
     SourceProperty = sourceProperty ?? Controls.RedwoodControl.DataContextProperty;
     Source = source;
 }
		public IBindingContext CreateContext()
		{
			var context = BindingContext.Create();

			foreach(var binding in m_bindings)
			{
				List<IBindingRequirement> requirements = new List<IBindingRequirement>();

				foreach(var req in binding.Dependencies)
				{
					var realReq = BindingRequirements.Instance.With(req.name,req.BindingType);
					requirements.Add(realReq);
				}

			
				var args = new List<Type>(binding.Factory.GetParameters().Select(p => p.ParameterType));
				args.Add(binding.Factory.ReturnType);

				var delegateType = Expression.GetFuncType(args.ToArray());

				var factory = System.Delegate.CreateDelegate(delegateType,binding.Factory);

				IBinding realBinding = new Binding(factory,requirements.ToArray());

				context.Unsafe.Bind(binding.Root.name,binding.Root.BindingType).To(realBinding);
			}

			return context;
		}
Ejemplo n.º 5
0
        public ContextBufferBindings(IContext context, IContextCaps caps)
        {
            Array = new BufferBinding(context, BufferTarget.Array);
            CopyRead = new BufferBinding(context, BufferTarget.CopyRead);
            CopyWrite = new BufferBinding(context, BufferTarget.CopyWrite);
            ElementArray = new Binding<IBuffer>(context, (c, o) =>
            {
                c.Bindings.VertexArray.Set(null);
                c.GL.BindBuffer((int)All.ElementArrayBuffer, o.SafeGetHandle());
            });
            PixelPack = new BufferBinding(context, BufferTarget.PixelPack);
            PixelUnpack = new BufferBinding(context, BufferTarget.PixelUnpack);
            Texture = new BufferBinding(context, BufferTarget.Texture);
            DrawIndirect = new BufferBinding(context, BufferTarget.DrawIndirect);
            TransformFeedback = new Binding<IBuffer>(context, (c, o) =>
            {
                c.Bindings.TransformFeedback.Set(null);
                c.GL.BindBuffer((int)All.TransformFeedbackBuffer, o.SafeGetHandle());
            });
            Uniform = new BufferBinding(context, BufferTarget.Uniform);
            ShaderStorage = new BufferBinding(context, BufferTarget.ShaderStorage);
            DispatchIndirect = new BufferBinding(context, BufferTarget.DispatchIndirect);
            Query = new BufferBinding(context, BufferTarget.Query);
            AtomicCounter = new BufferBinding(context, BufferTarget.AtomicCounter);

            UniformIndexed = Enumerable.Range(0, caps.MaxUniformBufferBindings)
                .Select(i => new Binding<BufferRange>(context, (c, o) =>
                {
                    if (o.Buffer == null || o.Offset == 0 && o.Size == o.Buffer.SizeInBytes)
                        c.GL.BindBufferBase((int)BufferTarget.Uniform, (uint)i, o.Buffer.SafeGetHandle());
                    else
                        c.GL.BindBufferRange((int)BufferTarget.Uniform, (uint)i, o.Buffer.SafeGetHandle(), (IntPtr)o.Offset, (IntPtr)o.Size);
                }))
                .ToArray();
        }
Ejemplo n.º 6
0
 protected AbstractChannel(SocketOptions options, Binding binding, LetterDeserializer letterDeserializer, HyperletterFactory factory)
 {
     _options = options;
     _letterDeserializer = letterDeserializer;
     _factory = factory;
     Binding = binding;
 }
        /// <summary>
        /// Returns any bindings from the specified collection that match the specified request.
        /// </summary>
        /// <param name="bindings">The <see cref="Multimap{T1,T2}"/> of all registered bindings.</param>
        /// <param name="request">The request in question.</param>
        /// <returns>The series of matching bindings.</returns>
        public IEnumerable<IBinding> Resolve(Multimap<Type, IBinding> bindings, IRequest request)
        {
            if (typeof(DbContext).IsAssignableFrom(request.Service))
            {
                return new[]
                {
                    new Binding(request.Service)
                    {
                        ProviderCallback = this.mockProviderCallbackProvider.GetCreationCallback(),
                        ScopeCallback = ctx => StandardScopeCallbacks.Singleton,
                        IsImplicit = true
                    }
                };
            }

            if (request.Service.IsGenericType() && request.Service.GetGenericTypeDefinition() == typeof(DbSet<>))
            {
                var binding = new Binding(request.Service)
                {
                    ProviderCallback = this.mockProviderCallbackProvider.GetCreationCallback(),
                    ScopeCallback = ctx => StandardScopeCallbacks.Singleton,
                    IsImplicit = true
                };

                binding.Parameters.Add(new AdditionalInterfaceParameter(typeof(IQueryable<>).MakeGenericType(request.Service.GetGenericArguments())));
#if !NET40
                binding.Parameters.Add(new AdditionalInterfaceParameter(typeof(IDbAsyncEnumerable<>).MakeGenericType(request.Service.GetGenericArguments())));
#endif
                return new[] { binding };
            }

            return Enumerable.Empty<IBinding>();
        }
Ejemplo n.º 8
0
		public void ApplyNull()
		{
			const string path = "Foo.Bar";
			var binding = new Binding (path);
			var be = new BindingExpression (binding, path);
			Assert.DoesNotThrow (() => be.Apply (null, new MockBindable(), TextCell.TextProperty));
		}
Ejemplo n.º 9
0
        public void TestBindingQuery()
        {
            var q = new Binding();
            q.Query.Parse("{[chILdReN]}");

            Assert.IsTrue(q.Query.Children);
        }
Ejemplo n.º 10
0
 private static UIElement r_11_dtMethod(UIElement parent)
 {
     // e_69 element
     Border e_69 = new Border();
     e_69.Parent = parent;
     e_69.Name = "e_69";
     e_69.Background = new SolidColorBrush(new ColorW(0, 0, 255, 255));
     // e_70 element
     StackPanel e_70 = new StackPanel();
     e_69.Child = e_70;
     e_70.Name = "e_70";
     // e_71 element
     TextBlock e_71 = new TextBlock();
     e_70.Children.Add(e_71);
     e_71.Name = "e_71";
     e_71.HorizontalAlignment = HorizontalAlignment.Center;
     e_71.VerticalAlignment = VerticalAlignment.Center;
     Binding binding_e_71_Text = new Binding("TextData");
     e_71.SetBinding(TextBlock.TextProperty, binding_e_71_Text);
     // e_72 element
     Button e_72 = new Button();
     e_70.Children.Add(e_72);
     e_72.Name = "e_72";
     e_72.Content = "Hide Window";
     Binding binding_e_72_Command = new Binding("HideCommand");
     e_72.SetBinding(Button.CommandProperty, binding_e_72_Command);
     return e_69;
 }
Ejemplo n.º 11
0
 internal ExternalRequirements(Binding context,
     IEnumerable<Expression> links)
     : base(context, null, null)
 {
     Guard.NotNull(links, "links");
     Links = new ReadOnlyCollection<Expression>(new List<Expression>(links));
 }
Ejemplo n.º 12
0
		public void Setup()
		{
			b = new Binding ();
			b.ToPool ();

			binding = (b as IPool);
		}
Ejemplo n.º 13
0
    public static bool RunBasicEchoTest(Binding binding, string address, string variation, StringBuilder errorBuilder, Action<ChannelFactory> factorySettings = null)
    {
        Logger.LogInformation("Starting basic echo test.\nTest variation:...\n{0}\nUsing address: '{1}'", variation, address);

        bool success = false;
        try
        {
            ChannelFactory<IWcfService> factory = new ChannelFactory<IWcfService>(binding, new EndpointAddress(address));

            if (factorySettings != null)
            {
                factorySettings(factory);
            }

            IWcfService serviceProxy = factory.CreateChannel();

            string result = serviceProxy.Echo(testString);
            success = string.Equals(result, testString);

            if (!success)
            {
                errorBuilder.AppendLine(String.Format("    Error: expected response from service: '{0}' Actual was: '{1}'", testString, result));
            }
        }
        catch (Exception ex)
        {
            Logger.LogInformation("    {0}", ex.Message);
            errorBuilder.AppendLine(String.Format("    Error: Unexpected exception was caught while doing the basic echo test for variation...\n'{0}'\nException: {1}", variation, ex.ToString()));
        }

        Logger.LogInformation("  Result: {0} ", success ? "PASS" : "FAIL");

        return success;
    }
Ejemplo n.º 14
0
 private static UIElement e_23_Col3_ct_dtMethod(UIElement parent)
 {
     // e_25 element
     StackPanel e_25 = new StackPanel();
     e_25.Parent = parent;
     e_25.Name = "e_25";
     // e_26 element
     TextBlock e_26 = new TextBlock();
     e_25.Children.Add(e_26);
     e_26.Name = "e_26";
     Binding binding_e_26_Text = new Binding("Text");
     e_26.SetBinding(TextBlock.TextProperty, binding_e_26_Text);
     // e_27 element
     StackPanel e_27 = new StackPanel();
     e_25.Children.Add(e_27);
     e_27.Name = "e_27";
     e_27.Orientation = Orientation.Horizontal;
     // e_28 element
     TextBlock e_28 = new TextBlock();
     e_27.Children.Add(e_28);
     e_28.Name = "e_28";
     Binding binding_e_28_Text = new Binding("Boolean");
     e_28.SetBinding(TextBlock.TextProperty, binding_e_28_Text);
     // e_29 element
     TextBlock e_29 = new TextBlock();
     e_27.Children.Add(e_29);
     e_29.Name = "e_29";
     Binding binding_e_29_Text = new Binding("Number");
     e_29.SetBinding(TextBlock.TextProperty, binding_e_29_Text);
     return e_25;
 }
Ejemplo n.º 15
0
		protected override void Init ()
		{
			var entry = new Entry {
				Text = "Setec Astronomy",
				FontFamily = "Comic Sans MS",
				HorizontalTextAlignment = TextAlignment.Center,
				Keyboard = Keyboard.Chat
			};

			var label = new Label ();
			var binding = new Binding ("Text") { Source = entry };

			var otherEntry = new Entry ();
			var otherBinding = new Binding ("Text") { Source = entry, Mode = BindingMode.TwoWay };
			otherEntry.SetBinding (Entry.TextProperty, otherBinding);

			label.SetBinding (Label.TextProperty, binding);

			var explanation = new Label() {Text = @"The Text value of the entry at the top should appear in the label and entry below, regardless of whether 'IsPassword' is on. 
Changes to the value in the entry below should be reflected in the entry at the top."};

			var button = new Button { Text = "Toggle IsPassword" };
			button.Clicked += (sender, args) => { entry.IsPassword = !entry.IsPassword; };

			Content = new StackLayout {
				Children = { entry, button, explanation, label, otherEntry }
			};
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="DLToolkit.Forms.Controls.FlowListView"/> class.
		/// </summary>
		public FlowListView()
		{
			RefreshDesiredColumnCount();
			SizeChanged += FlowListSizeChanged;
			PropertyChanged += FlowListViewPropertyChanged;
			PropertyChanging += FlowListViewPropertyChanging;

			FlowGroupKeySorting = FlowSorting.Ascending;
			FlowGroupItemSorting = FlowSorting.Ascending;
			FlowColumnExpand = FlowColumnExpand.None;
			FlowColumnsTemplates = new List<FlowColumnTemplateSelector>();
			GroupDisplayBinding = new Binding("Key");
			FlowAutoColumnCount = false;
			FlowColumnDefaultMinimumWidth = 50d;
			FlowRowBackgroundColor = Color.Transparent;
			FlowTappedBackgroundColor = Color.Transparent;
			FlowTappedBackgroundDelay = 0;

			var flowListViewRef = new WeakReference<FlowListView>(this);
			ItemTemplate = new DataTemplate(() => new FlowListViewInternalCell(flowListViewRef));
			SeparatorVisibility = SeparatorVisibility.None;
			SeparatorColor = Color.Transparent;

			ItemSelected += FlowListViewItemSelected;
			ItemAppearing += FlowListViewItemAppearing;
			ItemDisappearing += FlowListViewItemDisappearing;
		}
        public BindingSourceCodePage()
        {
            Label label = new Label
            {
                Text = "Binding Source Demo",
                FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                VerticalOptions = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.Center
            };

            Slider slider = new Slider
            {
                VerticalOptions = LayoutOptions.CenterAndExpand
            };

            // Define Binding object with source object and property.
            Binding binding = new Binding
            {
                Source = slider,
                Path = "Value"
            };

            // Bind the Opacity property of the Label to the source.
            label.SetBinding(Label.OpacityProperty, binding);

            // Construct the page.
            Padding = new Thickness(10, 0);
            Content = new StackLayout
            {
                Children = { label, slider }
            };
        }
Ejemplo n.º 18
0
 void bind()
 {
     binding = Binding.Create(()=>
         TextLabel.Text == Payment.PaymentType.Description &&
         input.Text == payment.AmountString
     );
 }
Ejemplo n.º 19
0
        public static void BuildBindings()
        {
            var bindingOneWayToTarget = new Binding
            {
                SourceObject = Source,
                SourcePath = "OneWayToTarget",
                TargetObject = Target,
                TargetPath = "OneWayToTarget",
                Mode = BindingMode.OneWayToTarget
            };
            BindingManager.Bindings.Add(bindingOneWayToTarget);

            var bindingOneWayToSource = new Binding
            {
                SourceObject = Source,
                SourcePath = "OneWayToSource",
                TargetObject = Target,
                TargetPath = "OneWayToSource",
                Mode = BindingMode.OneWayToSource
            };
            BindingManager.Bindings.Add(bindingOneWayToSource);

            var bindingTwoWay = new Binding
            {
                SourceObject = Source,
                SourcePath = "TwoWay",
                TargetObject = Target,
                TargetPath = "TwoWay",
                Mode = BindingMode.TwoWay
            };
            BindingManager.Bindings.Add(bindingTwoWay);
        }
Ejemplo n.º 20
0
        public PFDictionaryView()
        {
            viewModel = new PFDictionaresViewModel();
            ItemsSource = viewModel.PFDictionariesGrouped;
            IsGroupingEnabled = true;
            GroupDisplayBinding = new Binding("Key");
            GroupShortNameBinding = new Binding("Key");

            if(Device.OS != TargetPlatform.WinPhone)
                GroupHeaderTemplate = new DataTemplate(typeof(HeaderCell));

             var cell = new DataTemplate(typeof(PFDictCell));

             ItemTemplate = cell;
             //SeparatorVisibility = SeparatorVisibility.None;
             RowHeight = 60;
             ItemTapped += (sender, args) =>
             {
                var pfdic = args.Item as  PFDictionary;
                if (pfdic == null)
                    return;

                //Navigation.PushAsync(new DetailsPage(pfdic));
                // Reset the selected item
                 SelectedItem = null;
            };
        }
Ejemplo n.º 21
0
 private static UIElement e_28_Col3_ct_dtMethod(UIElement parent)
 {
     // e_30 element
     StackPanel e_30 = new StackPanel();
     e_30.Parent = parent;
     e_30.Name = "e_30";
     // e_31 element
     TextBlock e_31 = new TextBlock();
     e_30.Children.Add(e_31);
     e_31.Name = "e_31";
     Binding binding_e_31_Text = new Binding("Text");
     e_31.SetBinding(TextBlock.TextProperty, binding_e_31_Text);
     // e_32 element
     StackPanel e_32 = new StackPanel();
     e_30.Children.Add(e_32);
     e_32.Name = "e_32";
     e_32.Orientation = Orientation.Horizontal;
     // e_33 element
     TextBlock e_33 = new TextBlock();
     e_32.Children.Add(e_33);
     e_33.Name = "e_33";
     Binding binding_e_33_Text = new Binding("Boolean");
     e_33.SetBinding(TextBlock.TextProperty, binding_e_33_Text);
     // e_34 element
     TextBlock e_34 = new TextBlock();
     e_32.Children.Add(e_34);
     e_34.Name = "e_34";
     Binding binding_e_34_Text = new Binding("Number");
     e_34.SetBinding(TextBlock.TextProperty, binding_e_34_Text);
     return e_30;
 }
Ejemplo n.º 22
0
 private static UIElement r_2_ctMethod(UIElement parent)
 {
     // e_0 element
     Grid e_0 = new Grid();
     e_0.Parent = parent;
     e_0.Name = "e_0";
     RowDefinition row_e_0_0 = new RowDefinition();
     row_e_0_0.Height = new GridLength(20F, GridUnitType.Pixel);
     e_0.RowDefinitions.Add(row_e_0_0);
     RowDefinition row_e_0_1 = new RowDefinition();
     e_0.RowDefinitions.Add(row_e_0_1);
     // PART_WindowTitleBorder element
     Border PART_WindowTitleBorder = new Border();
     e_0.Children.Add(PART_WindowTitleBorder);
     PART_WindowTitleBorder.Name = "PART_WindowTitleBorder";
     PART_WindowTitleBorder.Background = new SolidColorBrush(new ColorW(255, 255, 255, 255));
     // e_1 element
     ContentPresenter e_1 = new ContentPresenter();
     e_0.Children.Add(e_1);
     e_1.Name = "e_1";
     Grid.SetRow(e_1, 1);
     Binding binding_e_1_Content = new Binding();
     e_1.SetBinding(ContentPresenter.ContentProperty, binding_e_1_Content);
     return e_0;
 }
Ejemplo n.º 23
0
        public bool TryIncludeUniqueBinding(Binding binding)
        {
            if (Contains(binding.Identifier))
                return false;

            bindings[binding.Identifier] = binding.Type;
            return true;
        }
Ejemplo n.º 24
0
        private void SetItemBinding(SwipeListViewItem item, string origin, DependencyProperty destination)
        {
            var binding = new Binding();
            binding.Source = this;
            binding.Path = new PropertyPath(origin);

            BindingOperations.SetBinding(item, destination, binding);
        }
Ejemplo n.º 25
0
 internal FreeTextFilter(Binding context,
     string name,
     Binding<string> style,
     Expression filterExpression)
     : base(context, name, style)
 {
     FilterExpression = filterExpression;
 }
Ejemplo n.º 26
0
 //Executed only once, on the first call
 protected override object DoEvaluate(ScriptThread thread) {
   thread.CurrentNode = this;  //standard prolog
   _accessor = thread.Bind(Symbol, BindingRequestFlags.Read);
   this.Evaluate = _accessor.GetValueRef; // Optimization - directly set method ref to accessor's method. EvaluateReader;
   var result = this.Evaluate(thread);
   thread.CurrentNode = Parent; //standard epilog
   return result; 
 }
Ejemplo n.º 27
0
 public override void DoSetValue(ScriptThread thread, object value) {
   thread.CurrentNode = this;  //standard prolog
   if (_accessor == null) {
     _accessor = thread.Bind(Symbol, BindingRequestFlags.Write | BindingRequestFlags.ExistingOrNew);
   }
   _accessor.SetValueRef(thread, value);
   thread.CurrentNode = Parent;  //standard epilog
 }
Ejemplo n.º 28
0
 public BindingRegistry(Binding binding)
 {
     this.Binding = binding;
     typeFactoryLoaderMap = new Dictionary<Type,Dictionary<string,TypeFactoryMap>>();
     typeFactoryLoaderCache = new Dictionary<TypeFactoryDefinition, TypeFactoryBinding>();
     typeFactoryDefinitions =  new Dictionary<TypeFactoryDefinition, TypeFactoryDefinition>();
     customFactoryLoaderCache = new Dictionary<Type, IFactoryLoader>();
 }
Ejemplo n.º 29
0
Archivo: Text.cs Proyecto: Aethon/odo
 internal Text(Binding context,
     string name,
     Binding<string> style,
     Binding<string> content)
     : base(context, name, style)
 {
     Content = content;
 }
 public MetadataExchangeClient(Binding mexBinding)
 {
     if (mexBinding == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("mexBinding");
     }
     this.factory = new ChannelFactory<IMetadataExchange>(mexBinding);
     this.maxMessageSize = GetMaxMessageSize(this.factory.Endpoint.Binding);
 }
Ejemplo n.º 31
0
        public void loadCategories()
        {
            if (!File.Exists("config/categories.txt"))
            {
                return;
            }
            string[] s = File.ReadAllLines("config/categories.txt");

            database.data.Clear();
            tabMain.Items.Clear();
            scd.subclasses.Clear();

            selected = new ObjectStructure[s.Count()];

            for (int i = 0; i < s.Count(); i++)
            {
                if (s[i].Length <= 0)
                {
                    continue;
                }

                if (s[i][0] == '#')
                {
                    continue;
                }

                if (s[i][0] == '>')
                {
                    s[i] = s[i].Remove(0, 1);

                    string[] dataSplit = s[i].Split(',');

                    Misc.SubclassHelper sch = new Misc.SubclassHelper(dataSplit[1]);
                    if (!scd.subclasses.ContainsKey(dataSplit[0]))
                    {
                        Console.WriteLine("dict not found");
                        scd.subclasses.Add(dataSplit[0], new ObservableCollection <Misc.SubclassHelper>());
                    }

                    scd.subclasses[dataSplit[0]].Add(sch);


                    continue;
                }

                TabItem tI = new TabItem();
                tI.Header = s[i];
                database.addDB();

                Grid G = new Grid();
                tI.Content = G;

                Misc.SearchFilter SF = new Misc.SearchFilter();

                Card c = new Card();
                c.Padding = new Thickness(8);
                c.Margin  = new Thickness(192, 16, 16, 16);

                ScrollViewer sv = new ScrollViewer();
                sv.Visibility = Visibility.Visible;
                StackPanel sp = new StackPanel();

                stackProperties.Add(sp);
                sp.IsEnabled = false;
                sv.Content   = sp;
                c.Content    = sv;

                Menu m = new Menu();
                m.HorizontalAlignment = HorizontalAlignment.Left;
                m.Height            = 48;
                m.VerticalAlignment = VerticalAlignment.Top;



                ListView lv = new ListView();
                lv.HorizontalAlignment = HorizontalAlignment.Left;
                lv.VerticalAlignment   = VerticalAlignment.Top;
                lv.Width  = 180;
                lv.Margin = new Thickness(0, 96, 0, 0);


                //lv.ItemsSource = database.Last();

                int tempI = i;

                MultiBinding mb = new MultiBinding();

                Binding lhs = new Binding();
                lhs.Path   = new PropertyPath("data[" + tempI + "]");
                lhs.Source = database;

                Binding rhs = new Binding();
                rhs.Source = SF;
                rhs.Path   = new PropertyPath("FILTERS");

                mb.Bindings.Add(lhs);
                mb.Bindings.Add(rhs);

                mb.Converter = new Misc.HierarchyConverter();

                /*Binding hierarchyBinding = new Binding();
                 * hierarchyBinding.Path = new PropertyPath("data[" + tempI + "]");
                 * hierarchyBinding.Source = database;
                 * hierarchyBinding.Converter = mb;*/
                //new Misc.HierarchyConverter();

                lv.DataContext = database;
                lv.SetBinding(ListView.ItemsSourceProperty,
                              mb);

                /*Binding exclBind = new Binding();
                 * exclBind.Source = database;
                 * exclBind.Path = new PropertyPath("data[" + tempI + "].excludeExport");
                 * exclBind.Converter = new Misc.ExclusionConverter();
                 * lv.SetBinding(ListView.color, exclBind);*/

                lv.SelectionChanged += SelectionChange;

                ContextMenu cm          = new ContextMenu();
                MenuItem    duplicateMI = new MenuItem();
                duplicateMI.Header = "Duplicate";
                MenuItem removeMI = new MenuItem();
                removeMI.Header = "Remove";
                MenuItem excludeMI = new MenuItem();
                excludeMI.Header = "Exclude";
                MenuItem templateMI = new MenuItem();
                templateMI.Header = "Template";
                MenuItem copyMI = new MenuItem();
                copyMI.Header = "Copy";
                MenuItem popMI = new MenuItem();
                popMI.Header = "Pop Out";

                MenuItem trelloMI = new MenuItem();
                trelloMI.Header = "Trello";

                duplicateMI.Click += (rs, EventArgs) => { Entry_Duplicate(rs, EventArgs, lv, tempI); };
                removeMI.Click    += (rs, EventArgs) => { Entry_Delete(rs, EventArgs, lv, tempI); };
                excludeMI.Click   += (rs, EventArgs) => { Entry_Exclude(rs, EventArgs, lv, tempI); };
                templateMI.Click  += (rs, EventArgs) => { Entry_Template(rs, EventArgs, lv, tempI); };
                copyMI.Click      += (rs, EventArgs) => { Entry_Copy(rs, EventArgs, lv, tempI); };
                popMI.Click       += (rs, EventArgs) => { Entry_PopOut(rs, EventArgs, lv, tempI); };
                trelloMI.Click    += (rs, EventArgs) =>
                {
                    Assistant.IssuePicker ip = new Assistant.IssuePicker(5, database.trelloIntegration);
                    ip.Show();
                };

                cm.Items.Add(duplicateMI);
                cm.Items.Add(removeMI);
                cm.Items.Add(excludeMI);
                cm.Items.Add(templateMI);
                cm.Items.Add(copyMI);
                cm.Items.Add(trelloMI);
                cm.Items.Add(popMI);

                lv.ContextMenu = cm;


                Button bA = new Button();
                bA.Content = "Add";
                bA.Width   = 164;

                ContextMenu additionalAddMenu = new ContextMenu();
                MenuItem    miATemp           = new MenuItem();
                miATemp.Header = "From Template";

                objectTemplates.addTable(s[i]);

                Binding OTBinding = new Binding();
                OTBinding.Converter = new Misc.TemplateMenuConverter(this);
                OTBinding.Source    = objectTemplates;

                OTBinding.Path = new PropertyPath("subclasses[" + s[i] + "]");

                miATemp.SetBinding(MenuItem.ItemsSourceProperty, OTBinding);



                MenuItem miSub = new MenuItem();
                miSub.Header = "Subclass";

                //Console.WriteLine("Adding {0} to sub dict", s[i]);
                scd.addTable(s[i]);

                Binding subBinding = new Binding();
                subBinding.Converter = new Misc.SubclassMenuConverter(this);
                subBinding.Source    = scd;

                subBinding.Path = new PropertyPath("subclasses[" + s[i] + "]");

                miSub.SetBinding(MenuItem.ItemsSourceProperty, subBinding);

                //miSub.DataContext = subclasses[s[i]];
                //miSub.ItemsSource = subclasses[s[i]];

                additionalAddMenu.Items.Add(miATemp);
                additionalAddMenu.Items.Add(miSub);

                Button   bB = new Button();
                PackIcon ic = new PackIcon();
                ic.Kind                = PackIconKind.ChevronDown;
                bB.Content             = ic;
                bB.Width               = 46;
                bB.Height              = 36;
                bB.HorizontalAlignment = HorizontalAlignment.Right;
                bB.ContextMenu         = additionalAddMenu;
                bB.Click              += (rs, EventArgs) => { bB.ContextMenu.IsOpen = true; };

                Grid bGrid = new Grid();
                bGrid.Children.Add(bA);
                bGrid.Children.Add(bB);

                ContextMenu cmsp        = new ContextMenu();
                MenuItem    globalPaste = new MenuItem();
                globalPaste.Header = "Paste";
                globalPaste.Click += jsonPaste;
                globalPaste.Icon   = PackIconKind.Clipboard;

                cmsp.Items.Add(globalPaste);
                m.ContextMenu = cmsp;

                database.tabNames.Add(s[i]);

                bA.Click += (sender, EventArgs) => { database.addItem(tempI); };
                //{ Add_Click(sender, EventArgs, lv); };

                m.Width  = 350;
                m.Height = 900;
                m.Items.Add(bGrid);
                m.Items.Add(SF);
                G.Children.Add(m);
                G.Children.Add(lv);
                G.Children.Add(c);
                tabMain.Items.Add(tI);
            }

            saveBinding.Command          = new fileCommands(this);
            saveBinding.CommandParameter = "Save";

            exportBinding.Command          = new fileCommands(this);
            exportBinding.CommandParameter = "Export";
        }
Ejemplo n.º 32
0
        /// <summary>
        /// Prepares all bindings and content set to the ComboBox visualized when entering edit mode.
        /// </summary>
        /// <param name="editorContent">The editor itself.</param>
        public override void PrepareEditorContentVisual(FrameworkElement editorContent, Binding binding)
        {
            var item = binding.Source;

            var itemsSourceBinding = new Binding();

            if (!string.IsNullOrEmpty(this.ItemsSourcePath))
            {
                itemsSourceBinding.Source = item;
                itemsSourceBinding.Path   = new PropertyPath(this.ItemsSourcePath);
            }
            else
            {
                itemsSourceBinding.Path   = new PropertyPath("ItemsSource");
                itemsSourceBinding.Source = this;
            }

            var displayMemberPathBinding = new Binding
            {
                Path   = new PropertyPath("DisplayMemberPath"),
                Source = this
            };

            var selectedValuePathBinding = new Binding
            {
                Path   = new PropertyPath("SelectedValuePath"),
                Source = this
            };

            editorContent.SetBinding(ComboBox.ItemsSourceProperty, itemsSourceBinding);
            editorContent.SetBinding(ComboBox.DisplayMemberPathProperty, displayMemberPathBinding);
            editorContent.SetBinding(ComboBox.SelectedValuePathProperty, selectedValuePathBinding);

            if (!string.IsNullOrEmpty(this.SelectedValuePath))
            {
                var source = (editorContent as ComboBox).ItemsSource as IEnumerable <object>;

                if (source.Any())
                {
                    var comboBoxValueGetter = BindingExpressionHelper.CreateGetValueFunc(source.First().GetType(), this.SelectedValuePath);
                    var selectedItem        = source.FirstOrDefault(x =>
                    {
                        var selectedItemValue = comboBoxValueGetter(x)?.Equals(this.GetValueForInstance(item));

                        return(selectedItemValue ?? false);
                    });

                    (editorContent as ComboBox).SelectedItem = selectedItem;
                    editorContent.SetBinding(ComboBox.SelectedValueProperty, binding);
                }
            }
            else
            {
                editorContent.SetBinding(ComboBox.SelectedItemProperty, binding);
            }
        }
        public DirectoryTree()
        {
            InitializeComponent();
            if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
            {
                return;
            }

            DataContext             = RootModel = new DirectoryTreeViewModel();
            RootModel.RootDirectory = DirectoryInfoEx.DesktopDirectory;
            Commands = new DirectoryTreeCommands(this, RootModel);

            RootModel.OnProgress += (ProgressEventHandler) delegate(object sender, ProgressEventArgs e)
            {
                this.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new ThreadStart(delegate
                {
                    RaiseEvent(new ProgressRoutedEventArgs(ProgressEvent, e));
                }));
            };

            W7TreeViewItemUtils.SetIsEnabled(this, true);

            #region Selection
            this.AddHandler(TreeViewItem.SelectedEvent, new RoutedEventHandler(
                                (RoutedEventHandler) delegate(object obj, RoutedEventArgs args)
            {
                if (SelectedValue is DirectoryTreeItemViewModel)
                {
                    DirectoryTreeItemViewModel selectedModel = SelectedValue as DirectoryTreeItemViewModel;
                    SelectedDirectory = selectedModel.EmbeddedDirectoryModel.EmbeddedDirectoryEntry;
                    if (args.OriginalSource is TreeViewItem)
                    {
                        (args.OriginalSource as TreeViewItem).BringIntoView();
                    }

                    _lastSelectedContainer = (args.OriginalSource as TreeViewItem);
                }
            }));

            //this.SelectedDirectoryPath <---> this.SelectedDirectory
            Binding selectedDirectoryPathBinding = new Binding("SelectedDirectory");
            selectedDirectoryPathBinding.Mode                = BindingMode.TwoWay;
            selectedDirectoryPathBinding.Converter           = new ExToStringConverter();
            selectedDirectoryPathBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            selectedDirectoryPathBinding.Source              = this;
            this.SetBinding(DirectoryTree.SelectedDirectoryPathProperty, selectedDirectoryPathBinding);

            //this.SelectedDirectory <---> RootModel.SelectedDirectory
            Binding selectedDirectoryBinding = new Binding("SelectedDirectory");
            selectedDirectoryBinding.Mode = BindingMode.TwoWay;
            selectedDirectoryBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            selectedDirectoryBinding.Source = RootModel;
            this.SetBinding(DirectoryTree.SelectedDirectoryProperty, selectedDirectoryBinding);

            //this.AutoCollapse <---> RootModel.AutoCollapse
            Binding autoCollapseBinding = new Binding("AutoCollapse");
            autoCollapseBinding.Mode = BindingMode.OneWayToSource;
            autoCollapseBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            autoCollapseBinding.Source = RootModel;
            this.SetBinding(DirectoryTree.AutoCollapseProperty, autoCollapseBinding);
            #endregion

            #region ContextMenuWrapper - Obsoluted
            //_cmw = new ContextMenuWrapper();

            //this.AddHandler(TreeViewItem.MouseRightButtonUpEvent, new MouseButtonEventHandler(
            //    (MouseButtonEventHandler)delegate(object sender, MouseButtonEventArgs args)
            //    {
            //        if (SelectedValue is DirectoryTreeItemViewModel)
            //        {
            //            DirectoryTreeItemViewModel selectedModel = SelectedValue as DirectoryTreeItemViewModel;
            //            Point pt = this.PointToScreen(args.GetPosition(this));
            //            string command = _cmw.Popup(new FileSystemInfoEx[] { selectedModel.EmbeddedDirectoryModel.EmbeddedDirectoryEntry },
            //                new System.Drawing.Point((int)pt.X, (int)pt.Y));
            //            switch (command)
            //            {
            //                case "rename":
            //                    if (this.SelectedValue != null)
            //                    {
            //                        if (_lastSelectedContainer != null)
            //                        {
            //                            SetIsEditing(_lastSelectedContainer, true);
            //                        }
            //                    }
            //                    break;
            //                case "refresh":
            //                    if (this.SelectedValue is DirectoryTreeItemViewModel)
            //                    {
            //                        (this.SelectedValue as DirectoryTreeItemViewModel).Refresh();
            //                    }
            //                    break;
            //            }
            //        }
            //    }));
            #endregion
        }
Ejemplo n.º 34
0
 public HotelServiceClient(Binding binding, EndpointAddress address) : base(binding, address)
 {
 }
 public Workday_ConnectPortClient(Binding binding, EndpointAddress remoteAddress) : base(binding, remoteAddress)
 {
 }
Ejemplo n.º 36
0
 public static bool HasSSLFlags(this Binding binding, SSLFlags flags)
 {
     return (binding.SSLFlags() & flags) == flags;
 }
Ejemplo n.º 37
0
        private static void AddBindingConfiguration(CodeStatementCollection statements, Binding binding)
        {
            BasicHttpBinding basicHttp = binding as BasicHttpBinding;

            if (basicHttp != null)
            {
                AddBasicHttpBindingConfiguration(statements, basicHttp);
                return;
            }

            NetHttpBinding netHttp = binding as NetHttpBinding;

            if (netHttp != null)
            {
                AddNetHttpBindingConfiguration(statements, netHttp);
                return;
            }

            NetTcpBinding netTcp = binding as NetTcpBinding;

            if (netTcp != null)
            {
                AddNetTcpBindingConfiguration(statements, netTcp);
                return;
            }

            CustomBinding custom = binding as CustomBinding;

            if (custom != null)
            {
                AddCustomBindingConfiguration(statements, custom);
                return;
            }

            WSHttpBinding httpBinding = binding as WSHttpBinding;

            if (httpBinding != null)
            {
                AddCustomBindingConfiguration(statements, new CustomBinding(httpBinding));
                return;
            }

            throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, SR.ErrBindingTypeNotSupportedFormat, binding.GetType().FullName));
        }
Ejemplo n.º 38
0
        /// <summary>
        /// 创建传输协议
        /// </summary>
        /// <param name="binding">传输协议名称</param>
        /// <returns></returns>
        private static Binding CreateBinding(string binding)
        {
            Binding bindinginstance = null;

            if (binding.ToLower() == "basichttpbinding")
            {
                BasicHttpBinding ws = new BasicHttpBinding();
                ws.MaxBufferSize          = 2147483647;
                ws.MaxBufferPoolSize      = 2147483647;
                ws.MaxReceivedMessageSize = 2147483647;
                ws.ReaderQuotas.MaxStringContentLength = 2147483647;
                ws.CloseTimeout   = new TimeSpan(0, 10, 0);
                ws.OpenTimeout    = new TimeSpan(0, 10, 0);
                ws.ReceiveTimeout = new TimeSpan(0, 10, 0);
                ws.SendTimeout    = new TimeSpan(0, 10, 0);

                bindinginstance = ws;
            }
            else if (binding.ToLower() == "netnamedpipebinding")
            {
                NetNamedPipeBinding ws = new NetNamedPipeBinding();
                ws.MaxReceivedMessageSize = 2147483647;
                bindinginstance           = ws;
            }
            else if (binding.ToLower() == "netpeertcpbinding")
            {
                NetPeerTcpBinding ws = new NetPeerTcpBinding();
                ws.MaxReceivedMessageSize = 2147483647;
                bindinginstance           = ws;
            }
            else if (binding.ToLower() == "nettcpbinding")
            {
                NetTcpBinding ws = new NetTcpBinding();
                ws.MaxReceivedMessageSize = 2147483647;
                ws.Security.Mode          = SecurityMode.None;
                bindinginstance           = ws;
            }
            else if (binding.ToLower() == "wsdualhttpbinding")
            {
                WSDualHttpBinding ws = new WSDualHttpBinding();
                ws.MaxReceivedMessageSize = 2147483647;

                bindinginstance = ws;
            }
            else if (binding.ToLower() == "webhttpbinding")
            {
                //WebHttpBinding ws = new WebHttpBinding();
                //ws.MaxReceivedMessageSize = 65535000;
                //bindinginstance = ws;
            }
            else if (binding.ToLower() == "wsfederationhttpbinding")
            {
                WSFederationHttpBinding ws = new WSFederationHttpBinding();
                ws.MaxReceivedMessageSize = 2147483647;
                bindinginstance           = ws;
            }
            else if (binding.ToLower() == "wshttpbinding")
            {
                WSHttpBinding ws = new WSHttpBinding(SecurityMode.None);
                ws.MaxReceivedMessageSize = 2147483647;
                ws.Security.Message.ClientCredentialType   = System.ServiceModel.MessageCredentialType.Windows;
                ws.Security.Transport.ClientCredentialType = System.ServiceModel.HttpClientCredentialType.Windows;
                bindinginstance = ws;
            }
            return(bindinginstance);
        }
        private void SetupDragManager()
        {
            var dataGridContext = this.DataGridContext;

            // Can be null in design-time (edition of a style TargetType ColumnManagerCell).
            if (dataGridContext == null)
            {
                return;
            }

            // We do not support DragDrop when there are no AdornerLayer because there wouldn't be any visual feedback for the operation.
            AdornerLayer adornerLayer = AdornerLayer.GetAdornerLayer(this);

            if (adornerLayer == null)
            {
                // When virtualizing, the Cell is not yet in the VisualTree because it is the ParentRow's CellsHost which
                // is reponsible of putting them in the VisualTree. We try to get the adorner from the ParentRow instead
                if (this.ParentRow != null)
                {
                    adornerLayer = AdornerLayer.GetAdornerLayer(this.ParentRow);
                }

                if (adornerLayer == null)
                {
                    return;
                }
            }

            var dataGridControl = dataGridContext.DataGridControl;

            if (dataGridControl == null)
            {
                return;
            }

            if (m_dragSourceManager != null)
            {
                m_dragSourceManager.PropertyChanged -= this.DragSourceManager_PropertyChanged;
            }

            // The DataGridControl's AdornerDecoratorForDragAndDrop must be used for dragging in order to include the RenderTransform
            // the DataGridControl may performs. This AdornerDecorator is defined in the ControlTemplate as PART_DragDropAdornerDecorator
            if ((dataGridControl.DragDropAdornerDecorator != null) && (dataGridControl.DragDropAdornerDecorator.AdornerLayer != null))
            {
                m_dragSourceManager = new ColumnReorderingDragSourceManager(this, dataGridControl.DragDropAdornerDecorator.AdornerLayer, dataGridControl, this.ParentRow.LevelCache);
            }
            else
            {
                m_dragSourceManager = new ColumnReorderingDragSourceManager(this, null, dataGridControl, this.ParentRow.LevelCache);
            }

            m_dragSourceManager.PropertyChanged += this.DragSourceManager_PropertyChanged;

            // Create bindings to ViewProperties for AutoScroll Properties
            Binding binding = new Binding();

            binding.Path   = new PropertyPath("(0).(1)", DataGridControl.DataGridContextProperty, TableView.AutoScrollIntervalProperty);
            binding.Mode   = BindingMode.OneWay;
            binding.Source = this;
            BindingOperations.SetBinding(m_dragSourceManager, DragSourceManager.AutoScrollIntervalProperty, binding);

            binding        = new Binding();
            binding.Path   = new PropertyPath("(0).(1)", DataGridControl.DataGridContextProperty, TableView.AutoScrollTresholdProperty);
            binding.Mode   = BindingMode.OneWay;
            binding.Source = this;
            BindingOperations.SetBinding(m_dragSourceManager, DragSourceManager.AutoScrollTresholdProperty, binding);
        }
Ejemplo n.º 40
0
        static FrameworkElement GetUIOptionValue(int opt, JObject root)
        {
            Option option = (Option)opt;

            JProperty        jprop = GetJProperty(option, root);
            FrameworkElement ret   = null;

            try
            {
                switch (option)
                {
                case Option.encode_type:
                {
                    Dictionary <string, int> dic = new Dictionary <string, int>()
                    {
                        { "binary", 0 }
                        , { "ASCII", 1 }
                    };
                    ComboBox cb = new ComboBox()
                    {
                        SelectedIndex = 0
                    };
                    var e = dic.GetEnumerator();
                    while (e.MoveNext())
                    {
                        cb.Items.Add(e.Current.Key);
                    }


                    cb.DataContext = jprop.Parent;
                    Binding bd = new Binding(option.ToString());
                    bd.Mode      = BindingMode.TwoWay;
                    bd.Converter = new StringToInt64Converter();
                    cb.SetBinding(ComboBox.SelectedIndexProperty, bd);

                    cb.SelectedIndex = Convert.ToInt32(jprop.Value);

                    cb.SelectionChanged += delegate
                    {
                        ConfigOptionManager.bChanged = true;
                    };
                    ret = cb;
                }
                break;

                case Option.sid:
                case Option.item:
                case Option.schedule_time:
                case Option.delay_time:
                {
                    TextBox tb = new TextBox() /*Text = optionValue.ToString()*/ }
                    {
                        ;
                        tb.Width = ConfigOptionSize.WIDTH_VALUE;
                        tb.HorizontalAlignment = HorizontalAlignment.Left;
                        ret = tb;

                        tb.DataContext = jprop.Parent;
                        Binding bd = new Binding(option.ToString());
                        bd.Mode = BindingMode.TwoWay;
                        // TextBox.Text 의 UpdateSourceTrigger 의 기본속성은 LostFocus 이다.
                        bd.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                        tb.SetBinding(TextBox.TextProperty, bd);

                        tb.Text = Convert.ToString(jprop.Value);

                        tb.TextChanged += delegate
                        {
                            //((JValue)optionValue).Value = tb.Text;
                            ConfigOptionManager.bChanged = true;
                        };
                }
                break;

                case Option.log_console_yn:
                case Option.header_file_save_yn:
                case Option.file_reserver_yn:
                case Option.dir_monitoring_yn:
                case Option.verify_yn:
                case Option.result_log_yn:
                case Option.dir_recursive_yn:
                {
                    ToggleSwitch ts = new ToggleSwitch() /*IsChecked = (bool)optionValue*/ }
                    {
                        ;
                        ts.Width = ConfigOptionSize.WIDTH_VALUE;
                        ts.HorizontalAlignment = HorizontalAlignment.Left;

                        ts.FontSize = 13;
                        ts.OffLabel = "False";
                        ts.OnLabel  = "True";
                        ts.Style    = (Style)App.Current.Resources["MahApps.Metro.Styles.ToggleSwitch.Win10"];

                        //if(panelDetailOption.RowDefinitions.Count > 0)
                        //	Grid.SetRow(ts, panelDetailOption.RowDefinitions.Count - 1);
                        //Grid.SetColumn(ts, 1);
                        ret = ts;

                        ts.DataContext = jprop.Parent;
                        Binding bd = new Binding(option.ToString());
                        bd.Mode      = BindingMode.TwoWay;
                        bd.Converter = new OnlyBooleanConverter();
                        ts.SetBinding(ToggleSwitch.IsCheckedProperty, bd);

                        ts.IsChecked = Convert.ToBoolean(jprop.Value);

                        ts.Checked += delegate
                        {
                            //((JValue)optionValue).Value = ts.IsChecked;
                            ConfigOptionManager.bChanged = true;
                        };
                        ts.Unchecked += delegate
                        {
                            //((JValue)optionValue).Value = ts.IsChecked;
                            ConfigOptionManager.bChanged = true;
                        };
                }
                break;

                case Option.dir_monitoring_term:
                case Option.dir_recursive_max_depth:
                {
                    NumericUpDown tb_integer = new NumericUpDown() /*Value = (System.Int64)optionValue*/ }
                    {
                        ;
                        tb_integer.Width = ConfigOptionSize.WIDTH_VALUE;
                        tb_integer.HorizontalAlignment = HorizontalAlignment.Left;

                        //if(panelDetailOption.RowDefinitions.Count > 0)
                        //	Grid.SetRow(tb_integer, panelDetailOption.RowDefinitions.Count - 1);
                        //Grid.SetColumn(tb_integer, 1);
                        ret = tb_integer;

                        tb_integer.DataContext = jprop.Parent;
                        Binding bd = new Binding(option.ToString());
                        bd.Mode      = BindingMode.TwoWay;
                        bd.Converter = new OnlyInt64Converter();
                        tb_integer.SetBinding(NumericUpDown.ValueProperty, bd);

                        tb_integer.Value = Convert.ToInt64(jprop.Value);

                        tb_integer.ValueChanged += delegate
                        {
                            //((JValue)optionValue).Value = (System.Int64)tb_integer.Value;
                            ConfigOptionManager.bChanged = true;
                        };
                }
                break;

                default:
                    break;
                }

                if (jprop != null && jprop.Name[0] == ConfigOptionManager.StartDisableProperty &&
                    Root[jprop.Name.TrimStart(ConfigOptionManager.StartDisableProperty)] != null &&
                    Root[jprop.Name.TrimStart(ConfigOptionManager.StartDisableProperty)].Parent != null)
                {
                    Root[jprop.Name.TrimStart(ConfigOptionManager.StartDisableProperty)].Parent.Remove();
                }
            }
            catch (Exception e)
            {
                Log.PrintError(e.Message + " (\"" + option.ToString() + "\" : \"" + jprop + "\")", "UserControls.ConfigOption.File.comm_option.GetUIOptionValue");
            }

            if (ret != null)
            {
                ret.Width               = 150;
                ret.Margin              = new Thickness(10, 3, 10, 3);
                ret.VerticalAlignment   = VerticalAlignment.Center;
                ret.HorizontalAlignment = HorizontalAlignment.Left;
            }
            return(ret);
        }
Ejemplo n.º 41
0
        public void buildOSView(Panel tar, ObjectStructure os, int depth)
        {
            if (depth == 0)
            {
                tar.Children.Clear();
            }
            int c = 0;

            foreach (Object o in os.FIELDS)
            {
                //TODO: Switch statement
                if (o is bool)
                {
                    FieldSnippets.fsnipBool fsb = new FieldSnippets.fsnipBool();
                    fsb.labelTitle.Content = os.fieldexportnames[c];
                    fsb.toggleVal.Content  = os.fieldexportnames[c][0];

                    fsb.toggleVal.DataContext = os;
                    fsb.toggleVal.SetBinding(ToggleButton.IsCheckedProperty,
                                             new Binding()
                    {
                        Path = new PropertyPath("FIELDS[" + c + "]"), Source = os
                    });

                    //fsb.container.Width = 400 - (depth * 100);

                    tar.Children.Add(fsb);
                    c++;

                    continue;
                }

                if (o is Int64 || o is int || o is Int32)
                {
                    FieldSnippets.fsnipNumber fsn = new FieldSnippets.fsnipNumber(false);

                    fsn.labelTitle.Content = os.fieldexportnames[c];

                    Binding intBinding = new Binding();
                    intBinding.Path      = new PropertyPath("FIELDS[" + c + "]");
                    intBinding.Source    = os;
                    intBinding.Converter = new Misc.IntegerConverter();

                    fsn.numVal.SetBinding(TextBox.TextProperty,
                                          intBinding);

                    //fsn.container.Width = 400 - (depth * 200);

                    tar.Children.Add(fsn);

                    c++;
                    continue;
                }

                if (o is float || o is double)
                {
                    FieldSnippets.fsnipNumber fsn = new FieldSnippets.fsnipNumber(false);

                    Binding intBinding = new Binding();
                    intBinding.Path      = new PropertyPath("FIELDS[" + c + "]");
                    intBinding.Source    = os;
                    intBinding.Converter = new Misc.FloatConverter();

                    fsn.numVal.SetBinding(TextBox.TextProperty,
                                          intBinding);

                    fsn.container.Width = 400 - (depth * 200);

                    tar.Children.Add(fsn);

                    c++;
                    continue;
                }

                if (o is string)
                {
                    FieldSnippets.fsnipString fss = new FieldSnippets.fsnipString(3);

                    fss.title.Text            = os.fieldexportnames[c];
                    fss.textValue.DataContext = os;

                    Binding textBind = new Binding();
                    textBind.Path   = new PropertyPath("FIELDS[" + c + "]");
                    textBind.Source = os;
                    textBind.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;

                    fss.textValue.SetBinding(TextBox.TextProperty,
                                             textBind);

                    tar.Children.Add(fss);

                    c++;
                    continue;
                }

                if (o is EnumField)
                {
                    FieldSnippets.fsnipEnum es = new FieldSnippets.fsnipEnum();
                    EnumField ef = o as EnumField;
                    es.labelTitle.Content = os.fieldexportnames[c];

                    Binding options = new Binding();
                    options.Path   = new PropertyPath("fields");
                    options.Source = em.getEnum(ef.reference);

                    Binding value = new Binding();
                    value.Path   = new PropertyPath("selected");
                    value.Source = ef;

                    es.comboEnum.SetBinding(ComboBox.ItemsSourceProperty, options);
                    es.comboEnum.SetBinding(ComboBox.SelectedIndexProperty, value);

                    tar.Children.Add(es);
                    c++;
                    continue;
                }

                if (o is Misc.FilePathStructure)
                {
                    Misc.FilePathStructure    fp = o as Misc.FilePathStructure;
                    FieldSnippets.fsnipSprite sp = new FieldSnippets.fsnipSprite(fp);


                    Binding lhs = new Binding();
                    lhs.Path   = new PropertyPath("PATH");
                    lhs.Source = o;
                    lhs.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;

                    Binding rhs = new Binding();
                    rhs.Path   = new PropertyPath("PATH");
                    rhs.Source = o;
                    rhs.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;

                    sp.Path.SetBinding(TextBox.TextProperty, lhs);
                    sp.Render.SetBinding(Image.SourceProperty, rhs);

                    tar.Children.Add(sp);
                    c++;
                    continue;
                }

                if (o is Misc.CodeStructure)
                {
                    Misc.CodeStructure      fp  = o as Misc.CodeStructure;
                    FieldSnippets.fsnipCode cde = new FieldSnippets.fsnipCode();
                    cde.title.Text = os.fieldexportnames[c];

                    Binding lhs = new Binding();
                    lhs.Path   = new PropertyPath("CODE");
                    lhs.Source = o;
                    lhs.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;

                    cde.codeBox.SetBinding(BindableAvalonEditor.TextProperty, lhs);

                    tar.Children.Add(cde);
                    c++;
                    continue;
                }

                if (o is TagField)
                {
                    TagField tf = o as TagField;
                    FieldSnippets.fsnipTags es = new FieldSnippets.fsnipTags(TagManager.tags["Global"], tf);

                    es.tagList.DataContext = o;
                    Binding textBind = new Binding();
                    textBind.Path                = new PropertyPath("value");
                    textBind.Source              = o;
                    textBind.Converter           = new Misc.TagChipConverter(tf.value);
                    textBind.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;

                    es.tagList.SetBinding(ListView.ItemsSourceProperty,
                                          textBind);

                    //es.tagList.SetBinding(ListView.ItemsSourceProperty, value);

                    tar.Children.Add(es);
                    c++;
                    continue;
                }



                if (o is ObjectHeader)
                {
                    FieldSnippets.fsnipHeader fsh = new FieldSnippets.fsnipHeader((o as ObjectHeader).Name);
                    tar.Children.Add(fsh);
                    c++;
                    continue;
                }

                if (o is intArray)
                {
                    FieldSnippets.fsnipIntArray fsh = new FieldSnippets.fsnipIntArray();

                    Binding binding = new Binding();
                    binding.Path   = new PropertyPath("FIELDS[" + c + "]");
                    binding.Source = os;

                    //fsh.SetBinding(FieldSnippets.fsnipIntArray.ValuesProperty,
                    //    binding);

                    tar.Children.Add(fsh);
                    c++;
                    continue;
                }

                if (o is OReference)
                {
                    FieldSnippets.fsnipOReferenceSingleton fsor = new FieldSnippets.fsnipOReferenceSingleton("Spells", o as OReference,
                                                                                                             database.data[(o as OReference).getRA()]);

                    //fsor.lView.ItemsSource = ((OReferenceList)o).refnames;

                    MultiBinding mb = new MultiBinding();

                    Binding lhs = new Binding();
                    lhs.Path   = new PropertyPath("REF");
                    lhs.Source = o;

                    Binding rhs = new Binding();
                    rhs.Source = database.data[(o as OReference).getRA()];

                    mb.Bindings.Add(lhs);
                    mb.Bindings.Add(rhs);

                    mb.Converter = new Misc.ORefSingleConverter();


                    fsor.textDisplay.DataContext = o;
                    fsor.textDisplay.SetBinding(Label.ContentProperty,
                                                mb);


                    tar.Children.Add(fsor);
                    c++;
                    continue;
                }

                if (o is OReferenceList)
                {
                    FieldSnippets.fsnipOReference fsor = new FieldSnippets.fsnipOReference("Spells", o as OReferenceList,
                                                                                           database.data[(o as OReferenceList).getRA()]);

                    //fsor.lView.ItemsSource = ((OReferenceList)o).refnames;

                    MultiBinding mb = new MultiBinding();

                    Binding lhs = new Binding();
                    lhs.Path   = new PropertyPath("REFS");
                    lhs.Source = o;

                    Binding rhs = new Binding();
                    rhs.Source = database.data[(o as OReferenceList).getRA()];

                    mb.Bindings.Add(lhs);
                    mb.Bindings.Add(rhs);

                    mb.Converter = new Misc.ORefConverter();


                    fsor.lView.DataContext = o;
                    fsor.lView.SetBinding(ListView.ItemsSourceProperty,
                                          mb);


                    tar.Children.Add(fsor);
                    c++;
                    continue;
                }

                if (o is Misc.TupleStructure)
                {
                    Grid g = new Grid();
                    g.Background          = new SolidColorBrush(Color.FromArgb(255, (byte)255, (byte)255, (byte)0));
                    g.HorizontalAlignment = HorizontalAlignment.Stretch;
                    g.Margin            = new Thickness(0);
                    g.UseLayoutRounding = false;

                    Console.WriteLine((o as Misc.TupleStructure).fields.Count + " fc");
                    int gc = 0;
                    foreach (ObjectStructure tb in (o as Misc.TupleStructure).fields)
                    {
                        g.ColumnDefinitions.Add(new ColumnDefinition());
                        Grid sp = new Grid();
                        sp.HorizontalAlignment = HorizontalAlignment.Stretch;
                        sp.Background          = new SolidColorBrush(Color.FromArgb(255, (byte)0, (byte)255, (byte)255));

                        buildOSView(sp, tb, 1);

                        Grid.SetColumn(sp, gc);
                        g.Children.Add(sp);
                        gc++;
                    }

                    tar.Children.Add(g);
                }

                if (o is Color)
                {
                    Color col = (Color)o;

                    Binding colorBinding = new Binding();
                    colorBinding.Path      = new PropertyPath("FIELDS[" + c + "]");
                    colorBinding.Source    = os;
                    colorBinding.Converter = new Misc.FloatConverter();

                    FieldSnippets.fsnipColor colSnip = new FieldSnippets.fsnipColor();
                    colSnip.picker.SetBinding(ColorPicker.ColorProperty, colorBinding);


                    tar.Children.Add(colSnip);
                }

                if (o is ArrayStructure)
                {
                    FieldSnippets.fsnipArray fsor = new FieldSnippets.fsnipArray((o as ArrayStructure).pureName.Split(' ')[1], this, o as ArrayStructure);

                    fsor.lView.DataContext = os;
                    Binding itemBind = new Binding();
                    itemBind.Path   = new PropertyPath("REFS");
                    itemBind.Source = o;
                    itemBind.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
                    itemBind.Converter           = new Misc.AStructConverter(this, (ArrayStructure)o);



                    fsor.lView.SetBinding(ListView.ItemsSourceProperty,
                                          itemBind);

                    tar.Children.Add(fsor);
                    c++;
                    continue;
                }

                if (o is Misc.WeightedGroup)
                {
                    FieldSnippets.fsnipSlider fsor = new FieldSnippets.fsnipSlider();

                    Binding lhs = new Binding();
                    lhs.Path   = new PropertyPath("POINTS");
                    lhs.Source = o;
                    lhs.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;

                    Binding rhs = new Binding();
                    rhs.Path   = new PropertyPath("points");
                    rhs.Source = (o as Misc.WeightedGroup).tiedWP;
                    rhs.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;

                    fsor.Slider.SetBinding(Slider.ValueProperty, lhs);
                    fsor.NumDisplay.SetBinding(Label.ContentProperty, lhs);
                    fsor.Slider.SetBinding(Slider.MaximumProperty, rhs);

                    tar.Children.Add(fsor);
                    c++;
                    continue;
                }
            }
        }
Ejemplo n.º 42
0
 public HostGovernor(Node node, Binding binding = null) : base(node, binding)
 {
     ctor();
 }
Ejemplo n.º 43
0
 public void GenerateBinding(Binding binding,
                             out string bindingSectionName,
                             out string configurationName)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 44
0
    public static void Main()
    {
        ServiceDescription myDescription = ServiceDescription.Read("AddNumbers1.wsdl");

        // Create the 'Binding' object.
        Binding myBinding = new Binding();

        myBinding.Name = "Service1HttpPost";
        XmlQualifiedName qualifiedName = new XmlQualifiedName("s0:Service1HttpPost");

        myBinding.Type = qualifiedName;

// <Snippet1>
// <Snippet2>

        // Create the 'HttpBinding' object.
        HttpBinding myHttpBinding = new HttpBinding();

        myHttpBinding.Verb = "POST";
        // Add the 'HttpBinding' to the 'Binding'.
        myBinding.Extensions.Add(myHttpBinding);
// </Snippet2>
// </Snippet1>


        // Create the 'OperationBinding' object.
        OperationBinding myOperationBinding = new OperationBinding();

        myOperationBinding.Name = "AddNumbers";

        HttpOperationBinding myOperation = new HttpOperationBinding();

        myOperation.Location = "/AddNumbers";
        // Add the 'HttpOperationBinding' to 'OperationBinding'.
        myOperationBinding.Extensions.Add(myOperation);

        // Create the 'InputBinding' object.
        InputBinding       myInput = new InputBinding();
        MimeContentBinding postMimeContentbinding = new MimeContentBinding();

        postMimeContentbinding.Type = "application/x-www-form-urlencoded";
        myInput.Extensions.Add(postMimeContentbinding);
        // Add the 'InputBinding' to 'OperationBinding'.
        myOperationBinding.Input = myInput;
        // Create the 'OutputBinding' object.
        OutputBinding  myOutput           = new OutputBinding();
        MimeXmlBinding postMimeXmlbinding = new MimeXmlBinding();

        postMimeXmlbinding.Part = "Body";
        myOutput.Extensions.Add(postMimeXmlbinding);

        // Add the 'OutPutBinding' to 'OperationBinding'.
        myOperationBinding.Output = myOutput;

        // Add the 'OperationBinding' to 'Binding'.
        myBinding.Operations.Add(myOperationBinding);

        // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'.
        myDescription.Bindings.Add(myBinding);

        // Create  a 'Port' object.
        Port postPort = new Port();

        postPort.Name    = "Service1HttpPost";
        postPort.Binding = new XmlQualifiedName("s0:Service1HttpPost");

// <Snippet3>
// <Snippet4>

        // Create the 'HttpAddressBinding' object.
        HttpAddressBinding postAddressBinding = new HttpAddressBinding();

        postAddressBinding.Location = "http://localhost/Service1.asmx";

        // Add the 'HttpAddressBinding' to the 'Port'.
        postPort.Extensions.Add(postAddressBinding);
// </Snippet4>
// </Snippet3>


        // Add the 'Port' to 'PortCollection' of 'ServiceDescription'.
        myDescription.Services[0].Ports.Add(postPort);

        // Create a a 'PortType' object.
        PortType postPortType = new PortType();

        postPortType.Name = "Service1HttpPost";

        Operation postOperation = new Operation();

        postOperation.Name = "AddNumbers";

        OperationMessage postInput = (OperationMessage) new OperationInput();

        postInput.Message = new XmlQualifiedName("s0:AddNumbersHttpPostIn");
        OperationMessage postOutput = (OperationMessage) new OperationOutput();

        postOutput.Message = new XmlQualifiedName("s0:AddNumbersHttpPostOut");

        postOperation.Messages.Add(postInput);
        postOperation.Messages.Add(postOutput);

        // Add the 'Operation' to 'PortType'.
        postPortType.Operations.Add(postOperation);

        // Adds the 'PortType' to 'PortTypeCollection' of 'ServiceDescription'.
        myDescription.PortTypes.Add(postPortType);

        // Create  the 'Message' object.
        Message postMessage1 = new Message();

        postMessage1.Name = "AddNumbersHttpPostIn";
        // Create the 'MessageParts'.
        MessagePart postMessagePart1 = new MessagePart();

        postMessagePart1.Name = "firstnumber";
        postMessagePart1.Type = new XmlQualifiedName("s:string");

        MessagePart postMessagePart2 = new MessagePart();

        postMessagePart2.Name = "secondnumber";
        postMessagePart2.Type = new XmlQualifiedName("s:string");
        // Add the 'MessagePart' objects to 'Messages'.
        postMessage1.Parts.Add(postMessagePart1);
        postMessage1.Parts.Add(postMessagePart2);

        // Create another 'Message' object.
        Message postMessage2 = new Message();

        postMessage2.Name = "AddNumbersHttpPostOut";

        MessagePart postMessagePart3 = new MessagePart();

        postMessagePart3.Name    = "Body";
        postMessagePart3.Element = new XmlQualifiedName("s0:int");
        // Add the 'MessagePart' to 'Message'
        postMessage2.Parts.Add(postMessagePart3);

        // Add the 'Message' objects to 'ServiceDescription'.
        myDescription.Messages.Add(postMessage1);
        myDescription.Messages.Add(postMessage2);

        // Write the 'ServiceDescription' as a WSDL file.
        myDescription.Write("AddNumbers.wsdl");
        Console.WriteLine("WSDL file with name 'AddNumber.Wsdl' file created Successfully");
    }
Ejemplo n.º 45
0
 public HeaderClientBase(H header, Binding binding, EndpointAddress remoteAddress) : base(binding, remoteAddress)
 {
     Header = header;
 }
Ejemplo n.º 46
0
 public T CreateProxy(Binding binding, EndpointAddress address)
 {
     return(_generator.CreateInterfaceProxyWithoutTarget <T>(new WcfInterceptor <T>(binding, address)));
 }
Ejemplo n.º 47
0
 public HeaderClientBase(Binding binding, EndpointAddress remoteAddress) : this(default(H), binding, remoteAddress)
 {
 }
        public GridLineAnswer(int number, Answer currentAnswer)
        {
            // Колонки для основного Grid
            this.ColumnDefinitions.Add(new ColumnDefinition
            {
                Width = new GridLength(10.0, GridUnitType.Star)
            });
            this.ColumnDefinitions.Add(new ColumnDefinition
            {
                Width = new GridLength(1.0, GridUnitType.Star)
            });
            this.ColumnDefinitions.Add(new ColumnDefinition
            {
                Width = new GridLength(1.0, GridUnitType.Star)
            });


            // "Главная " кнопка
            button = new Button {
                Style = (Style)(this.Resources["styleButtonForList"])
            };
            // grid внутри главной кнопки
            gridLineButton = new Grid
            {
                Background = Brushes.White
            };
            // Колонки главной кнопки.
            gridLineButton.ColumnDefinitions.Add(new ColumnDefinition
            {
                Width = new GridLength(1.0, GridUnitType.Star)
            });
            gridLineButton.ColumnDefinitions.Add(new ColumnDefinition
            {
                Width = new GridLength(10.0, GridUnitType.Star)
            });
            gridLineButton.ColumnDefinitions.Add(new ColumnDefinition
            {
                Width = new GridLength(1.0, GridUnitType.Star)
            });


            // Данные главной кнопки
            TextBlockForNumber textBlockNumber = new TextBlockForNumber
            {
                Text = (number + 1).ToString()
            };
            TextBlockForText textBlockQuestionName = new TextBlockForText
            {
                Text         = currentAnswer.ResponseText,
                TextWrapping = TextWrapping.Wrap
            };

            CheckBox checkBox = new CheckBox
            {
                IsEnabled           = false,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Center
            };

            if (currentAnswer.CorrectAnswer == true)
            {
                checkBox.IsChecked = true;
            }
            else
            {
                checkBox.IsChecked = false;
            }

            // Добавление элементов с данными в кнопку.
            gridLineButton.Children.Add(textBlockNumber);
            gridLineButton.Children.Add(textBlockQuestionName);
            gridLineButton.Children.Add(checkBox);

            // Расстановка textBlock по колонкам
            Grid.SetColumn(textBlockNumber, 0);
            Grid.SetColumn(textBlockQuestionName, 1);
            Grid.SetColumn(checkBox, 2);

            // Скрываем зарезервированное место для кнопок админа.
            Grid.SetColumnSpan(button, 3);

            // Добавим в кнопку grid с текстБлоками (в которых данные).
            button.Content = gridLineButton;

            // Для получения id вопроса из кнопки.
            this.QuestionId = currentAnswer.QuestionId;

            // Установка кнопки в первую колонку
            Grid.SetColumn(button, 0);

            // Привяжем grid в кнопке (чтоб растянуть на всю ширину кнопки)
            // к доп. невидимому полю в stackPanel
            Binding binding = new Binding();

            binding.ElementName = "textBlockHiddenForSizeButtonLine";
            binding.Path        = new PropertyPath("ActualWidth");
            gridLineButton.SetBinding(Grid.WidthProperty, binding);

            this.Children.Add(button);
        }
Ejemplo n.º 49
0
        private static void AddLanguageColumn([NotNull] this ICollection <DataGridColumn> columns, [NotNull] DataGridBoundColumn column, [NotNull] Binding languageBinding, Binding flowDirectionBinding)
        {
            Contract.Requires(columns != null);
            Contract.Requires(languageBinding != null);
            Contract.Requires(column != null);

            column.SetElementStyle(languageBinding, flowDirectionBinding);
            column.SetEditingElementStyle(languageBinding, flowDirectionBinding);
            columns.Add(column);
        }
Ejemplo n.º 50
0
        /// <summary>
        /// Generates layer list for a set of <see cref="Layer"/>s in a <see cref="Map"/> or <see cref="Scene"/>
        /// contained in a <see cref="GeoView"/>
        /// </summary>
        internal void Refresh()
        {
            var list = GetTemplateChild("List") as ItemsControl;

            if (list == null)
            {
                return;
            }

            if ((GeoView as MapView)?.Map == null && (GeoView as SceneView)?.Scene == null)
            {
                list.ItemsSource = null;
                return;
            }

            ObservableLayerContentList layers = null;

            if (GeoView is MapView)
            {
                layers = new ObservableLayerContentList(GeoView as MapView, ShowLegendInternal)
                {
                    ReverseOrder = !ReverseLayerOrder,
                };

                Binding b = new Binding();
                b.Source = GeoView;
                b.Path   = new PropertyPath(nameof(MapView.Map));
                b.Mode   = BindingMode.OneWay;
                SetBinding(DocumentProperty, b);
            }
            else if (GeoView is SceneView)
            {
                layers = new ObservableLayerContentList(GeoView as SceneView, ShowLegendInternal)
                {
                    ReverseOrder = !ReverseLayerOrder,
                };

                Binding b = new Binding();
                b.Source = GeoView;
                b.Path   = new PropertyPath(nameof(SceneView.Scene));
                b.Mode   = BindingMode.OneWay;
                SetBinding(DocumentProperty, b);
            }

            if (layers == null)
            {
                list.ItemsSource = null;
                return;
            }

            foreach (var l in layers)
            {
                if (!(l.LayerContent is Layer))
                {
                    continue;
                }

                var layer = l.LayerContent as Layer;
                if (layer.LoadStatus == LoadStatus.Loaded)
                {
                    l.UpdateLayerViewState(GeoView.GetLayerViewState(layer));
                }
            }

            ScaleChanged();
            SetLayerContentList(layers);
            list.ItemsSource = layers;
        }
Ejemplo n.º 51
0
 public UserCreditServiceClient(Binding binding, EndpointAddress remoteAddress) :
     base(binding, remoteAddress)
 {
 }
Ejemplo n.º 52
0
 public ChannelCreator GetChannel(Type contract, Binding binding, EndpointAddress address)
 {
     return(builder.GetChannel(clientModel, contract, binding, address, this));
 }
Ejemplo n.º 53
0
        void InitializeOperandType(InstructionOperandVM instructionOperandVM)
        {
            switch (instructionOperandVM.InstructionOperandType)
            {
            case InstructionOperandType.None:
                Content = null;
                break;

            case InstructionOperandType.SByte:
            case InstructionOperandType.Byte:
            case InstructionOperandType.Int32:
            case InstructionOperandType.Int64:
            case InstructionOperandType.Single:
            case InstructionOperandType.Double:
            case InstructionOperandType.String:
                // Don't cache the TextBox as a field in this class. The error border disappears when
                // switching from a textbox opcode to a non-textbox opcode and back to the textbox
                // again. Only solution seems to be to create a new textbox.
                var textBox = Content as TextBox;
                if (textBox == null)
                {
                    textBox = new TextBox();
                    var binding = new Binding(nameof(InstructionOperandVM) + "." + nameof(InstructionOperandVM.Text) + "." + nameof(InstructionOperandVM.Text.StringValue))
                    {
                        Source = this,
                        ValidatesOnDataErrors = true,
                        ValidatesOnExceptions = true,
                        UpdateSourceTrigger   = UpdateSourceTrigger.PropertyChanged,
                    };
                    textBox.SetBinding(TextBox.TextProperty, binding);
                    binding = new Binding(nameof(TextBoxStyle))
                    {
                        Source = this,
                    };
                    textBox.SetBinding(TextBox.StyleProperty, binding);
                    Content = textBox;
                }
                break;

            case InstructionOperandType.Field:
            case InstructionOperandType.Method:
            case InstructionOperandType.Token:
            case InstructionOperandType.Type:
            case InstructionOperandType.MethodSig:
            case InstructionOperandType.SwitchTargets:
                var button = Content as FastClickButton;
                if (button == null)
                {
                    button = new FastClickButton();
                    var binding = new Binding(nameof(InstructionOperandVM) + "." + nameof(InstructionOperandVM.Other))
                    {
                        Source                = this,
                        Mode                  = BindingMode.OneWay,
                        Converter             = CilObjectConverter.Instance,
                        ValidatesOnDataErrors = true,
                        ValidatesOnExceptions = true,
                        UpdateSourceTrigger   = UpdateSourceTrigger.PropertyChanged,
                    };
                    button.SetBinding(Button.ContentProperty, binding);
                    binding = new Binding(nameof(ButtonStyle))
                    {
                        Source = this,
                    };
                    button.SetBinding(Button.StyleProperty, binding);
                    binding = new Binding(nameof(ButtonCommand))
                    {
                        Source = this,
                    };
                    button.SetBinding(Button.CommandProperty, binding);
                    button.CommandParameter = button;
                    Content = button;
                }
                break;

            case InstructionOperandType.BranchTarget:
            case InstructionOperandType.Local:
            case InstructionOperandType.Parameter:
                var comboBox = Content as ComboBox;
                if (comboBox == null)
                {
                    comboBox = new ComboBox();
                    comboBox.ItemTemplate = (DataTemplate)GetValue(ComboBoxItemTemplateProperty);
                    ComboBoxAttachedProps.SetSelectionBoxItemTemplate(comboBox, (DataTemplate)GetValue(ComboBoxSelectionBoxItemTemplateProperty));
                    var binding = new Binding(nameof(InstructionOperandVM) + "." + nameof(InstructionOperandVM.OperandListVM) + "." + nameof(InstructionOperandVM.OperandListVM.Items))
                    {
                        Source = this,
                    };
                    comboBox.SetBinding(ComboBox.ItemsSourceProperty, binding);
                    binding = new Binding(nameof(InstructionOperandVM) + "." + nameof(InstructionOperandVM.OperandListVM) + "." + nameof(InstructionOperandVM.OperandListVM.SelectedIndex))
                    {
                        Source = this,
                        ValidatesOnDataErrors = true,
                        ValidatesOnExceptions = true,
                        UpdateSourceTrigger   = UpdateSourceTrigger.PropertyChanged,
                    };
                    comboBox.SetBinding(ComboBox.SelectedIndexProperty, binding);
                    binding = new Binding(nameof(ComboBoxStyle))
                    {
                        Source = this,
                    };
                    comboBox.SetBinding(ComboBox.StyleProperty, binding);
                    binding = new Binding(nameof(ComboBoxItemTemplate))
                    {
                        Source = this,
                    };
                    comboBox.SetBinding(ComboBox.ItemTemplateProperty, binding);
                    binding = new Binding(nameof(ComboBoxSelectionBoxItemTemplate))
                    {
                        Source = this,
                    };
                    comboBox.SetBinding(ComboBoxAttachedProps.SelectionBoxItemTemplateProperty, binding);
                    Content = comboBox;
                }
                break;

            default:
                throw new InvalidOperationException();
            }
        }
Ejemplo n.º 54
0
 public HostGovernor(IGlue glue, Node node, Binding binding = null) : base(glue, node, binding)
 {
     ctor();
 }
Ejemplo n.º 55
0
        private void ReDrawMap()
        {
            //: remove existing map lines
            RemoveMapLinesAndTexts();

            //: map area size changes
            MAP.Width  = CellSize * XSize;
            MAP.Height = CellSize * YSize;

            //: rows
            for (int i = 1; i < YSize; i++)
            {
                MAP.Children.Add(new Line()
                {
                    X1     = 0,
                    X2     = MAP.Width,
                    Y1     = i * CellSize,
                    Y2     = i * CellSize,
                    Stroke = new SolidColorBrush()
                    {
                        Color = Colors.Black
                    },
                    StrokeThickness = 1,
                    DataContext     = string.Format("ROW.{0}", i)
                });
            }

            //: columns
            for (int i = 1; i < XSize; i++)
            {
                MAP.Children.Add(new Line
                {
                    X1     = i * CellSize,
                    X2     = i * CellSize,
                    Y1     = 0,
                    Y2     = MAP.Height,
                    Stroke = new SolidColorBrush {
                        Color = Colors.Black
                    },
                    StrokeThickness = 1,
                    DataContext     = string.Format("COL.{0}", i)
                });
            }

            //: row.column location texts
            for (int i = 0; i < YSize; i++)
            {
                for (int j = 0; j < XSize; j++)
                {
                    var txb = new TextBlock
                    {
                        Foreground  = new SolidColorBrush(Colors.Blue),
                        DataContext = string.Format("LBL.{0}.{1}", j, i)
                    };
                    Canvas.SetLeft(txb, j * CellSize);
                    Canvas.SetTop(txb, i * CellSize);
                    Panel.SetZIndex(txb, 10);
                    MAP.Children.Add(txb);

                    Binding bnd = new Binding("ShowLocations");
                    bnd.RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor);
                    bnd.RelativeSource.AncestorType = typeof(UserControls.Map);
                    bnd.Converter = new BooleanToVisibilityConverter();
                    txb.SetBinding(TextBlock.VisibilityProperty, bnd);

                    txb.Inlines.Add(new Italic(new Run(string.Format("{0}.{1}", j, i))));
                }
            }

            if (MapInfo != null)
            {
                //: draw effects
                DrawObjectsOnMap <UserControls.Effect, Models.Custom.Effect>(MapInfo.Effects, 10);

                //: draw characters
                if (!EditorMode)
                {
                    DrawObjectsOnMap <UserControls.Character, Models.Character>(MapInfo.Characters, 40);
                }

                //: draw infos
                DrawObjectsOnMap <UserControls.PointOfInterest, Models.Custom.PointOfInterest>(MapInfo.PointOfInterests, 30);

                //: draw blocks
                DrawObjectsOnMap <UserControls.Block, Models.Custom.Block>(MapInfo.Blocks, 20);

                //: draw doors
                DrawObjectsOnMap <UserControls.Door, Models.Custom.Door>(MapInfo.Doors, 15);

                //: draw walls
                DrawObjectsOnMap <UserControls.Wall, Models.Custom.Wall>(MapInfo.Walls, 15);
            }

            if (EditorMode)
            {
                focused.Visibility = Visibility.Collapsed;
                focusedX           = focusedY = -1;
            }
            else
            {
                //: move focused cell also
                if (focusedX != -1 && focusedY != -1)
                {
                    Canvas.SetLeft(focused, focusedX * CellSize);
                    Canvas.SetTop(focused, focusedY * CellSize);
                }
            }
        }
Ejemplo n.º 56
0
        private void updateIisSite(Website website, Site site)
        {
            var aq = from a in site.Applications
                     where a.Path == "/"
                     select a;

            Application application;

            if (aq.Count() != 0)
            {
                application = aq.First();
                applyApplicationValues(website, application);
            }
            else
            {
                application      = site.Applications.CreateElement();
                application.Path = "/";
                applyApplicationValues(website, application);
                site.Applications.Add(application);
            }

            var vq = from v in application.VirtualDirectories
                     where v.Path == "/"
                     select v;

            VirtualDirectory virtualDirectory;

            if (vq.Count() != 0)
            {
                virtualDirectory = vq.First();
                applyVirtualDirectoryValues(website, virtualDirectory);
            }
            else
            {
                virtualDirectory      = application.VirtualDirectories.CreateElement();
                virtualDirectory.Path = "/";
                applyVirtualDirectoryValues(website, virtualDirectory);
                application.VirtualDirectories.Add(virtualDirectory);
            }

            site.Bindings.Clear();
            foreach (WebsiteHost websiteHost in
                     website.HostArray.Where(h => !RhspData.IsDeleteOrDiscard(h)))
            {
                Binding binding = site.Bindings.CreateElement();
                binding.Protocol           = websiteHost.GetIisProtocol();
                binding.BindingInformation = websiteHost.GetBindingInformation();
                site.Bindings.Add(binding);
            }

            try
            {
                iisManager.CommitChanges();
            }
            catch (Exception ex)
            {
                throw new Exception("Unable to commit changes to IIS site.", ex);
            }

            website.IisSite.SiteID = site.Id;
        }
Ejemplo n.º 57
0
        /// <summary>
        /// コントロールがLoadされてテンプレートが適用されたときに呼び出されるハンドラ
        /// </summary>
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (DesignerProperties.GetIsInDesignMode(this))
            {
                return;
            }

            // 以下の2つのイベントはボタン押下でカレンダー開く→ボタン押下としたときに
            // MouseDownでカレンダーが閉じられ、MouseUpで再度カレンダーが開いてしまう問題に対応
            this.PartsPopup.Opened += this.Popup_Opened;
            this.PartsPopup.Closed += this.Popup_Closed;

            // カレンダーの日付のダブルクリックで選択・カレンダーを閉じる操作を行うためにハンドラを登録
            var ee    = new EventSetter(MouseDoubleClickEvent, new MouseButtonEventHandler(this.CalenderDayButton_MouseDoubleClick));
            var style = this.PartsCalender.CalendarDayButtonStyle;

            if (style == null)
            {
                style = new Style()
                {
                    TargetType = typeof(CalendarDayButton)
                };
            }
            style.Setters.Add(ee);
            this.PartsCalender.CalendarDayButtonStyle = style;

            // 日付テキストボックスのIsReadOnlyとカレンダーを起動するためのボタンのIsEnabledを連動させる
            this.PartsButton.IsEnabled = !this.IsReadOnly;

            // TextプロパティへのBindingが定義されている場合は、デフォルトの表示書式などを定義する
            // UpdateSourceTriggerやNotifyOnValidationErrorなど、基盤側で必要な定義も設定する
            var expression = BindingOperations.GetBindingExpression(this, TextProperty);

            if (expression.IsEmpty())
            {
                return;
            }

            var binding = BindingOperations.GetBinding(this, TextProperty);

            if (binding.IsEmpty())
            {
                // bindingが定義されていない場合は処理しない
                return;
            }

            var newBinding = new Binding(binding.Path.Path)
            {
                Mode = binding.Mode,
                NotifyOnValidationError = true,
                UpdateSourceTrigger     = UpdateSourceTrigger.Explicit,
                ConverterCulture        = CultureInfo.CurrentCulture,
            };

            var displayFormat = string.Empty;
            var x             = this.DataContext?.GetType().GetProperty(expression.ParentBinding?.Path.Path);

            //switch (x.PropertyType)
            //{
            //    case Type intType when intType == typeof(Date):
            //        displayFormat = expression.ParentBinding.StringFormat;
            //        if (displayFormat.IsEmpty())
            //        {
            //            displayFormat = "yyyy/MM/dd";
            //        }
            //        newBinding.Converter = new StringToDateConverter();
            //        newBinding.ValidationRules.Add(new DateValidationRule());
            //        break;

            //    default:
            //        break;
            //}
            if (x.PropertyType == typeof(Date))
            {
                displayFormat = expression.ParentBinding.StringFormat;
                if (displayFormat.IsEmpty())
                {
                    displayFormat = "yyyy/MM/dd";
                }
                newBinding.Converter = new StringToDateConverter();
                newBinding.ValidationRules.Add(new DateValidationRule());
            }
            newBinding.ConverterParameter = displayFormat;
            newBinding.StringFormat       = displayFormat;
            BindingOperations.ClearBinding(this, TextProperty);
            BindingOperations.SetBinding(this, TextProperty, newBinding);
        }
Ejemplo n.º 58
0
 public ConfigurationServiceClient(Binding binding,
                                   EndpointAddress remoteAddress) :
     base(binding, remoteAddress)
 {
 }
Ejemplo n.º 59
0
        private void UpdateGroupedSeries()
        {
            // data validation
            this.Exceptions.Clear();

            // ensure that caption of series is not null, otherwise all other series would be ignored (data from the same series are collection to the same datapointgroup)
            if (this.Series.Any(series => string.IsNullOrEmpty(series.SeriesTitle)))
            {
                Exceptions.Add("Series with empty caption cannot be used.");
            }

            //ensure that each series has a different name
            if (this.Series.GroupBy(series => series.SeriesTitle).Any(group => group.Count() > 1))
            {
                Exceptions.Add("Series with duplicate name cannot be used.");
            }

            if (!HasExceptions)
            {
                List <DataPointGroup> result = new List <DataPointGroup>();
                try
                {
                    if (GetIsRowColumnSwitched())
                    {
                        ///sammle erst alle Gruppen zusammen
                        foreach (ChartSeries initialSeries in this.Series)
                        {
                            int itemIndex = 0;
                            foreach (var seriesItem in initialSeries.Items)
                            {
                                string         seriesItemCaption = GetPropertyValue(seriesItem, initialSeries.DisplayMember); //Security
                                DataPointGroup dataPointGroup    = result.Where(group => group.Caption == seriesItemCaption).FirstOrDefault();
                                if (dataPointGroup == null)
                                {
                                    dataPointGroup = new DataPointGroup(this, seriesItemCaption, this.Series.Count > 1 ? true : false);
                                    dataPointGroup.PropertyChanged += dataPointGroup_PropertyChanged;
                                    result.Add(dataPointGroup);

                                    CreateDataPointGroupBindings(dataPointGroup);

                                    int seriesIndex = 0;
                                    foreach (ChartSeries allSeries in this.Series)
                                    {
                                        DataPoint datapoint = new DataPoint(this);
                                        datapoint.SeriesCaption    = allSeries.SeriesTitle;
                                        datapoint.ValueMember      = allSeries.ValueMember;
                                        datapoint.DisplayMember    = allSeries.DisplayMember;
                                        datapoint.ItemBrush        = this.Series.Count == 1 ? GetItemBrush(itemIndex) : GetItemBrush(seriesIndex); //if only one series, use different color for each datapoint, if multiple series we use different color for each series
                                        datapoint.PropertyChanged += groupdItem_PropertyChanged;

                                        CreateDataPointBindings(datapoint, dataPointGroup);

                                        dataPointGroup.DataPoints.Add(datapoint);
                                        seriesIndex++;
                                    }
                                    itemIndex++;
                                }
                            }
                        }

                        ///gehe alle Series durch (Security, Naming etc.)
                        foreach (ChartSeries series in this.Series)
                        {
                            foreach (var seriesItem in series.Items)
                            {
                                string seriesItemCaption = GetPropertyValue(seriesItem, series.DisplayMember); //Security

                                //finde die gruppe mit dem Namen
                                DataPointGroup addToGroup = result.Where(group => group.Caption == seriesItemCaption).FirstOrDefault();

                                //finde in der Gruppe
                                DataPoint groupdItem = addToGroup.DataPoints.Where(item => item.SeriesCaption == series.SeriesTitle).FirstOrDefault();
                                groupdItem.ReferencedObject = seriesItem;
                            }
                        }
                    }
                    else
                    {
                        foreach (ChartSeries initialSeries in this.Series)
                        {
                            //erstelle für jede Series einen DataPointGroup, darin wird dann für jedes Item in jeder Serie ein DataPoint angelegt
                            DataPointGroup dataPointGroup = new DataPointGroup(this, initialSeries.SeriesTitle, this.Series.Count > 1 ? true : false);
                            dataPointGroup.PropertyChanged += dataPointGroup_PropertyChanged;
                            result.Add(dataPointGroup);

                            CreateDataPointGroupBindings(dataPointGroup);

                            //stelle nun sicher, dass alle DataPointGruppen die gleichen Datapoints hat
                            foreach (ChartSeries allSeries in this.Series)
                            {
                                int seriesIndex = 0;
                                foreach (var seriesItem in allSeries.Items)
                                {
                                    string    seriesItemCaption = GetPropertyValue(seriesItem, initialSeries.DisplayMember); //Security
                                    DataPoint existingDataPoint = dataPointGroup.DataPoints.Where(datapoint => datapoint.SeriesCaption == seriesItemCaption).FirstOrDefault();
                                    if (existingDataPoint == null)
                                    {
                                        DataPoint datapoint = new DataPoint(this);
                                        datapoint.SeriesCaption    = seriesItemCaption;
                                        datapoint.ValueMember      = allSeries.ValueMember;
                                        datapoint.DisplayMember    = allSeries.DisplayMember;
                                        datapoint.ItemBrush        = GetItemBrush(seriesIndex);
                                        datapoint.PropertyChanged += groupdItem_PropertyChanged;

                                        CreateDataPointBindings(datapoint, dataPointGroup);

                                        dataPointGroup.DataPoints.Add(datapoint);
                                    }
                                    seriesIndex++;
                                }
                            }
                        }

                        ///gehe alle Series durch (Security, Naming etc.)
                        foreach (ChartSeries series in this.Series)
                        {
                            foreach (var seriesItem in series.Items)
                            {
                                //finde die gruppe mit dem Namen
                                DataPointGroup addToGroup = result.Where(group => group.Caption == series.SeriesTitle).FirstOrDefault();

                                //finde in der Gruppe das richtige Element
                                string seriesItemCaption = GetPropertyValue(seriesItem, series.DisplayMember); //Security

                                DataPoint groupdItem = addToGroup.DataPoints.Where(item => item.SeriesCaption == seriesItemCaption).FirstOrDefault();
                                groupdItem.ReferencedObject = seriesItem;
                            }
                        }
                    }
                }
                catch
                {
                }

                //finished, copy all to the array
                groupedSeries.Clear();
                foreach (var item in result)
                {
                    groupedSeries.Add(item);
                }

                UpdateColorsOfDataPoints();

                chartLegendItems.Clear();
                DataPointGroup firstgroup = groupedSeries.FirstOrDefault();
                if (firstgroup != null)
                {
                    foreach (DataPoint dataPoint in firstgroup.DataPoints)
                    {
                        ChartLegendItemViewModel legendItem = new ChartLegendItemViewModel();

                        var captionBinding = new Binding();
                        captionBinding.Source = dataPoint;
                        captionBinding.Mode   = BindingMode.OneWay;
                        captionBinding.Path   = new PropertyPath("SeriesCaption");
                        BindingOperations.SetBinding(legendItem, ChartLegendItemViewModel.CaptionProperty, captionBinding);

                        var brushBinding = new Binding();
                        brushBinding.Source = dataPoint;
                        brushBinding.Mode   = BindingMode.OneWay;
                        brushBinding.Path   = new PropertyPath("ItemBrush");
                        BindingOperations.SetBinding(legendItem, ChartLegendItemViewModel.ItemBrushProperty, brushBinding);

                        chartLegendItems.Add(legendItem);
                    }
                }
                RecalcSumOfDataPointGroup();
            }
        }
Ejemplo n.º 60
0
        private void CreateParam(Document doc, Binding binding, DefinitionGroup defGroup, ExternalDefinitionCreationOptions options)
        {
            var definition = this.CreateDefinition(defGroup, options);

            doc.ParameterBindings.Insert(definition, binding, BuiltInParameterGroup.PG_IDENTITY_DATA);
        }