Exemplo n.º 1
1
 static LogFormatter()
 {
     _imageDict = new ResourceDictionary()
     {
         Source = new Uri("pack://application:,,,/Resources;component/Images/SystemImages.xaml")
     };
 }
Exemplo n.º 2
0
        protected PackagesProviderBase(
            Project project,
            IProjectManager projectManager,
            ResourceDictionary resources,
            ProviderServices providerServices,
            IProgressProvider progressProvider)
        {
            if (projectManager == null) {
                throw new ArgumentNullException("projectManager");
            }

            if (project == null) {
                throw new ArgumentNullException("project");
            }

            if (resources == null) {
                throw new ArgumentNullException("resources");
            }

            if (providerServices == null) {
                throw new ArgumentNullException("providerServices");
            }

            _progressProvider = progressProvider;
            _resources = resources;
            _scriptExecutor = providerServices.ScriptExecutor;
            _progressWindowOpener = providerServices.ProgressWindow;
            _outputConsole = new Lazy<IConsole>(() => providerServices.OutputConsoleProvider.CreateOutputConsole(requirePowerShellHost: false));
            ProjectManager = projectManager;
            _project = project;
        }
 protected abstract bool TryFindDataTemplate(
     ResourceDictionary resources, 
     FrameworkElement resourcesOwner,
     DependencyObject itemContainer,
     object item, 
     Type itemType,
     out DataTemplate dataTemplate);
Exemplo n.º 4
0
        protected PackagesProviderBase(
            IPackageRepository localRepository, 
            ResourceDictionary resources, 
            ProviderServices providerServices, 
            IProgressProvider progressProvider, 
            ISolutionManager solutionManager)
        {
            if (resources == null)
            {
                throw new ArgumentNullException("resources");
            }

            if (providerServices == null)
            {
                throw new ArgumentNullException("providerServices");
            }

            if (solutionManager == null)
            {
                throw new ArgumentNullException("solutionManager");
            }

            _localRepository = localRepository;
            _providerServices = providerServices;
            _progressProvider = progressProvider;
            _solutionManager = solutionManager;
            _resources = resources;
            _outputConsole = new Lazy<IConsole>(() => providerServices.OutputConsoleProvider.CreateOutputConsole(requirePowerShellHost: false));
        }
Exemplo n.º 5
0
        private static void RegisterResources(string moduleName = null)
        {
            var dictionary = new ResourceDictionary();
            
            

            if (string.IsNullOrEmpty(moduleName))
            {
                StackTrace stackTrace = new StackTrace();
                Assembly assembly = stackTrace.GetFrame(2).GetMethod().Module.Assembly;
                string assemblyName = assembly.FullName;
                string[] nameParts = assemblyName.Split(',');
                moduleName = nameParts[0];
            }
#if SILVERLIGHT

            StreamResourceInfo resourceInfo = Application.GetResourceStream(new Uri(moduleName + ";component/Resources/ModuleResources.xaml", UriKind.Relative));
            if (resourceInfo == null) return;
            var resourceReader = new StreamReader(resourceInfo.Stream);
            string xaml = resourceReader.ReadToEnd();
            var resourceTheme = XamlReader.Load(xaml) as ResourceDictionary;
            Application.Current.Resources.MergedDictionaries.Add(resourceTheme);
#else
        dictionary.Source = new Uri(
            "pack://application:,,,/" + moduleName + ";component/Resources/ModuleResources.xaml");
        Application.Current.Resources.MergedDictionaries.Add(dictionary);
#endif
        }
Exemplo n.º 6
0
        //private static readonly Logger _logger = LogManager.GetCurrentClassLogger();
        public static ResourceDictionary GetDictionary(string relativePath = @"Resources\Dictionaries")
        {
            var mergedDictionary = new ResourceDictionary();
            string path = Path.Combine(HttpRuntime.AppDomainAppPath, relativePath);

            if (Directory.Exists(path))
                foreach (string fileName in Directory.GetFiles(path).Where(f => f.EndsWith(".xaml")))
                    using (var fs = new FileStream(fileName, FileMode.Open))
                    {
                        try
                        {
                            var xr = new XamlReader();

                            var tmp = (ResourceDictionary)XamlReader.Load(fs);
                            foreach (string key in tmp.Keys)
                                if (tmp[key] is Canvas)
                                {
                                    mergedDictionary.Add(key, tmp[key]);
                                }

                        }
                        catch (Exception)
                        {
                            //_logger.Error(ex.Message);
                        }
                    }
            else
                Directory.CreateDirectory(path);

            return mergedDictionary;
        }
Exemplo n.º 7
0
        public ChgReserveWindow()
        {
            InitializeComponent();

            if (Settings.Instance.NoStyle == 0)
            {
                ResourceDictionary rd = new ResourceDictionary();
                rd.MergedDictionaries.Add(
                    Application.LoadComponent(new Uri("/PresentationFramework.Aero, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35;component/themes/aero.normalcolor.xaml", UriKind.Relative)) as ResourceDictionary
                    //Application.LoadComponent(new Uri("/PresentationFramework.Classic, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/Classic.xaml", UriKind.Relative)) as ResourceDictionary
                    );
                this.Resources = rd;
            }
            else
            {
                button_chg_reserve.Style = null;
                button_del_reserve.Style = null;
                button_cancel.Style = null;
            }

            comboBox_service.ItemsSource = ChSet5.Instance.ChList.Values;
            comboBox_sh.ItemsSource = CommonManager.Instance.HourDictionary.Values;
            comboBox_eh.ItemsSource = CommonManager.Instance.HourDictionary.Values;
            comboBox_sm.ItemsSource = CommonManager.Instance.MinDictionary.Values;
            comboBox_em.ItemsSource = CommonManager.Instance.MinDictionary.Values;
            comboBox_ss.ItemsSource = CommonManager.Instance.MinDictionary.Values;
            comboBox_es.ItemsSource = CommonManager.Instance.MinDictionary.Values;
        }
