Example #1
0
 public EditorOptionPage(EditorTabManager editorTabManager, UiSettings uiSettings, EditorSettings editorSettings)
 {
     this.editorTabManager = editorTabManager;
     this.uiSettings = uiSettings;
     this.editorSettings = editorSettings;
     InitializeComponent();
 }
Example #2
0
 public ServerApiCall(UiSettings settings)
 {
     Users         = new UserApiClient(settings);
     Subscriptions = new SubscriptionApiClient(settings);
     Orders        = new OrderApiClient(settings);
     EntityChanges = new EntityChangesApiClient(settings);
 }
Example #3
0
 static void LoadSettings()
 {
     UiSettings.Initialize();
     AppSettings.Initialize();
     UserSettings.Initialize();
     ThemeSettings.Initialize();
 }
Example #4
0
 public GameWindow(string[] args)
 {
     InitializeComponent();
     uiSettings = new UiSettings(this.ClientSize.Width, this.ClientSize.Height, 45);
     InitGlobals(args);
     InitUI(uiSettings, args);
 }
Example #5
0
 public Renderer(UiSettings uiSettings)
 {
     this.uiSettings = uiSettings;
     this.uiSettings.uiSettingsChanged += MessageRecieved;
     initComputationObjects();
     initDisplayObjects();
 }
Example #6
0
 public Ball(UiSettings uiSettings, RectangleF bounds, Color color) :
     base(uiSettings, bounds, color)
 {
     this.x = uiSettings.Width / 2;
     this.y = uiSettings.Height / 4;
     uiSettings.SendMessage(UiSettingsEventArgs.EventType.SettingChangeEvent, "hello new ball");
     this.uiSettings = uiSettings;
 }
Example #7
0
 public MainWindow()
 {
     InitializeComponent();
     Settings           = new UiSettings();
     aboutDialog.Height = Settings.Dimensions.About.Height;
     aboutDialog.Width  = Settings.Dimensions.About.Width;
     DataChart          = new CurvesDataManager();
 }
Example #8
0
        public FileView(UiSettings uiSettings)
        {
            InitializeComponent();

            this.uiSettings = uiSettings;

            this.ImageList = FileBrowserImageList;
            this.Font = new Font("Segoe UI", 9.5f);
            this.Indent = 5;
        }
 public void OnMapReady(HuaweiMap map)
 {
     Log.Debug(TAG, "OnMapReady: ");
     hMap = map;
     hMap.MyLocationEnabled                  = false;
     hMap.UiSettings.CompassEnabled          = false;
     hMap.UiSettings.ZoomControlsEnabled     = false;
     hMap.UiSettings.MyLocationButtonEnabled = false;
     mUiSettings = hMap.UiSettings;
 }
Example #10
0
 public Gestures()
 {
     InitializeComponent();
     this.ContentPanel.Children.Add(amap = new AMap());
     amap.Loaded += amap_Loaded;
     uiset        = amap.GetUiSettings();
     uiset.AllGesturesEnabled  = false; //禁用所有交互
     uiset.ZoomControlsEnabled = false; //隐藏缩放图标
     chkBoxScroll.IsChecked    = true;
     chkBoxZoomicon.IsChecked  = true;
 }
Example #11
0
        private void ReloadAvatar()
        {
            var tag = (string)Avatar.Tag;

            if (tag != null && Uri.IsWellFormedUriString(tag, UriKind.Absolute))
            {
                var image = UiSettings.ResizedImage(new Uri(tag), 255, Avatar.Width, Avatar.Height);
                if (image != null)
                {
                    Avatar.TileImage    = image;
                    Avatar.UseTileImage = true;
                }
            }
        }