Exemplo n.º 8
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="existing"></param>
        /// <param name="newResource"></param>
        /// <param name="validTypes"></param>
        /// <returns></returns>
        public static bool VerifyResources(this ResourceDictionary existing, ResourceDictionary newResource, params Type[] validTypes)
        {
            if (existing == null)
                throw new ArgumentNullException("existing");

            if (newResource == null)
                return false;

            if (validTypes != null && validTypes.Length > 0)
            {
                foreach (var resource in newResource.Values)
                {
                    if (!(resource.GetType().IsAssignableToAny(validTypes)))
                    {
                        MessageBox.Show(FindText("InvalidLanguageResourceType"), FindText("ApplicationTitle"), MessageBoxButton.OK, MessageBoxImage.Error);
                        return false;
                    }
                }
            }

            var newKeys = newResource.Keys.Cast<object>();

            foreach (var existingKey in existing.Keys)
            {
                if (!newKeys.Contains(existingKey))
                {
                    var message = FindText("MissingLanguageResourceKey", existingKey);
                    MessageBox.Show(message, FindText("ApplicationTitle"), MessageBoxButton.OK, MessageBoxImage.Error);
                    return false;
                }
            }

            return true;
        }
 /// <summary>
 /// Aggregates all of the component resources into the specified resource dictionary.
 /// </summary>
 internal void Load(ResourceDictionary root)
 {
     foreach (var r in Views)
     {
         root.MergedDictionaries.Add(r);
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// return object 
        /// </summary>
        /// <returns></returns>
        public static ResourceDictionary Objectlang()
        {
            var s = String.Empty;

            switch (Elang)
            {
                case Lang.Portuguese:
                    s = "..\\Lang\\LANG_BR.xaml";
                    break;
                case Lang.English:
                    s = "..\\Lang\\LANG_EN.xaml";
                    break;
                //case Lang.Chinese:
                //    s = "..\\Lang\\LANG_CH.xaml";
                //    break;
                case Lang.Korean:
                    s = "..\\Lang\\LANG_KO.xaml";
                    break;
            }
            if (s != string.Empty)
            {
                ResourceDictionary d = new ResourceDictionary()
                {
                    Source =  new Uri(s ,UriKind.Relative)
                };
                return d;
            }
            return null;
        }
Exemplo n.º 11
0
        public ResourceDictionary GetResourceDictionary()
        {
            var dict = new ResourceDictionary
            {
                Source = new Uri(GetThemePath(UserSettingStorage.Instance.Theme), UriKind.Absolute)
            };

            Style queryBoxStyle = dict["QueryBoxStyle"] as Style;
            if (queryBoxStyle != null)
            {
                queryBoxStyle.Setters.Add(new Setter(TextBox.FontFamilyProperty, new FontFamily(UserSettingStorage.Instance.QueryBoxFont)));
                queryBoxStyle.Setters.Add(new Setter(TextBox.FontStyleProperty, FontHelper.GetFontStyleFromInvariantStringOrNormal(UserSettingStorage.Instance.QueryBoxFontStyle)));
                queryBoxStyle.Setters.Add(new Setter(TextBox.FontWeightProperty, FontHelper.GetFontWeightFromInvariantStringOrNormal(UserSettingStorage.Instance.QueryBoxFontWeight)));
                queryBoxStyle.Setters.Add(new Setter(TextBox.FontStretchProperty, FontHelper.GetFontStretchFromInvariantStringOrNormal(UserSettingStorage.Instance.QueryBoxFontStretch)));
            }

            Style resultItemStyle = dict["ItemTitleStyle"] as Style;
            Style resultSubItemStyle = dict["ItemSubTitleStyle"] as Style;
            Style resultItemSelectedStyle = dict["ItemTitleSelectedStyle"] as Style;
            Style resultSubItemSelectedStyle = dict["ItemSubTitleSelectedStyle"] as Style;
            if (resultItemStyle != null && resultSubItemStyle != null && resultSubItemSelectedStyle != null && resultItemSelectedStyle != null)
            {
                Setter fontFamily = new Setter(TextBlock.FontFamilyProperty, new FontFamily(UserSettingStorage.Instance.ResultItemFont));
                Setter fontStyle = new Setter(TextBlock.FontStyleProperty, FontHelper.GetFontStyleFromInvariantStringOrNormal(UserSettingStorage.Instance.ResultItemFontStyle));
                Setter fontWeight = new Setter(TextBlock.FontWeightProperty, FontHelper.GetFontWeightFromInvariantStringOrNormal(UserSettingStorage.Instance.ResultItemFontWeight));
                Setter fontStretch = new Setter(TextBlock.FontStretchProperty, FontHelper.GetFontStretchFromInvariantStringOrNormal(UserSettingStorage.Instance.ResultItemFontStretch));

                Setter[] setters = new Setter[] { fontFamily, fontStyle, fontWeight, fontStretch };
                Array.ForEach(new Style[] { resultItemStyle, resultSubItemStyle, resultItemSelectedStyle, resultSubItemSelectedStyle }, o => Array.ForEach(setters, p => o.Setters.Add(p)));
            }

            return dict;
        }
Exemplo n.º 12
0
		/// <summary>
		/// Initializes a new instance of the <see cref="RangeHighlight"/> class.
		/// </summary>
		protected RangeHighlight()
		{
			Resources = new ResourceDictionary { Source = new Uri("/DynamicDataDisplay;component/Charts/Shapes/RangeHighlightStyle.xaml", UriKind.Relative) };

			Style = (Style)FindResource(typeof(RangeHighlight));
			ApplyTemplate();
		}
        internal void UpdateThemeResources(Theme oldTheme = null)
        {
            if (oldTheme != null)
            {
              if( oldTheme is DictionaryTheme )
              {
                if( currentThemeResourceDictionary != null )
                {
                  Resources.MergedDictionaries.Remove( currentThemeResourceDictionary );
                  currentThemeResourceDictionary = null;
                }
              }
              else
              {
                var resourceDictionaryToRemove =
                    Resources.MergedDictionaries.FirstOrDefault( r => r.Source == oldTheme.GetResourceUri() );
                if( resourceDictionaryToRemove != null )
                  Resources.MergedDictionaries.Remove(
                      resourceDictionaryToRemove );
              }
            }

            if (_manager.Theme != null)
            {
              if( _manager.Theme is DictionaryTheme )
              {
                currentThemeResourceDictionary = ( ( DictionaryTheme )_manager.Theme ).ThemeResourceDictionary;
                Resources.MergedDictionaries.Add( currentThemeResourceDictionary );
              }
              else
              {
                Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = _manager.Theme.GetResourceUri() });
              }
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// Change the colors based on a theme-name from AvalonDock.
        /// <para>
        /// <example>Example: ChangeColors("classic", Colors.DarkGreen)</example>
        /// </para>
        /// </summary>
        /// <param name="baseTheme">the string of the base theme we want to change</param>
        /// <param name="color">the new Color</param>
        public static void ChangeColors(string baseTheme, Color color)
        {
            ResourceDictionary rd = new ResourceDictionary();
            rd.Source = new Uri("/AvalonDock;component/themes/" + baseTheme + ".xaml", UriKind.RelativeOrAbsolute);

            ChangeKeysInResourceDictionary(rd, color);
            foreach (ResourceDictionary rd2 in rd.MergedDictionaries)
            {
                ChangeKeysInResourceDictionary(rd2, color);
            }

            //ResourceDictionary parent = Application.Current.Resources;
            // first search and remove old one
            //foreach (ResourceDictionary res in Application.Current.Resources.MergedDictionaries)
            //{
            //    string source = res.Source.ToString();
            //    if (source.Contains("/AvalonDock;component/themes/"))
            //    {
            //        Application.Current.Resources.MergedDictionaries.Remove(res);
            //        break;
            //    }
            //}
            ResetColors();

            Application.Current.Resources.MergedDictionaries.Add(rd);
        }
Exemplo n.º 15
0
        internal static void ChangeTheme(string theme)
        {
            var app = System.Windows.Application.Current;
            if (string.IsNullOrEmpty(theme))
            {
                if (currentUri != null)
                {
                    var oldtheme = app.Resources.MergedDictionaries[app.Resources.MergedDictionaries.Count - 1];
                    //FindName(currentUri.OriginalString) as ResourceDictionary;
                    app.Resources.MergedDictionaries.Remove(oldtheme);
                }
                CurrentSkin = null;
                currentUri = null;
                return;
            }

            Uri resourceLocator = new Uri("BackBock;Component/Themes/" + theme + "/Theme.xaml", UriKind.Relative);
            //Application.Current.Resources =  Application.LoadComponent(resourceLocator) as ResourceDictionary;
            //var dictionary = System.Windows.Application.LoadComponent(resourceLocator) as ResourceDictionary;
            var dictionary = new ResourceDictionary();
            dictionary.Source = resourceLocator;
            if (currentUri != null)
            {
                var oldtheme = app.Resources.MergedDictionaries[app.Resources.MergedDictionaries.Count - 1];
                //FindName(currentUri.OriginalString) as ResourceDictionary;
                app.Resources.MergedDictionaries.Remove(oldtheme);
            }

            app.Resources.MergedDictionaries.Add(dictionary);
            //app.Resources = dictionary;
            CurrentSkin = theme;
            currentUri = resourceLocator;
        }
Exemplo n.º 16
0
 void SugarIconPresenter_Loaded(object sender, RoutedEventArgs e)
 {
     // Get the resource containing the Window Style and assign it to the window
     ResourceDictionary _resources = new ResourceDictionary();
     _resources.Source = new Uri("/SugarControls;component/Styles/IconPresenter.xaml", UriKind.RelativeOrAbsolute);
     this.Style = (Style)_resources["IconPresenter"];
 }
Exemplo n.º 17
0
        private static ResourceDictionary LoadDictionary()
        {
            if (cacheDictionary != null)
                return cacheDictionary;

            ResourceDictionary dictionary = null;
            try
            {
                Application.Current.Resources.MergedDictionaries
                           .Insert(0,
                                   XamlReader.Load(
                                                   new FileStream(
                                                       Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)
                                                       + @"\Lang\" + CurrentCultureInfo.Name + ".xaml",
                                                       FileMode.Open)) as ResourceDictionary);
            }
            catch
            {
            }

            //If dictionary is still null, use default language.
            if (dictionary == null)
                if (Application.Current.Resources.MergedDictionaries.Count > 0)
                    dictionary = Application.Current.Resources.MergedDictionaries[0];
                else
                    throw new Exception("No language file.");

            cacheDictionary = dictionary;

            return cacheDictionary;
        }
Exemplo n.º 18
0
 public ThemeManager()
 {
     this.themeResources = new ResourceDictionary
                               {
                                   Source = new Uri("pack://application:,,,/Caliburn.Metro.Demo;component/Resources/Theme1.xaml")
                               };
 }
Exemplo n.º 19
0
 public SharedThemeService(ResourceDictionary resourceDictionary)
 {
     _resourceDictionary = resourceDictionary;
     _themes = new BehaviorSubject<IEnumerable<ITheme>>(Enumerable.Empty<ITheme>());
     _activeTheme = new BehaviorSubject<ITheme>(null);
     _themesMap = new Dictionary<string, ITheme>();
 }
Exemplo n.º 20
0
 internal static void UpdateTheme(ResourceDictionary resourceDictionary, Theme theme)
 {
     ResourceDictionary brushResourceDictionary = resourceDictionary.FindDictionary(BrushDictionaryUri.ToString());
     if (brushResourceDictionary != null)
     {
         if (theme == Theme.Dark)
         {
             brushResourceDictionary.ReplaceDictionary(LightColorDictionaryUri, DarkColorDictionaryUri);
         }
         else
         {
             brushResourceDictionary.ReplaceDictionary(DarkColorDictionaryUri, LightColorDictionaryUri);
         }
     }
     else
     {
         if (theme == Theme.Dark)
         {
             resourceDictionary.MergedDictionaries.Add(
                 new ResourceDictionary()
                 {
                     Source = DarkColorDictionaryUri
                 });
         }
         else
         {
             resourceDictionary.MergedDictionaries.Add(
                 new ResourceDictionary()
                 {
                     Source = LightColorDictionaryUri
                 });
         }
     }
 }
Exemplo n.º 21
0
 public void LoadStyle()
 {
     Uri resourceLocater = HbRelogManager.Settings.UseDarkStyle ? new Uri("/styles/ExpressionDark.xaml", UriKind.Relative) : new Uri("/styles/BureauBlue.xaml", UriKind.Relative);
     var rDict = new ResourceDictionary { Source = resourceLocater };
     Resources.MergedDictionaries.Clear();
     Resources.MergedDictionaries.Add(rDict);
 }
Exemplo n.º 22
0
        private static ResourceDictionary LoadDictionary()
        {
            if (cacheDictionary != null)
                return cacheDictionary;

            ResourceDictionary dictionary = null;
            try
            {
                dictionary =
                    (ResourceDictionary)Application.LoadComponent(
                        new Uri(@"Lang\" + CurrentCultureInfo.Name + ".xaml", UriKind.Relative));
            }
            catch
            {
            }

            //If dictionary is still null, use default language.
            if (dictionary == null)
                if (Application.Current.Resources.MergedDictionaries.Count > 0)
                    dictionary = Application.Current.Resources.MergedDictionaries[0];
                else
                    throw new Exception("No language file.");

            cacheDictionary = dictionary;

            return cacheDictionary;
        }
        // Given a ResourceDictionary and a set of keys, try to find the best
        //  match in the resource dictionary.
        private static object FindBestMatchInResourceDictionary(
            ResourceDictionary table, ArrayList keys, int exactMatch, ref int bestMatch)
        {
            object resource = null;
            int k;

            // Search target element's ResourceDictionary for the resource
            if (table != null)
            {
                for (k = 0; k < bestMatch; ++k)
                {
                    object candidate = table[keys[k]];
                    if (candidate != null)
                    {
                        resource = candidate;
                        bestMatch = k;

                        // if we found an exact match, no need to continue
                        if (bestMatch < exactMatch)
                            return resource;
                    }
                }
            }

            return resource;
        }
Exemplo n.º 24
0
        private void ParseFile(string cached)
        {
            string[] sReferences = File.ReadAllLines(cached);
            foreach (string ap in sReferences)
            {
                try
                {
                    string[] s = ap.Split(',');
                    var g = new Graphic();
                    var pd = new ResourceDictionary();
                    pd.Source = new Uri("csGeoLayers;component/csGeoLayers/FlightTracker/FTDictionary.xaml", UriKind.Relative);
                    g.Symbol = pd["MediumMarkerSymbol"] as SimpleMarkerSymbol;

                    var mp = new MapPoint((float) Convert.ToDouble(s[7], CultureInfo.InvariantCulture),
                                          (float) Convert.ToDouble(s[6], CultureInfo.InvariantCulture),
                                          new SpatialReference(4326));

                    g.Geometry = mp;
                    Graphics.Add(g);
                }
                catch (Exception)
                {
                }
            }
            AppStateSettings.Instance.FinishDownload(_id);
        }
        public void ApplyConvention(Assembly assembly, DictionaryEntry entry)
        {
            string assemblyName = assembly.GetName().Name;
            string key = entry.Key as string;
            key = key.Replace(".baml", ".xaml");

            string uriString = String.Format("pack://application:,,,/{0};Component/{1}", assemblyName, key);

            try
            {
                if (!uriString.ToUpper().Contains("VIEW.XAML")
                    && !uriString.ToUpper().Contains("APP.XAML"))
                {
                    var dictionary = new ResourceDictionary
                                         {
                                             Source = new Uri(uriString)
                                         };

                    Application.Current.Resources.MergedDictionaries.Add(dictionary);
                }
            }
            catch
            {
                // do nothing. This allows for user controls to 'not' be loaded into the
                // Resource Dictionary
            }
        }
        /// <summary>
        /// Generates code for value
        /// </summary>
        /// <param name="parentClass">The parent class.</param>
        /// <param name="method">The method.</param>
        /// <param name="value">The value.</param>
        /// <param name="baseName">Name of the base.</param>
        /// <param name="dictionary">The dictionary.</param>
        /// <returns></returns>
        public CodeExpression Generate(CodeTypeDeclaration parentClass, CodeMemberMethod method, object value, string baseName, ResourceDictionary dictionary = null)
        {
            string bitmapVarName = baseName + "_bm";

            BitmapImage bitmap = value as BitmapImage;
            return CodeComHelper.GenerateBitmapImageValue(method, bitmap.UriSource, bitmapVarName);
        }
Exemplo n.º 27
0
 private static void RemoveDictionaryFromElement(FrameworkElement fe, ResourceDictionary rd)
 {
     if (fe.Resources != null && fe.Resources.MergedDictionaries.Contains(rd))
     {
         fe.Resources.MergedDictionaries.Remove(rd);
     }
 }
Exemplo n.º 28
0
        public virtual void SetLightDark(bool isDark)
        {
            var existingResourceDictionary = Application.Current.Resources.MergedDictionaries
                .Where(rd => rd.Source != null)
                .SingleOrDefault(rd => Regex.Match(rd.Source.AbsolutePath, @"(\/MaterialDesignThemes.Wpf;component\/Themes\/MaterialDesignTheme\.)((Light)|(Dark))").Success);
            if (existingResourceDictionary == null)
                throw new ApplicationException("Unable to find Light/Dark base theme in Application resources.");

            var source = "pack://*****:*****@"(\/MahApps.Metro;component\/Styles\/Accents\/)((BaseLight)|(BaseDark))").Success);
            if (existingMahAppsResourceDictionary == null) return;

            source =
                         "pack://application:,,,/MahApps.Metro;component/Styles/Accents/" + (isDark ? "BaseDark" : "BaseLight") + ".xaml";
          //  $"pack://application:,,,/MahApps.Metro;component/Styles/Accents/{(isDark ? "BaseDark" : "BaseLight")}.xaml";
            var newMahAppsResourceDictionary = new ResourceDictionary { Source = new Uri(source) };

            Application.Current.Resources.MergedDictionaries.Remove(existingMahAppsResourceDictionary);
            Application.Current.Resources.MergedDictionaries.Add(newMahAppsResourceDictionary);
        }
Exemplo n.º 29
0
        private void SugarButton_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            // check if the theme is supposed to be the owner
            if (this.Theme == Theme.Owner)
            {
                this.Theme = CommonMethods.GetTheme(this);
            }

            // The resource dictionaire that contain desired style
            ResourceDictionary resource = new ResourceDictionary();


            // Apply the theme
            switch (this.Theme)
            {
                case Theme.Sugar:
                    resource.Source = new Uri("/SugarControls;component/Themes/Sugar/SugarImageButtonStyle.xaml", UriKind.RelativeOrAbsolute);
                    this.Style = (Style)resource["SugarImageButtonStyle"];
                    break;
                case Theme.VS:
                    resource.Source = new Uri("/SugarControls;component/Themes/VS/VSImageButtonStyle.xaml", UriKind.RelativeOrAbsolute);
                    this.Style = (Style)resource["VSImageButtonStyle"];
                    break;
                default:
                    break;
            }


        }
Exemplo n.º 30
0
 public void Test(int processId)
 {
     IEnumerable<string> fontFamilies = System.Drawing.FontFamily.Families.Select(f=>f.Name);
     ListBox listBox = new ListBox();
     ResourceDictionary dictionary = new ResourceDictionary();
     dictionary.Source = new Uri("/KSPE3Lib;component/Resources.xaml", UriKind.Relative);
     listBox.ItemTemplate = dictionary["FontItemTemplate"] as DataTemplate;
     listBox.ItemsSource = fontFamilies;
     listBox.Width = 250;
     listBox.Height = 300;
     listBox.SelectionChanged += listBox_SelectionChanged;
     Dictionary<int, Color> colorByCode = E3ColorTable.GetColorByCode(processId);
     ColorPicker colorPicker = new ColorPicker(colorByCode);
     colorPicker.VerticalAlignment = VerticalAlignment.Center;
     colorPicker.SelectedColorChanged += colorPicker_SelectedColorChanged;
     textBlockForeGroundBrush = new SolidColorBrush();
     textBlockForeGroundBrush.Color = colorPicker.SelectedColor;
     textBlock = new TextBlock();
     textBlock.Text = "Example";
     textBlock.Foreground = textBlockForeGroundBrush;
     StackPanel panel = new StackPanel();
     panel.Background = new SolidColorBrush(Colors.LightGray);
     panel.Children.Add(textBlock);
     panel.Children.Add(colorPicker.UIElement);
     panel.Children.Add(listBox);
     panel.Orientation = Orientation.Horizontal;
     Content = panel;
 }
Exemplo n.º 31
0
        private void UpdateQuickCommands()
        {
            var fillColor   = (System.Windows.Media.SolidColorBrush) new BrushConverter().ConvertFromString("White");
            var strokeColor = (System.Windows.Media.SolidColorBrush) new BrushConverter().ConvertFromString("#444444");
            var resource    = new System.Windows.ResourceDictionary()
            {
                Source = new Uri(@"/syncfusion.floorplanner.wpf;component/Template/FloorPlanDictionary.xaml", UriKind.RelativeOrAbsolute)
            };
            var quickCommandStyle = new Style()
            {
                TargetType = typeof(System.Windows.Shapes.Path)
            };

            quickCommandStyle.Setters.Add(new Setter()
            {
                Property = System.Windows.Shapes.Path.StretchProperty, Value = Stretch.Fill
            });
            quickCommandStyle.Setters.Add(new Setter()
            {
                Property = System.Windows.Shapes.Path.FillProperty, Value = fillColor
            });
            quickCommandStyle.Setters.Add(new Setter()
            {
                Property = System.Windows.Shapes.Path.StrokeProperty, Value = strokeColor
            });

            splitQuickCommand = new QuickCommandViewModel()
            {
                Shape = new EllipseGeometry()
                {
                    RadiusX = 28, RadiusY = 28
                },
                ShapeStyle      = quickCommandStyle,
                Length          = 1,
                Margin          = new Thickness(0, -25, 0, 0),
                VisibilityMode  = VisibilityMode.Connector,
                Command         = this.SplitCommand,
                ContentTemplate = resource["SplitCommandIcon"] as DataTemplate
            };

            strokeQuickCommand = new QuickCommandViewModel()
            {
                Shape = new EllipseGeometry()
                {
                    RadiusX = 28, RadiusY = 28
                },
                ShapeStyle      = quickCommandStyle,
                Length          = 0,
                Margin          = new Thickness(0, -25, 0, 0),
                VisibilityMode  = VisibilityMode.Connector,
                Command         = this.StrokeChangeCommand,
                ContentTemplate = resource["StrokeCommandIcon"] as DataTemplate,
            };

            var quickCommandCollection = (this.SelectedItems as SelectorViewModel).Commands as QuickCommandCollection;

            quickCommandCollection.Add(splitQuickCommand);
            quickCommandCollection.Add(strokeQuickCommand);
        }
 public static System.Windows.Style GetCustomStyle(string styleName)
 {
     System.Windows.ResourceDictionary resource = new System.Windows.ResourceDictionary
     {
         Source = new Uri(Constants.RESOURCE_DICTIONARY_PATH, UriKind.RelativeOrAbsolute)
     };
     return((System.Windows.Style)resource[styleName]);
 }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
 {
     switch (connectionId)
     {
     case 1:
         this.CSharpResourceDictionary = ((System.Windows.ResourceDictionary)(target));
         return;
     }
     this._contentLoaded = true;
 }
Exemplo n.º 34
0
        public static System.Windows.Style GetCustomStyle(Type targetType)
        {
            System.Windows.ResourceDictionary resource = new System.Windows.ResourceDictionary
            {
                Source = new Uri(RESOURCE_DICTIONARY_PATH, UriKind.RelativeOrAbsolute)
            };
            var windowStyle = (System.Windows.Style)resource[targetType];

            return(windowStyle);
        }
Exemplo n.º 35
0
        /// <summary>
        /// Public constructor for making the Change node color window
        /// </summary>
        /// <param name="DynamoNodeSettings"></param>
        public ChangeNodeColorsWindow(System.Windows.ResourceDictionary DynamoNodeSettings, BeyondDynamoConfig beyondDynamoConfig)
        {
            InitializeComponent();
            this.Owner              = BeyondDynamo.Utils.DynamoWindow;
            this.config             = beyondDynamoConfig;
            this.dynamoNodeSettings = DynamoNodeSettings;
            this._ITitleText        = (SolidColorBrush)dynamoNodeSettings["headerForegroundInactive"];
            this._ITitleBackground  = (SolidColorBrush)dynamoNodeSettings["headerBackgroundInactive"];
            this._ITitleBorder      = (SolidColorBrush)dynamoNodeSettings["headerBorderInactive"];
            this._IBodyBackground   = (SolidColorBrush)dynamoNodeSettings["bodyBackgroundInactive"];
            this._IBodyBorder       = (SolidColorBrush)dynamoNodeSettings["outerBorderInactive"];

            this._ATitleText       = (SolidColorBrush)dynamoNodeSettings["headerForegroundActive"];
            this._ATitleBackground = (SolidColorBrush)dynamoNodeSettings["headerBackgroundActive"];
            this._ATitleBorder     = (SolidColorBrush)dynamoNodeSettings["headerBorderActive"];
            this._ABodyBackground  = (SolidColorBrush)dynamoNodeSettings["bodyBackgroundActive"];
            this._ABodyBorder      = (SolidColorBrush)dynamoNodeSettings["outerBorderActive"];

            this._WTitleText       = (SolidColorBrush)dynamoNodeSettings["headerForegroundWarning"];
            this._WTitleBackground = (SolidColorBrush)dynamoNodeSettings["headerBackgroundWarning"];
            this._WTitleBorder     = (SolidColorBrush)dynamoNodeSettings["headerBorderWarning"];
            this._WBodyBackground  = (SolidColorBrush)dynamoNodeSettings["bodyBackgroundWarning"];
            this._WBodyBorder      = (SolidColorBrush)dynamoNodeSettings["outerBorderWarning"];

            this._ETitleText       = (SolidColorBrush)dynamoNodeSettings["headerForegroundError"];
            this._ETitleBackground = (SolidColorBrush)dynamoNodeSettings["headerBackgroundError"];
            this._ETitleBorder     = (SolidColorBrush)dynamoNodeSettings["headerBorderError"];
            this._EBodyBackground  = (SolidColorBrush)dynamoNodeSettings["bodyBackgroundError"];
            this._EBodyBorder      = (SolidColorBrush)dynamoNodeSettings["outerBorderError"];

            this.ITitleText.Background       = _ITitleText;
            this.ITitleBackground.Background = _ITitleBackground;
            this.ITitleBorder.Background     = _ITitleBorder;
            this.IBodyBackground.Background  = _IBodyBackground;
            this.IBodyBorder.Background      = _IBodyBorder;

            this.ATitleText.Background       = _ATitleText;
            this.ATitleBackground.Background = _ATitleBackground;
            this.ATitleBorder.Background     = _ATitleBorder;
            this.ABodyBackground.Background  = _ABodyBackground;
            this.ABodyBorder.Background      = _ABodyBorder;

            this.WTitleText.Background       = _WTitleText;
            this.WTitleBackground.Background = _WTitleBackground;
            this.WTitleBorder.Background     = _WTitleBorder;
            this.WBodyBackground.Background  = _WBodyBackground;
            this.WBodyBorder.Background      = _WBodyBorder;

            this.ETitleText.Background       = _ETitleText;
            this.ETitleBackground.Background = _ETitleBackground;
            this.ETitleBorder.Background     = _ETitleBorder;
            this.EBodyBackground.Background  = _EBodyBackground;
            this.EBodyBorder.Background      = _EBodyBorder;
        }
Exemplo n.º 36
0
        internal static void RemoveCore(System.Windows.ResourceDictionary resources)
        {
            ValidationHelper.NotNull(resources, "resources");

            var genericDictionaries = resources.MergedDictionaries.Where(d => d.Source == GenericDictionaryUri).ToList();

            if (genericDictionaries.Count != 1)
            {
                return;
            }
            resources.MergedDictionaries.Remove(genericDictionaries[0]);
        }
Exemplo n.º 37
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/ResourceFramework;component/UserControls/HUD/CurrentWeapon.xaml", System.UriKind.Relative));
     this.currentWeapon       = ((System.Windows.Controls.UserControl)(this.FindName("currentWeapon")));
     this.ButtonStyle         = ((System.Windows.ResourceDictionary)(this.FindName("ButtonStyle")));
     this.LayoutRoot          = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.vwBox               = ((System.Windows.Controls.Viewbox)(this.FindName("vwBox")));
     this.WeaponContentHolder = ((System.Windows.Controls.Button)(this.FindName("WeaponContentHolder")));
 }
Exemplo n.º 38
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 10 "..\..\MailWindow.xaml"
                ((WpfApp1.MailWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.LanguageDictionary = ((System.Windows.ResourceDictionary)(target));
                return;

            case 3:
                this.MailTo = ((System.Windows.Controls.TextBox)(target));
                return;

            case 4:
                this.MailTitle = ((System.Windows.Controls.TextBox)(target));
                return;

            case 5:

            #line 92 "..\..\MailWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.SendButton_Click);

            #line default
            #line hidden
                return;

            case 6:

            #line 120 "..\..\MailWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.CancelButton_Click);

            #line default
            #line hidden
                return;

            case 7:
                this.MailBody = ((System.Windows.Controls.TextBox)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemplo n.º 39
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.LanguageDictionary = ((System.Windows.ResourceDictionary)(target));
                return;

            case 2:
                this.Username = ((System.Windows.Controls.TextBox)(target));

            #line 36 "..\..\LoginWindow.xaml"
                this.Username.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.txtChanged);

            #line default
            #line hidden
                return;

            case 3:
                this.Password = ((System.Windows.Controls.PasswordBox)(target));

            #line 41 "..\..\LoginWindow.xaml"
                this.Password.PasswordChanged += new System.Windows.RoutedEventHandler(this.txtChanged);

            #line default
            #line hidden
                return;

            case 4:

            #line 44 "..\..\LoginWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.OKButton = ((System.Windows.Controls.Button)(target));

            #line 46 "..\..\LoginWindow.xaml"
                this.OKButton.Click += new System.Windows.RoutedEventHandler(this.Button_Click_1);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Exemplo n.º 40
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/ResourceFramework;component/UserControls/HUD/SoundControl.xaml", System.UriKind.Relative));
     this.ButtonStyle      = ((System.Windows.ResourceDictionary)(this.FindName("ButtonStyle")));
     this.LayoutRoot       = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.scaleTransform   = ((System.Windows.Media.ScaleTransform)(this.FindName("scaleTransform")));
     this.btnMute          = ((System.Windows.Controls.Button)(this.FindName("btnMute")));
     this.btnSoundPrevious = ((System.Windows.Controls.Button)(this.FindName("btnSoundPrevious")));
     this.btnSoundNext     = ((System.Windows.Controls.Button)(this.FindName("btnSoundNext")));
 }
Exemplo n.º 41
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/ResourceFramework;component/UserControls/Menus/HelpScreen.xaml", System.UriKind.Relative));
     this.btnResource     = ((System.Windows.ResourceDictionary)(this.FindName("btnResource")));
     this.canvasHelpMenu  = ((System.Windows.Controls.Canvas)(this.FindName("canvasHelpMenu")));
     this.BackgroundImage = ((System.Windows.Controls.Image)(this.FindName("BackgroundImage")));
     this.txtKeyName      = ((System.Windows.Controls.TextBlock)(this.FindName("txtKeyName")));
     this.cnvsMe          = ((System.Windows.Controls.Canvas)(this.FindName("cnvsMe")));
     this.btnGrid         = ((System.Windows.Controls.Grid)(this.FindName("btnGrid")));
     this.SignPost        = ((ResourceFramework.UserControls.Additional.SignPost)(this.FindName("SignPost")));
 }
Exemplo n.º 42
0
        private void UpdateKey(object key, object value)
        {
            // load the resource dictionary
            var rd = new System.Windows.ResourceDictionary();

            rd.Source = new System.Uri("SavedStuff.xaml", System.UriKind.RelativeOrAbsolute);

            rd[key] = value;

            var settings = new System.Xml.XmlWriterSettings();

            settings.Indent = true;
            var writer = System.Xml.XmlWriter.Create(@"SavedStuff.xaml", settings);

            System.Windows.Markup.XamlWriter.Save(rd, writer);
        }
Exemplo n.º 43
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Healthcare;component/DrugSubPage.xaml", System.UriKind.Relative));
     this.rd01          = ((System.Windows.ResourceDictionary)(this.FindName("rd01")));
     this.LayoutRoot    = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.TBPrefix      = ((System.Windows.Controls.TextBlock)(this.FindName("TBPrefix")));
     this.BD_TBFrame    = ((System.Windows.Controls.Border)(this.FindName("BD_TBFrame")));
     this.TBMainSearch  = ((System.Windows.Controls.TextBox)(this.FindName("TBMainSearch")));
     this.BTNSearch     = ((System.Windows.Controls.Button)(this.FindName("BTNSearch")));
     this.ContentPanel  = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.BTNDrug       = ((System.Windows.Controls.Primitives.ToggleButton)(this.FindName("BTNDrug")));
     this.BTNDrugNumber = ((System.Windows.Controls.Primitives.ToggleButton)(this.FindName("BTNDrugNumber")));
     this.BTNDrugCode   = ((System.Windows.Controls.Button)(this.FindName("BTNDrugCode")));
 }
Exemplo n.º 44
0
        internal static void ApplyCore(System.Windows.ResourceDictionary resources, ThemeDictionaryBase themeResources)
        {
            ValidationHelper.NotNull(resources, "resources");
            ValidationHelper.NotNull(themeResources, "themeResources");

            // Bug in WPF 4: http://connect.microsoft.com/VisualStudio/feedback/details/555322/global-wpf-styles-are-not-shown-when-using-2-levels-of-references
            if (resources.Keys.Count == 0)
            {
                resources.Add(typeof(Window), new Style(typeof(Window)));
            }

            var genericDictionary = new System.Windows.ResourceDictionary {
                Source = GenericDictionaryUri
            };

            genericDictionary.MergedDictionaries.Clear();
            genericDictionary.MergedDictionaries.Add(ThemeDictionaryConverter.Convert(themeResources));
            resources.SafeInject(genericDictionary);
        }
Exemplo n.º 45
0
        public void InitialAppResources()
        {
            this.Resources.MergedDictionaries.Clear();

            List <Uri> resourcesUris = new List <Uri>()
            {
                new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml"),
                new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml"),
                new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml"),
                new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml"),
                new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml"),
            };

            for (int rdIndex = 0; rdIndex < resourcesUris.Count; rdIndex++)
            {
                System.Windows.ResourceDictionary dict = new System.Windows.ResourceDictionary();
                dict.Source = resourcesUris[rdIndex];
                this.Resources.MergedDictionaries.Add(dict);
            }
        }