Example #12
0
        public IEnumerable <Command> GetCommands(UiSettings settings)
        {
            if (settings.AppFolders == null)
            {
                settings.AppFolders = new List <string>();
            }
            foreach (var path in settings.AppFolders)
            {
                string[] files;
                try
                {
                    files = Directory.GetFiles(path);
                }
                catch (Exception e)
                {
                    throw new CommandLoadException(e);
                }

                foreach (var file in files)
                {
                    var toAdd = new Command
                    {
                        Name    = Path.GetFileNameWithoutExtension(file),
                        Actions = new List <Dictionary <string, string> >
                        {
                            new Dictionary <string, string>
                            {
                                {
                                    "PROCESS", file
                                }
                            }
                        }
                    };
                    yield return(toAdd);
                }
            }

            if (settings.Commands == null)
            {
                settings.Commands = new List <Command>();
            }
            foreach (var cmd in settings.Commands)
            {
                yield return(cmd);
            }
        }
Example #13
0
    static void EnableAllSettings(UiSettings settings, bool enable)
    {
        Debug.Log("Current Ui Settings: " + settings);

        // Buttons/other
        settings.IsCompassEnabled           = enable;
        settings.IsIndoorLevelPickerEnabled = enable;
        settings.IsMapToolbarEnabled        = enable;
        settings.IsMyLocationButtonEnabled  = enable;
        settings.IsZoomControlsEnabled      = enable;

        // Gestures
        settings.IsRotateGesturesEnabled = enable;
        settings.IsScrollGesturesEnabled = enable;
        settings.IsTiltGesturesEnabled   = enable;
        settings.IsZoomGesturesEnabled   = enable;
        settings.SetAllGesturesEnabled(enable);
    }
Example #14
0
 void OnMainWindowClosed(object sender, FormClosedEventArgs e)
 {
     lock (shutdownLock) {
         if (shutdown)
         {
             return;
         }
         shutdown = true;
     }
     Cef.Shutdown();
     logger.Flush();
     logger.Dispose();
     Playlist.Terminate();
     UiSettings.Terminate();
     AppSettings.Terminate();
     ThemeSettings.Terminate();
     DownloadQueue.Terminate();
     PostProcessingQueue.Terminate();
 }
Example #15
0
        private void InitUI(UiSettings info, string[] args)
        {
            uiRenderer = new Renderer(uiSettings);

            string[] paths = args.Where(s => File.Exists(s)).ToArray();
            if (paths?.Length > 0)
            {
                uiSettings.SendMessage(UiSettingsEventArgs.EventType.WindowEvent, new object[] { Global.LoadPathsEvent, paths }, UiSettingsEventArgs.FLAGS_UI);
            }

            uiLastFrameTime = DateTime.Now;

            uiTimer          = new Timer();
            uiTimer.Interval = (1000 / info.FPS);
            uiTimer.Tick    += UiScreenRefresh;
            uiTimer.Start();
            bgColour = Color.DimGray;
            NetworkManagerLSTM.BaseColour     = bgColour;
            NetworkManagerLSTM.BaseTextColour = Color.White;
        }
Example #16
0
        /// <summary>
        /// The load ui settings.
        /// </summary>
        private static void LoadUiSettings()
        {
            try
            {
                string path = FileSystemPaths.PathSettings + "UiSettings.txt";

                if (!File.Exists(path))
                {
                    return;
                }

                string json = IO.ReadTextFromFile(path);

                ui = JsonConvert.DeserializeObject(json, typeof(UiSettings)) as UiSettings;
            }
            catch (Exception exception)
            {
                XtraMessageBox.Show("Failed to load UiSettings settings. Please check log for more info.");
                Log.WriteToLog(LogSeverity.Error, 0, exception.Message, exception.StackTrace);
            }
        }
Example #17
0
 public SettingsController(IOptions <UiSettings> uiSettingsAccessor)
 {
     UiSettings = uiSettingsAccessor.Value;
 }
Example #18
0
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     _lines.Selected = null;
     using (OpenFileDialog ofd = new OpenFileDialog())
     {
         ofd.Filter = "Morph Files (*.morph)|*.morph|All Files (*.*)|*.*";
         if (ofd.ShowDialog(this) == DialogResult.OK)
         {
             var formatter = new BinaryFormatter();
             using (Stream fileStream = ofd.OpenFile())
             {
                 SavedSettings ss = (SavedSettings)formatter.Deserialize(fileStream);
                 _lines = ss.Lines;
                 _morphSettings = ss.Settings;
                 ConfigurePictureBoxes(_lines, ss.FirstImage, ss.SecondImage);
             }
         }
     }
 }
 public void SaveSettings(UiSettings fSettings)
 {
     File.WriteAllText(_settingsPath,
                       JsonConvert.SerializeObject(fSettings, Formatting.Indented)); // Append path to settings.json
 }