Exemplo n.º 46
0
        /// <summary>
        /// Получить список всех доступных языков, которые может использовать программа
        /// </summary>
        /// <returns></returns>
        public List <OneLanguage> GetAllOneLanguages()
        {
            List <OneLanguage> OneLanguages = new List <OneLanguage>();

            OneLanguages.Add(GetEnLenguage());

            OneLanguage lang = null;

            DirectoryInfo diLanguagesDir = new DirectoryInfo(languagesDirPath);

            foreach (var f in diLanguagesDir.GetFiles("*.xaml"))
            {
                System.Windows.ResourceDictionary rd = new System.Windows.ResourceDictionary();
                rd.Source = new Uri(f.FullName);
                lang      = CreateOneLanguage(rd);
                OneLanguages.Add(lang);
            }

            return(OneLanguages);
        }
Exemplo n.º 47
0
        public void Show()
        {
            radialSlider = new SfRadialSlider()
            {
                Width                = 110,
                Height               = 110,
                TickFrequency        = 2,
                SmallChange          = 1,
                Minimum              = 2,
                Maximum              = 10,
                InnerRimRadiusFactor = 0.4,
                LabelVisibility      = Visibility.Visible
            };

            var resource = new System.Windows.ResourceDictionary()
            {
                Source = new Uri(@"/syncfusion.floorplanner.wpf;component/Template/FloorPlanDictionary.xaml", UriKind.RelativeOrAbsolute)
            };

            radialSlider.LabelTemplate = resource["LabelTemplate"] as DataTemplate;

            var binding = new Binding("Value");

            binding.Source = radialSlider;
            radialSlider.SetBinding(SfRadialSlider.ContentProperty, binding);

            this.Content = radialSlider;
            if (TargetConnector != null)
            {
                foreach (Setter setter in TargetConnector.ConnectorGeometryStyle.Setters)
                {
                    if (setter.Property.Name == "StrokeThickness")
                    {
                        radialSlider.Value = double.Parse(setter.Value.ToString());
                        break;
                    }
                }
            }

            radialSlider.ValueChanged += RadialSlider_ValueChanged;
        }
Exemplo n.º 48
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Healthcare;component/MainPage.xaml", System.UriKind.Relative));
     this.rd01         = ((System.Windows.ResourceDictionary)(this.FindName("rd01")));
     this.PanoramaMain = ((Microsoft.Phone.Controls.Panorama)(this.FindName("PanoramaMain")));
     this.LayoutRoot   = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.BD_TBFrame   = ((System.Windows.Controls.Border)(this.FindName("BD_TBFrame")));
     this.TBMainSearch = ((System.Windows.Controls.TextBox)(this.FindName("TBMainSearch")));
     this.BTNSearch    = ((System.Windows.Controls.Button)(this.FindName("BTNSearch")));
     this.BTN药品查询      = ((System.Windows.Controls.Button)(this.FindName("BTN药品查询")));
     this.BTN检查项目      = ((System.Windows.Controls.Button)(this.FindName("BTN检查项目")));
     this.BTN手术项目      = ((System.Windows.Controls.Button)(this.FindName("BTN手术项目")));
     this.TBVersion    = ((System.Windows.Documents.Run)(this.FindName("TBVersion")));
     this.LBInfo       = ((System.Windows.Controls.ListBox)(this.FindName("LBInfo")));
     this.LBLore       = ((System.Windows.Controls.ListBox)(this.FindName("LBLore")));
 }