Example #20
0
        protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.View> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement == null || e.OldElement != null)
            {
                return;
            }

            //e.NewElement就是承载的界面,这里就是PCL项目里面的MainPage
            //var mainPage = e.NewElement as TencentMapSamples;
            var mainPage = e.NewElement as Samples.Controls.TencentMap;

            //初始化mapView
            mapView = new MapView(this.Context);
            mapView.OnCreate(null);

            //初始化视图
            layout = new LinearLayout(this.Context);
            layout.AddView(mapView);
            this.AddView(layout);

            //这里可以比对以下我们的写法跟腾讯官网里Java写法的区别,可以看出Java里面的属性是set,get前缀,而在C#里面都被隐藏了,直接用C#惯用的属性写法来代替,而方法则还是同样的SetXXX(),GetXXX(),但是Java是camelCasing,C#用PascalCasing写法(博主非常喜欢C#写法,而很讨厌Java的写法 :-))。这些区别,都是Xamarin 里 绑定Java库的转换规则。

            #region TencentMap类
            //腾讯地图的设置是通过TencentMap类进行设置,可以控制地图的底图类型、显示范围、缩放级别、添加 / 删除marker和图形,此外对于地图的各种回调监听也是绑定到TencentMap。下面是TencentMap类的使用示例:

            //获取TencentMap实例
            TencentMap tencentMap = mapView.Map;
            //设置实时路况开启
            tencentMap.TrafficEnabled = true;
            //设置地图中心点
            tencentMap.SetCenter(new Com.Tencent.Mapsdk.Raster.Model.LatLng(30.605870, 104.068610));
            //设置缩放级别
            tencentMap.SetZoom(11);
            #endregion

            #region UiSettings类
            //UiSettings类用于设置地图的视图状态,如Logo位置设置、比例尺位置设置、地图手势开关等。下面是UiSettings类的使用示例:

            //获取UiSettings实例
            UiSettings uiSettings = mapView.UiSettings;
            //设置logo到屏幕底部中心
            uiSettings.SetLogoPosition(UiSettings.LogoPositionCenterBottom);
            //设置比例尺到屏幕右下角
            uiSettings.SetScaleViewPosition(UiSettings.ScaleviewPositionRightBottom);
            //启用缩放手势(更多的手势控制请参考开发手册)
            uiSettings.SetZoomGesturesEnabled(true);
            #endregion

            #region 使用marker
            //注意,这里要往resources/drawable/里添加一个red_location.png的图片
            var bitmap           = Resources.GetBitmap("red_location.png");
            BitmapDescriptor des = new BitmapDescriptor(bitmap);
            foreach (var item in mainPage.Options)
            {
                MarkerOptions options = new MarkerOptions();

                options.InvokeIcon(des);
                options.InvokeTitle(item.Title);
                options.Anchor(0.5f, 0.5f);
                options.InvokePosition(new LatLng(item.Lat, item.Lng));
                options.Draggable(true);
                Marker marker = mapView.AddMarker(options);
                marker.ShowInfoWindow();
            }

            #endregion
        }
Example #21
0
 public void Init()
 {
     _uisettings = new UiSettings();
 }
Example #22
0
 public FileViewOptionsPage(MainForm mainForm, UiSettings uiSettings)
 {
     this.mainForm = mainForm;
     this.uiSettings = uiSettings;
     InitializeComponent();
 }
 public override void Start()
 {
     _settings = UiSettings.Get(DataDir);
     InitializeNotificationArea();
     InitializeExternalApplications();
 }
Example #24
0
 public Ball(UiSettings uiSettings) :
     base(uiSettings)
 {
 }