Exemplo n.º 49
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Healthcare;component/BarCode.xaml", System.UriKind.Relative));
     this.rd01              = ((System.Windows.ResourceDictionary)(this.FindName("rd01")));
     this.LayoutRoot        = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.frame             = ((System.Windows.Shapes.Rectangle)(this.FindName("frame")));
     this._videoBrush       = ((System.Windows.Media.VideoBrush)(this.FindName("_videoBrush")));
     this._previewTransform = ((System.Windows.Media.CompositeTransform)(this.FindName("_previewTransform")));
     this._marker1          = ((System.Windows.Shapes.Rectangle)(this.FindName("_marker1")));
     this._marker2          = ((System.Windows.Shapes.Rectangle)(this.FindName("_marker2")));
     this._marker3          = ((System.Windows.Shapes.Rectangle)(this.FindName("_marker3")));
     this._marker4          = ((System.Windows.Shapes.Rectangle)(this.FindName("_marker4")));
     this._marker5          = ((System.Windows.Shapes.Rectangle)(this.FindName("_marker5")));
     this._marker6          = ((System.Windows.Shapes.Rectangle)(this.FindName("_marker6")));
     this._marker7          = ((System.Windows.Shapes.Rectangle)(this.FindName("_marker7")));
     this._marker8          = ((System.Windows.Shapes.Rectangle)(this.FindName("_marker8")));
 }
Exemplo n.º 50
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/Healthcare;component/GeneralResultPage.xaml", System.UriKind.Relative));
     this.rd01         = ((System.Windows.ResourceDictionary)(this.FindName("rd01")));
     this.LayoutRoot   = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.TBPageTitle  = ((System.Windows.Documents.Run)(this.FindName("TBPageTitle")));
     this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.BD_TBFrame   = ((System.Windows.Controls.Border)(this.FindName("BD_TBFrame")));
     this.TBMainSearch = ((System.Windows.Controls.TextBox)(this.FindName("TBMainSearch")));
     this.BTNSearch    = ((System.Windows.Controls.Button)(this.FindName("BTNSearch")));
     this.SPFilter     = ((System.Windows.Controls.StackPanel)(this.FindName("SPFilter")));
     this.BTNFilter    = ((System.Windows.Controls.Button)(this.FindName("BTNFilter")));
     this.BTNFilter2   = ((System.Windows.Controls.Button)(this.FindName("BTNFilter2")));
     this.BTNFilter3   = ((System.Windows.Controls.Button)(this.FindName("BTNFilter3")));
     this.MsgBox       = ((Healthcare.MyUserControl.MsgBoxControl)(this.FindName("MsgBox")));
     this.LLSResult    = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("LLSResult")));
     this.BTNBack      = ((System.Windows.Controls.Button)(this.FindName("BTNBack")));
     this.BTNMore      = ((System.Windows.Controls.Button)(this.FindName("BTNMore")));
 }