Example #25
0
        public MainWindow(ISettingsLoader settingsLoader, ISettingsSaver settingsSaver, ICommandLoader commandLoader,
                          IProgramListLoader programListLoader)
        {
            if (settingsLoader == null)
            {
                throw new ArgumentNullException(nameof(settingsLoader));
            }
            if (commandLoader == null)
            {
                throw new ArgumentNullException(nameof(commandLoader));
            }
            if (programListLoader == null)
            {
                throw new ArgumentNullException(nameof(programListLoader));
            }
            _settingsSaver = settingsSaver ?? throw new ArgumentNullException(nameof(settingsSaver));

            _validCommands    = new Dictionary <string, Command>(StringComparer.CurrentCultureIgnoreCase);
            _autocompleteList = new List <string>();
            _programPaths     = new Dictionary <string, string>(StringComparer.CurrentCultureIgnoreCase);
            //_programList = new List<string>();

            InitializeComponent();
            Activated           += CommandTb_GotFocus;
            Deactivated         += CommandTb_LostFocus;
            CommandTb.GotFocus  += CommandTb_GotFocus;
            CommandTb.LostFocus += CommandTb_LostFocus;

            try
            {
                _fUiSettings = settingsLoader.LoadSettings();
            }
            catch (SettingsLoadException e)
            {
                MessageBox.Show(
                    "Couldn't load the config/settings.json file, is it valid JSON? Re-download it or fix any JSON formatting errors.\nException: " +
                    e.BuildException());
                Application.Current.Shutdown();
            }

            foreach (var toAdd in commandLoader.GetCommands(_fUiSettings))
            {
                try
                {
                    _validCommands.Add(toAdd.Name, toAdd);
                    _autocompleteList.Add(toAdd.Name);
                }
                catch (CommandLoadException e)
                {
                    MessageBox.Show("Unable to load command.\nException is: " + e.BuildException());
                    CommandError();
                }
            }

            foreach (var cmd in _fUiSettings.Commands)
            {
                _validCommands.Add(cmd.Name, cmd);
                _autocompleteList.Add(cmd.Name);
            }

            foreach (var program in programListLoader.GetProgramList())
            {
                _programPaths[Path.GetFileNameWithoutExtension(program).Trim()] = program;
                _autocompleteList.Add(Path.GetFileNameWithoutExtension(program).Trim());
            }
        }
Example #26
0
        private void PrepareUIDataForMorph(
            out UiSettings settings, out LinePairCollection lines,
            out Bitmap newStartImage, out Bitmap newEndImage)
        {
            // Grab UI data
            settings = Utilities.DeepClone(_morphSettings);
            lines = Utilities.DeepClone(_lines);

            // Get the original iamges
            var origStartImage = (Bitmap)pbStartImage.Image;
            var origEndImage = (Bitmap)pbEndImage.Image;

            // Get a scale factor from the UI
            float startImageScaleFactor = int.Parse(outputSizeToolStripTextBox.Text) / 100f;

            // Create the starting and ending images.  The starting image is scaled by the UI setting,
            // and the ending image is created to match the starting image's size.
            newStartImage = Utilities.CreateNewBitmapFrom(origStartImage, startImageScaleFactor);
            newEndImage = Utilities.CreateNewBitmapFrom(origEndImage, newStartImage.Width, newStartImage.Height);

            // Get a scale factor by comparing the new and old ending images
            var endImageScaleFactor = new PointF(
                newEndImage.Width / (float)origEndImage.Width,
                newEndImage.Height / (float)origEndImage.Height);

            // Create new line pairings to cope with the scaling
            var newlineList =
                (from pair in _lines
                 select Tuple.Create(
                     new Line(
                     new PointF(pair.Item1.Item1.X * startImageScaleFactor, pair.Item1.Item1.Y * startImageScaleFactor),
                     new PointF(pair.Item1.Item2.X * startImageScaleFactor, pair.Item1.Item2.Y * startImageScaleFactor)),
                     new Line(
                     new PointF(pair.Item2.Item1.X * endImageScaleFactor.X, pair.Item2.Item1.Y * endImageScaleFactor.Y),
                     new PointF(pair.Item2.Item2.X * endImageScaleFactor.X, pair.Item2.Item2.Y * endImageScaleFactor.Y)))).ToList();
            lines = new LinePairCollection(newlineList);
        }