Exemplo n.º 51
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.LanguageDictionary = ((System.Windows.ResourceDictionary)(target));
                return;

            case 2:
                this.MovingColumn = ((System.Windows.Controls.ColumnDefinition)(target));
                return;

            case 3:
                this.TabControl = ((System.Windows.Controls.TabControl)(target));

            #line 163 "..\..\MainWindow.xaml"
                this.TabControl.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.TabControl_SelectionChanged);

            #line default
            #line hidden
                return;

            case 4:
                this.MyList = ((System.Windows.Controls.ListBox)(target));

            #line 167 "..\..\MainWindow.xaml"
                this.MyList.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ListBoxSelectionChanged);

            #line default
            #line hidden

            #line 170 "..\..\MainWindow.xaml"
                this.MyList.KeyDown += new System.Windows.Input.KeyEventHandler(this.MyList_KeyDown);

            #line default
            #line hidden
                return;

            case 5:
                this.MySentList = ((System.Windows.Controls.ListBox)(target));

            #line 176 "..\..\MainWindow.xaml"
                this.MySentList.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ListBoxSelectionChanged2);

            #line default
            #line hidden

            #line 179 "..\..\MainWindow.xaml"
                this.MySentList.KeyDown += new System.Windows.Input.KeyEventHandler(this.MySentList_KeyDown);

            #line default
            #line hidden
                return;

            case 6:
                this.SearchBox = ((System.Windows.Controls.TextBox)(target));

            #line 199 "..\..\MainWindow.xaml"
                this.SearchBox.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.SearchBox_TextChanged);

            #line default
            #line hidden
                return;

            case 7:

            #line 205 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.RadioButton)(target)).Click += new System.Windows.RoutedEventHandler(this.EnglishRadioButton_Click);

            #line default
            #line hidden
                return;

            case 8:

            #line 206 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.RadioButton)(target)).Click += new System.Windows.RoutedEventHandler(this.PolishRadioButton_Click);

            #line default
            #line hidden
                return;

            case 9:

            #line 208 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click);

            #line default
            #line hidden
                return;

            case 10:
                this.Login = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 11:
                this.NewMailButton = ((System.Windows.Controls.Button)(target));

            #line 215 "..\..\MainWindow.xaml"
                this.NewMailButton.Click += new System.Windows.RoutedEventHandler(this.NewMailButton_Click);

            #line default
            #line hidden
                return;

            case 12:
                this.ScrollViewer = ((System.Windows.Controls.ScrollViewer)(target));
                return;

            case 13:
                this.ScrollViewerSent = ((System.Windows.Controls.ScrollViewer)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemplo n.º 52
0
 /// <summary>
 /// Устанавливает Xaml скин приложения
 /// </summary>
 /// <param name="skinPath"></param>
 protected void ApplySkinXaml(string skinPath)
 {
     System.Windows.ResourceDictionary rd = new System.Windows.ResourceDictionary();
     rd.Source = new Uri(skinPath);
     App.Current.Resources.MergedDictionaries.Add(rd);
 }
Exemplo n.º 53
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            ValidationHelper.NotNull(value, "value");
            ValidationHelper.OfType(value, "value", typeof(ThemeDictionaryBase));
            Util.EnsureNotNull <object>();
            Util.EnsureOfType <object>(typeof(System.Windows.ResourceDictionary));
            if (destinationType != typeof(System.Windows.ResourceDictionary))
            {
                return(base.ConvertTo(context, culture, value, destinationType));
            }
            var themeDictionaryBase = (ThemeDictionaryBase)value;
            var result = new System.Windows.ResourceDictionary {
                Source = Manager.ResourcesUri
            };

            System.Windows.ResourceDictionary resources;
            switch (themeDictionaryBase.Source)
            {
            case ThemeResources.Light:
                resources = new System.Windows.ResourceDictionary {
                    Source = Manager.LightBrushesDictionaryUri
                };
                result.SafeSet(resources);
                break;

            case ThemeResources.LightGray:
                resources = new System.Windows.ResourceDictionary {
                    Source = Manager.LightGrayBrushesDictionaryUri
                };
                result.SafeSet(resources);
                break;

            case ThemeResources.DarkGray:
                resources = new System.Windows.ResourceDictionary {
                    Source = Manager.DarkGrayBrushesDictionaryUri
                };
                result.SafeSet(resources);
                break;

            case ThemeResources.Dark:
                resources = new System.Windows.ResourceDictionary {
                    Source = Manager.DarkBrushesDictionaryUri
                };
                result.SafeSet(resources);
                break;

            case ThemeResources.Inherited:
                var themeDictionary = themeDictionaryBase as ThemeDictionary;
                if (themeDictionary == null)
                {
                    throw new InvalidOperationException("Dictionary must be of type ThemeDictionary");
                }
                if (themeDictionary.Control == null || !themeDictionary.Control.IsAlive)
                {
                    throw new InvalidOperationException("ThemeDictionary must be assigned with control before to be converted to System.Windows.ResourceDictionary");
                }
                var control = (FrameworkElement)themeDictionary.Control.Target;
                foreach (var resourceKey in themeDictionary.Keys)
                {
                    result.SafeSet(resourceKey, control.FindResource(resourceKey));
                }
                break;
            }
            result.SafeSet <ThemeResource, object>(themeDictionaryBase);
            return(result);
        }
Exemplo n.º 54
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 8 "..\..\StackerControl.xaml"
                ((WpfStackerLibrary.StackerControl)(target)).Initialized += new System.EventHandler(this.UserControl_Initialized);

            #line default
            #line hidden

            #line 8 "..\..\StackerControl.xaml"
                ((WpfStackerLibrary.StackerControl)(target)).Loaded += new System.Windows.RoutedEventHandler(this.UserControl_Loaded_1);

            #line default
            #line hidden
                return;

            case 2:

            #line 10 "..\..\StackerControl.xaml"
                ((System.ComponentModel.BackgroundWorker)(target)).DoWork += new System.ComponentModel.DoWorkEventHandler(this.BackgroundWorker_DoWork);

            #line default
            #line hidden

            #line 10 "..\..\StackerControl.xaml"
                ((System.ComponentModel.BackgroundWorker)(target)).RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.BackgroundWorker_RunWorkerCompleted);

            #line default
            #line hidden
                return;

            case 3:
                this.stacker_left_panel = ((System.Windows.Controls.RowDefinition)(target));
                return;

            case 4:
                this.stacker_right_panel = ((System.Windows.Controls.RowDefinition)(target));
                return;

            case 5:
                this.stacker_rails = ((System.Windows.Controls.Grid)(target));
                return;

            case 6:
                this.stacker_base = ((System.Windows.Controls.Border)(target));
                return;

            case 7:
                this.stacker_rect = ((System.Windows.Controls.DockPanel)(target));

            #line 51 "..\..\StackerControl.xaml"
                this.stacker_rect.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.stacker_rails_MouseLeftButtonDown);

            #line default
            #line hidden
                return;

            case 8:
                this.StackerStyles = ((System.Windows.ResourceDictionary)(target));
                return;

            case 9:
                this.y_rect = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 10:
                this.z_left_rect = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 11:
                this.rack_left = ((System.Windows.Controls.Grid)(target));
                return;

            case 12:
                this.rack_right = ((System.Windows.Controls.Grid)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemplo n.º 55
0
        /// <summary>
        /// Function Which gets Called on Loading the Plug-In
        /// </summary>
        /// <param name="p">Parameters</param>
        public void Loaded(ViewLoadedParams p)
        {
            BDmenuItem = new MenuItem {
                Header = "Beyond Dynamo"
            };
            DynamoViewModel VM = p.DynamoWindow.DataContext as DynamoViewModel;

            BeyondDynamo.Utils.DynamoWindow = p.DynamoWindow;

            Utils.DynamoVM = VM;
            Utils.LogMessage("Loading Menu Items Started...");

            Utils.LogMessage("Loading Menu Items: Latest Version Started...");
            LatestVersion = new MenuItem {
                Header = "New version available! Download now!"
            };
            LatestVersion.Click += (sender, args) =>
            {
                System.Diagnostics.Process.Start("www.github.com/JoelvanHerwaarden/BeyondDynamo2.X/releases");
            };
            if (this.currentVersion < this.latestVersion)
            {
                BDmenuItem.Items.Add(LatestVersion);
            }
            else
            {
                Utils.LogMessage("Loading Menu Items: Latest Version is installed");
            }

            Utils.LogMessage("Loading Menu Items: Latest Version Completed");

            #region THIS CAN BE RUN ANYTIME

            Utils.LogMessage("Loading Menu Items: Chang Node Colors Started...");
            ChangeNodeColors = new MenuItem {
                Header = "Change Node Color"
            };
            ChangeNodeColors.Click += (sender, args) =>
            {
                //Get the current Node Color Template
                System.Windows.ResourceDictionary dynamoUI = Dynamo.UI.SharedDictionaryManager.DynamoColorsAndBrushesDictionary;

                //Initiate a new Change Node Color Window
                ChangeNodeColorsWindow colorWindow = new ChangeNodeColorsWindow(dynamoUI, config)
                {
                    // Set the owner of the window to the Dynamo window.
                    Owner = BeyondDynamo.Utils.DynamoWindow
                };
                colorWindow.Left = colorWindow.Owner.Left + 400;
                colorWindow.Top  = colorWindow.Owner.Top + 200;

                //Show the Color window
                colorWindow.Show();
            };
            ChangeNodeColors.ToolTip = new ToolTip()
            {
                Content = "This lets you change the Node Color Settings in your Dynamo nodes in In-Active, Active, Warning and Error state"
            };

            Utils.LogMessage("Loading Menu Items: Batch Remove Trace Data Started...");
            BatchRemoveTraceData = new MenuItem {
                Header = "Remove Session Trace Data from Dynamo Graphs"
            };
            BatchRemoveTraceData.Click += (sender, args) =>
            {
                //Make a ViewModel for the Remove Trace Data window

                //Initiate a new Remove Trace Data window
                RemoveTraceDataWindow window = new RemoveTraceDataWindow()
                {
                    Owner     = p.DynamoWindow,
                    viewModel = VM
                };
                window.Left = window.Owner.Left + 400;
                window.Top  = window.Owner.Top + 200;

                //Show the window
                window.Show();
            };
            BatchRemoveTraceData.ToolTip = new ToolTip()
            {
                Content = "Removes the Session Trace Data / Bindings from muliple Dynamo scripts in a given Directory" +
                          "\n" +
                          "\nSession Trace Data / Bindings is the trace data binding with the current Revit model and elements." +
                          "\nIt can slow your scripts down if you run them because it first tries the regain the last session in which it was used."
            };

            Utils.LogMessage("Loading Menu Items: Order Player Nodes Started...");
            OrderPlayerInput = new MenuItem {
                Header = "Order Input/Output Nodes"
            };
            OrderPlayerInput.Click += (sender, args) =>
            {
                //Open a FileBrowser Dialog so the user can select a Dynamo Graph
                System.Windows.Forms.OpenFileDialog fileDialog = new System.Windows.Forms.OpenFileDialog();
                fileDialog.Filter = "Dynamo Files (*.dyn)|*.dyn";
                if (fileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (BeyondDynamoFunctions.IsFileOpen(VM, fileDialog.FileName))
                    {
                        Forms.MessageBox.Show("Please close the file before using this command", "Order Input/Output Nodes");
                        return;
                    }
                    //Get the selected filePath
                    string DynamoFilepath = fileDialog.FileName;
                    string DynamoString   = File.ReadAllText(DynamoFilepath);
                    if (DynamoString.StartsWith("<"))
                    {
                        //Call the SortInputNodes Function
                        BeyondDynamoFunctions.SortInputOutputNodesXML(fileDialog.FileName);
                    }
                    else if (DynamoString.StartsWith("{"))
                    {
                        //Call the SortInputNodes Function
                        BeyondDynamoFunctions.SortInputOutputNodesJson(fileDialog.FileName);
                    }
                    else
                    {
                        return;
                    }
                }
            };
            OrderPlayerInput.ToolTip = new ToolTip()
            {
                Content = "Select a Dynamo file and it will let you sort the Nodes marked as 'Input'' & Output'" +
                          "\n" +
                          "\n Only Watch nodes which are marked as Output are displayed in the Dynamo Player. " +
                          "\nOther nodes will show up in Refinery"
            };

            Utils.LogMessage("Loading Menu Items: Player Scripts Started...");
            PlayerScripts = new MenuItem {
                Header = "Player Graphs"
            };
            OpenPlayerPath = new MenuItem {
                Header = "Open Player Path"
            };
            OpenPlayerPath.Click += (sender, args) =>
            {
                System.Diagnostics.Process.Start(this.config.playerPath);
            };

            SetPlayerPath = new MenuItem {
                Header = "Set Player Path"
            };
            List <MenuItem> extraMenuItems = new List <MenuItem> {
                SetPlayerPath, OpenPlayerPath
            };
            SetPlayerPath.Click += (sender, args) =>
            {
                Forms.FolderBrowserDialog browserDialog = new Forms.FolderBrowserDialog();
                if (this.config.playerPath != null)
                {
                    browserDialog.SelectedPath = this.config.playerPath;
                }
                if (browserDialog.ShowDialog() == Forms.DialogResult.OK)
                {
                    if (browserDialog.SelectedPath != null)
                    {
                        PlayerScripts.Items.Clear();
                        BeyondDynamoFunctions.RetrievePlayerFiles(PlayerScripts, VM, browserDialog.SelectedPath, extraMenuItems);
                        this.config.playerPath = browserDialog.SelectedPath;
                    }
                }
            };
            Utils.LogMessage("Playerpath = " + this.config.playerPath);
            if (this.config.playerPath != null | this.config.playerPath != string.Empty)
            {
                try
                {
                    if (Directory.Exists(Path.GetDirectoryName(this.config.playerPath)))
                    {
                        BeyondDynamoFunctions.RetrievePlayerFiles(PlayerScripts, VM, this.config.playerPath, extraMenuItems);
                    }
                }
                catch (Exception e)
                {
                    Utils.LogMessage("Loading Player Path Warning: " + e.Message);
                    PlayerScripts.Items.Add(SetPlayerPath);
                }
            }
            else
            {
                PlayerScripts.Items.Add(SetPlayerPath);
            }

            //BDmenuItem.Items.Add(ChangeNodeColors);
            //Utils.LogMessage("Loading Menu Items: Chang Node Colors Completed");
            //BDmenuItem.Items.Add(BatchRemoveTraceData);
            //Utils.LogMessage("Loading Menu Items: Batch Remove Trace Data Completed");
            BDmenuItem.Items.Add(OrderPlayerInput);
            Utils.LogMessage("Loading Menu Items: Order Player Nodes Completed");
            BDmenuItem.Items.Add(PlayerScripts);
            Utils.LogMessage("Loading Menu Items: Player Scripts Completed");

            BDmenuItem.Items.Add(new Separator());
            BDmenuItem.Items.Add(new Separator());
            #endregion

            # region THESE FUNCTION ONLY WORK INSIDE A SCRIPT
Exemplo n.º 56
0
        public static void SetTheme(string chosen = null)
        {
            try
            {
                if (chosen == null)
                {
                    chosen = Repository.Instance.Settings.FetchSettings <string>(Constants.Settings.SelectedThemeKey);
                }
                var         oldTheme     = _themeDic;
                var         oldBaseTheme = _baseThemeDic;
                IVsUIShell2 uiShell      = _package.GetService(typeof(SVsUIShell)) as IVsUIShell2;
                uint        rgb;
                uiShell.GetVSSysColorEx((int)__VSSYSCOLOREX.VSCOLOR_TOOLWINDOW_BACKGROUND, out rgb);
                var col = System.Drawing.ColorTranslator.FromWin32((int)rgb);

                if (col.GetBrightness() < 0.5)
                {
                    IsDarkTheme = true;
                    _themeDic   = new System.Windows.ResourceDictionary()
                    {
                        Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml")
                    };
                    _baseThemeDic = new System.Windows.ResourceDictionary()
                    {
                        Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml")
                    };
                }
                else
                {
                    IsDarkTheme = false;
                    _themeDic   = new System.Windows.ResourceDictionary()
                    {
                        Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml")
                    };
                    _baseThemeDic = new System.Windows.ResourceDictionary()
                    {
                        Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml")
                    };
                }

                if (chosen != null && MahApps.Metro.ThemeManager.Accents.Any(accent => accent.Name == chosen))
                {
                    _themeDic = new System.Windows.ResourceDictionary()
                    {
                        Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/" + chosen + ".xaml")
                    };
                }

                foreach (var control in _themedControls)
                {
                    if (control.Resources.MergedDictionaries.Contains(oldTheme))
                    {
                        control.Resources.MergedDictionaries.Remove(oldTheme);
                    }
                    if (control.Resources.MergedDictionaries.Contains(oldBaseTheme))
                    {
                        control.Resources.MergedDictionaries.Remove(oldBaseTheme);
                    }
                    if (!control.Resources.MergedDictionaries.Contains(_themeDic))
                    {
                        control.Resources.MergedDictionaries.Add(_themeDic);
                    }
                    if (!control.Resources.MergedDictionaries.Contains(_baseThemeDic))
                    {
                        control.Resources.MergedDictionaries.Add(_baseThemeDic);
                    }
                    control.UpdateDefaultStyle();
                }
            }
            catch (Exception ex)
            {
                SimpleLogger.Log(ex);
            }
        }
Exemplo n.º 57
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 7 "..\..\StackerManBNR.xaml"
                ((WpfStackerLibrary.StackerManBNR)(target)).Initialized += new System.EventHandler(this.UserControl_Initialized);

            #line default
            #line hidden
                return;

            case 2:
                this.StackerErrors = ((System.Windows.ResourceDictionary)(target));
                return;

            case 3:

            #line 85 "..\..\StackerManBNR.xaml"
                ((System.Windows.Controls.Grid)(target)).Initialized += new System.EventHandler(this.Grid_Initialized);

            #line default
            #line hidden
                return;

            case 4:
                this.DriveErrors = ((System.Windows.ResourceDictionary)(target));
                return;

            case 5:
                this.dockPanel1 = ((System.Windows.Controls.WrapPanel)(target));
                return;

            case 6:

            #line 1581 "..\..\StackerManBNR.xaml"
                ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.Button_Click_1);

            #line default
            #line hidden
                return;

            case 7:
                this.PowerBtnBrushes = ((System.Windows.ResourceDictionary)(target));
                return;

            case 8:
                this.btnSpec = ((System.Windows.Controls.Button)(target));

            #line 1604 "..\..\StackerManBNR.xaml"
                this.btnSpec.Click += new System.Windows.RoutedEventHandler(this.btnSpec_Click);

            #line default
            #line hidden
                return;

            case 9:
                this.PowerBtnCaptions = ((System.Windows.ResourceDictionary)(target));
                return;

            case 10:
                this.tbPosX = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 11:
                this.tbPosY = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 12:
                this.tbPosZ = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }