// Use this for initialization
 void Start()
 {
     //Instantiate simulated objects list
     simulatedObjects = new List <Motion3DObject>();
     //Hook other GUI elements
     startStopButtonText = GameObject.Find("StartButton").GetComponentInChildren <Text>();
     timeDisplayText     = GameObject.Find("TimeInput").GetComponent <InputField>();
     timeSlider          = GameObject.Find("TimeSlider").GetComponent <TimeSlider>(); //TODO: conflict add
     //Hook Scene Controller
     sceneController = gameObject.GetComponent <Motion3DSceneController>();
     //Initialize problem setup
     motion3Dsetup = new Motion3DSetup(DefaultProblem.exprX, DefaultProblem.exprY, DefaultProblem.exprZ,
                                       new Dictionary <string, double>(), DefaultProblem.order);
     //Set default forward solve time
     forwardSolveTime = Motion3DConstants.forwardSolveTime_default;
     //Set the object model to copy from
     objectModel = GameObject.Find("ObjectModel");
     objectModel.SetActive(false);
     //Set valid data interval and reset time. Use internals to avoid bugs with one not being set yet
     allObjectsDataLowerBound_internal = 0;
     allObjectsDataUpperBound_internal = 0;
     resetTime_internal = 0;
     //Hook vector field
     vectorField = gameObject.GetComponent <Motion3DVectorField>();
     vectorField.DisableVectorField();
 }
示例#2
0
        // Use this for initialization
        public void Start()
        {
            InitializeCameras();
            //Hook GUI menus
            configView           = GameObject.Find("Motion3DConfigView");
            setState1stOrderView = GameObject.Find("SetState1stOrderView");
            setState2ndOrderView = GameObject.Find("SetState2ndOrderView");
            mainMenuView         = GameObject.Find("MainMenuView");
            timeSliderComponent  = GameObject.Find("TimeSlider").GetComponent <TimeSlider>();
            userDefinedView      = GameObject.Find("UserDefinedView");
            fileManagerView      = GameObject.Find("FileManagerView");
            //Close GUI menus
            configView.SetActive(false);
            setState1stOrderView.SetActive(false);
            setState2ndOrderView.SetActive(false);
            mainMenuView.SetActive(false);
            userDefinedView.SetActive(false);
            fileManagerView.SetActive(false);
            //Hook Simulation Controller
            simController = gameObject.GetComponent <Motion3DSimulationController>();
            //Hook Motion3DObject's static reference to PositionTextModel
            Motion3DObject.positionTextModel = GameObject.Find("PositionTextModel");
            Motion3DObject.positionTextModel.SetActive(false);

            instance     = new InputField[100];
            instanceText = new Text[100];
        }
示例#3
0
        public MainWindow()
        {
            InitializeComponent();
            //UI
            tbSongName.DataContext = SuperSong;
            tbArtist.DataContext   = SuperSong;

            //Timer
            media.MediaEnded += Media_MediaEnded;
            _timer            = new DispatcherTimer
            {
                Interval = TimeSpan.FromSeconds(1)
            };
            _timer.Tick += _timer_Tick;

            //Slider
            TimeSlider.AddHandler(MouseLeftButtonUpEvent, new MouseButtonEventHandler(TimeSlider_MouseLeftButtonUp), true);
            TimeSlider.ValueChanged   += TimeSlider_ValueChanged;
            VolumeSlider.ValueChanged += VolumeSlider_ValueChanged;
            VolumeSlider.AddHandler(MouseLeftButtonUpEvent, new MouseButtonEventHandler(VolumnSlider_MouseLeftButtonUp), true);

            //Playlist
            lvNowPlaying.ItemsSource     = playlist;
            lvCustomPlaylist.ItemsSource = customplaylist;

            //Tooltip
            btnRepeatMode.DataContext     = playmode;
            btnPlayRandomMode.DataContext = isPlayingRandomly;

            //Hook
            _hook        = Hook.GlobalEvents();
            _hook.KeyUp += _hook_KeyUp;
        }
示例#4
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public MediaControls( )
        {
            InitializeComponent( );

            SliderTimer = new DispatcherTimer {
                Interval = TimeSpan.FromMilliseconds(250)
            };
            SliderTimer.Tick += (sender, args) => PerformTimeSlide( );

            TimeShower.Visibility = Visibility.Hidden;

            TimeSlider.ApplyTemplate( );

            thumb             = (( Track )TimeSlider.Template.FindName("PART_Track", TimeSlider)).Thumb;
            thumb.MouseEnter += (sender, e) =>
            {
                if (e.LeftButton != MouseButtonState.Pressed || e.MouseDevice.Captured != null)
                {
                    return;
                }

                MouseButtonEventArgs args = new MouseButtonEventArgs(e.MouseDevice, e.Timestamp, MouseButton.Left)
                {
                    RoutedEvent = MouseLeftButtonDownEvent
                };
                (( Thumb )sender).RaiseEvent(args);
            };
        }
示例#5
0
    // Use this for initialization
    void OnMazeDone()
    {
        GameObject go = GameObject.FindGameObjectWithTag("Player");

        if (go == null)
        {
            go = (GameObject)Instantiate(playerPrefab, spawnPosition, Quaternion.identity);
        }
        if (Camera.main.GetComponent <FollowPlayer>() == null)
        {
            Camera.main.gameObject.AddComponent <FollowPlayer>();
        }
        if (Camera.main.GetComponent <TimeSlider>() == null)
        {
            Camera.main.gameObject.AddComponent <TimeSlider>();
        }

        FollowPlayer fp = Camera.main.GetComponent <FollowPlayer>();

        fp.target = go.transform;
        fp.anyGuy = go.GetComponent <SneakerPlayer>();

        TimeSlider ts = Camera.main.GetComponent <TimeSlider>();

        ts.defaultTimeScale = defaultTime;
        ts.newTimeScale     = ts.defaultTimeScale;
    }
        private void ArcGISDynamicMapServiceLayer_Initialized(object sender, System.EventArgs e)
        {
            TimeExtent extent = new TimeExtent(MyTimeSlider.MinimumValue, MyTimeSlider.MaximumValue);

            MyTimeSlider.Intervals = TimeSlider.CreateTimeStopsByTimeInterval(extent, TimeSpan.FromDays(500));

            MyTimeSlider.Value = new TimeExtent(MyTimeSlider.MinimumValue, MyTimeSlider.MinimumValue.AddYears(10));
        }
示例#7
0
 private void MyTimeSlider_Loaded(object sender, RoutedEventArgs e)
 {
     MyTimeSlider.MinimumValue = DateTime.Now.Subtract(TimeSpan.FromDays(7)).ToUniversalTime();
     MyTimeSlider.MaximumValue = DateTime.Now.ToUniversalTime();
     MyTimeSlider.Value        = new TimeExtent(MyTimeSlider.MinimumValue, MyTimeSlider.MinimumValue.AddHours(2));
     MyTimeSlider.Intervals    = TimeSlider.CreateTimeStopsByTimeInterval(
         new TimeExtent(MyTimeSlider.MinimumValue, MyTimeSlider.MaximumValue), new TimeSpan(0, 2, 0, 0));
 }
示例#8
0
    public void Slider_Changed(float newCount)
    {
        int count = (int)newCount;

        DestroyGraph();
        DestroySpikes();
        ShowStaticGraph();
        VisGraph(count);
        TimeSlider.setValue();
    }
示例#9
0
    void Awake()
    {
        data = CSVReader.Read("brain_data");

        ShowStaticGraph();
        VisGraph(1);

        int end = (int)(maxRange * 0.03f);

        TimeSlider.setMinMax(0, end + 1);
    }
示例#10
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#11
0
 void Awake()
 {
     if(instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
示例#12
0
 // Start is called before the first frame update
 void Start()
 {
     transform.position = Checkpoint;                            //we need the origin location (will change on different checkpoints
     gameSession        = FindObjectOfType <GameSession>();      //Game Session
     timeSliderSript    = FindObjectOfType <TimeSlider>();       //Time slider
     rigidbody2d        = GetComponent <Rigidbody2D>();          //RigidBody
     animator           = GetComponent <Animator>();             //Animator
     Feet       = GetComponent <CapsuleCollider2D>();            //bottom collision part
     body       = GetComponent <BoxCollider2D>();                //top collision part
     timeWizard = FindObjectOfType <TimeWizard>();               //the main TIME Script
     health     = GetComponent <Health>();                       //the Health
 }
示例#13
0
 private void CreateUI()
 {
     this._strategicTurnLengthSlider      = new TimeSlider(this.App.UI, "gameStrategyTurnLength", this.App.GameSetup.StrategicTurnLength, 0.25f, 15f, 0.25f, true);
     this._combatTurnLengthSlider         = new TimeSlider(this.App.UI, "gameCombatTurnLength", this.App.GameSetup.CombatTurnLength, 3f, 12f, 1f, false);
     this._economicEfficiencySlider       = new PercentageSlider(this.App.UI, "gameEconomicEfficiency", this.App.GameSetup.EconomicEfficiency, 50, 200);
     this._researchEfficiencySlider       = new PercentageSlider(this.App.UI, "gameResearchEfficiency", this.App.GameSetup.ResearchEfficiency, 50, 200);
     this._planetResourcesSlider          = (ValueBoundSlider) new PercentageSlider(this.App.UI, "gameStarMapPlanetResSlider", this.App.GameSetup.PlanetResources, 50, 150);
     this._planetSizeSlider               = (ValueBoundSlider) new PercentageSlider(this.App.UI, "gameStarMapPlanetSizeSlider", this.App.GameSetup.PlanetSize, 50, 150);
     this._initialTreasurySlider          = new TreasurySlider(this.App.UI, "gameInitialTreasury", this.App.GameSetup.InitialTreasury, 0, 1000000);
     this._numPlayersSpinner              = new ValueBoundSpinner(this.App.UI, "gameNumPlayers", 2.0, 8.0, (double)this.App.GameSetup.Players.Count, 1.0);
     this._initialSystemsSpinner          = new ValueBoundSpinner(this.App.UI, "gameInitialSystems", 3.0, 9.0, (double)this.App.GameSetup.InitialSystems, 1.0);
     this._initialTechnologiesSpinner     = new ValueBoundSpinner(this.App.UI, "gameInitialTechs", 0.0, 10.0, (double)this.App.GameSetup.InitialTechnologies, 1.0);
     this._randomEncounterFrequencySlider = new PercentageSlider(this.App.UI, "gameRandomEncounterFrequency", this.App.GameSetup.RandomEncounterFrequency, 0, 200);
     this._grandMenaceSlider              = new ValueBoundSlider(this.App.UI, "gameGrandMenaces", 0, 5, this.App.GameSetup.GrandMenaceCount);
     foreach (Faction faction in this.App.AssetDatabase.Factions)
     {
         if (faction.IsPlayable)
         {
             this.App.UI.SetChecked(GameSetupState.UIAvailableFactionCheckBox(faction), this.App.GameSetup.AvailablePlayerFeatures.Factions.ContainsKey(faction));
         }
     }
     string[] strArray = new string[1] {
         "loa"
     };
     foreach (string str in strArray)
     {
         string expansionFactionName = str;
         if (!this.App.AssetDatabase.Factions.Any <Faction>((Func <Faction, bool>)(x => x.Name == expansionFactionName)))
         {
             this.App.UI.SetChecked(GameSetupState.UIAvailableFactionCheckBox(expansionFactionName), false);
             this.App.UI.SetVisible(GameSetupState.UIAvailableFactionFrame(expansionFactionName), false);
         }
     }
     this.App.UI.SetVisible("gameScenarioList", false);
     this.App.UI.SetVisible("gameStarMapList", true);
     this.App.UI.SetChecked("gameScenariosCheckbox", false);
     this.App.UI.SetChecked("gameMapsCheckbox", true);
     this.PopulateScenarioList();
     this.PopulateStarMapList();
     if (this._starmapIdMap.Count <= 0)
     {
         return;
     }
     if (ScriptHost.AllowConsole && this._starmapIdMap.Any <KeyValuePair <int, Starmap.StarmapInfo> >((Func <KeyValuePair <int, Starmap.StarmapInfo>, bool>)(x => x.Value.Title == "@STARMAP_TITLE_FIGHT")))
     {
         this.App.UI.SetSelection("gameStarMapList", this._starmapIdMap.FirstOrDefault <KeyValuePair <int, Starmap.StarmapInfo> >((Func <KeyValuePair <int, Starmap.StarmapInfo>, bool>)(x => x.Value.Title == "@STARMAP_TITLE_FIGHT")).Key);
     }
     else
     {
         this.App.UI.SetSelection("gameStarMapList", this._starmapIdMap.Keys.First <int>());
     }
 }
示例#14
0
        public override GameObject CreateObject(Transform parent)
        {
            if (valueControllerTemplate == null)
            {
                valueControllerTemplate = Resources.FindObjectsOfTypeAll <FormattedFloatListSettingsValueController>().First(x => x.name == "VRRenderingScale");
            }

            FormattedFloatListSettingsValueController baseSetting = Object.Instantiate(valueControllerTemplate, parent, false);

            baseSetting.name = "BSMLSliderSetting";

            GameObject gameObject = baseSetting.gameObject;

            T sliderSetting = gameObject.AddComponent <T>();

            Object.Destroy(gameObject.transform.Find("ValuePicker").gameObject);

            if (timeSliderTemplate == null)
            {
                timeSliderTemplate = Resources.FindObjectsOfTypeAll <TimeSlider>().First(s => s.name == "RangeValuesTextSlider" && s.transform.parent?.name == "SongStart");
            }

            sliderSetting.slider      = Object.Instantiate(timeSliderTemplate, gameObject.transform, false);
            sliderSetting.slider.name = "BSMLSlider";
            sliderSetting.slider.GetComponentInChildren <TextMeshProUGUI>().enableWordWrapping = false;
            (sliderSetting.slider.transform as RectTransform).anchorMin        = new Vector2(1, 0);
            (sliderSetting.slider.transform as RectTransform).anchorMax        = new Vector2(1, 1);
            (sliderSetting.slider.transform as RectTransform).sizeDelta        = new Vector2(40, 0);
            (sliderSetting.slider.transform as RectTransform).pivot            = new Vector2(1, 0.5f);
            (sliderSetting.slider.transform as RectTransform).anchoredPosition = new Vector2(0, 0);

            Object.Destroy(baseSetting);

            GameObject nameText = gameObject.transform.Find("NameText").gameObject;
            LocalizedTextMeshProUGUI localizedText = ConfigureLocalizedText(nameText);

            TextMeshProUGUI text = nameText.GetComponent <TextMeshProUGUI>();

            text.text = "Default Text";

            List <Component> externalComponents = gameObject.AddComponent <ExternalComponents>().components;

            externalComponents.Add(text);
            externalComponents.Add(localizedText);

            gameObject.GetComponent <LayoutElement>().preferredWidth = 90;

            gameObject.SetActive(true);
            return(gameObject);
        }
示例#15
0
    public void CreateTimeUI(GameObject target, float removeTime)
    {
        GameObject prefab = ResourceManager.Instance.GetUIPrefab("TimeRemainSlider");

        if (prefab)
        {
            GameObject go = Instantiate(prefab);
            go.transform.SetParent(target.transform);
            go.transform.localPosition = Vector3.zero;

            TimeSlider timeSlider = go.GetComponentInChildren <TimeSlider>();
            timeSlider.SetTime(target, removeTime);
        }
    }
示例#16
0
    public void TimeSlider_Changed(float newTime)
    {
        TimeSlider.setMinMax(startTimeSec, endTimeSec);
        int val = TimeSlider.getValue();

        dataSelectedTime.text = val.ToString();

        int maxPoint = Mathf.FloorToInt((((val * 100) / 3)));
        int minPoint = Mathf.FloorToInt((((startTimeSec * 100) / 3)));


        DestroyGraph();
        DestroySpikes();
        DestroyStaticPoints();

        VisGraph(minPoint, maxPoint);
    }
示例#17
0
        public static long CountTimeStopsByTimeInterval(DashboardHelper dashboardHelper, string timeVar)
        {
            List <string> columnNames = new List <string>();

            if (dashboardHelper.IsUsingEpiProject)
            {
                columnNames.Add("UniqueKey");
            }

            if (!string.IsNullOrEmpty(timeVar))
            {
                if (!columnNames.Exists(s => s.Equals(timeVar)))
                {
                    columnNames.Add(timeVar);
                }
            }

            DataTable data = dashboardHelper.GenerateTable(columnNames);

            var minTime = DateTime.MaxValue;
            var maxTime = DateTime.MinValue;
            var minX    = double.MaxValue;
            var maxX    = double.MinValue;
            var minY    = double.MaxValue;
            var maxY    = double.MinValue;

            if (data != null)
            {
                foreach (DataRow row in data.Rows)
                {
                    if (row[timeVar] != DBNull.Value)
                    {
                        DateTime time = (DateTime)row[timeVar];
                        minTime = minTime < time ? minTime : time;
                        maxTime = maxTime > time ? maxTime : time;
                    }
                }
            }

            IEnumerable <DateTime> intervals = TimeSlider.CreateTimeStopsByTimeInterval(
                new TimeExtent(minTime, maxTime), new TimeSpan(1, 0, 0, 0));

            return(intervals.ToList().Count);
        }
示例#18
0
 protected override void OnExit(GameState prev, ExitReason reason)
 {
     this.App.UI.DeleteScreen("GameSetup");
     if (this._starmapPreview != null)
     {
         this._starmapPreview.Dispose();
         this._starmapPreview = (StarMapPreview)null;
     }
     this._strategicTurnLengthSlider      = (TimeSlider)null;
     this._combatTurnLengthSlider         = (TimeSlider)null;
     this._economicEfficiencySlider       = (PercentageSlider)null;
     this._researchEfficiencySlider       = (PercentageSlider)null;
     this._planetResourcesSlider          = (ValueBoundSlider)null;
     this._planetSizeSlider               = (ValueBoundSlider)null;
     this._initialTreasurySlider          = (TreasurySlider)null;
     this._numPlayersSpinner              = (ValueBoundSpinner)null;
     this._initialSystemsSpinner          = (ValueBoundSpinner)null;
     this._initialTechnologiesSpinner     = (ValueBoundSpinner)null;
     this._randomEncounterFrequencySlider = (PercentageSlider)null;
     this._grandMenaceSlider              = (ValueBoundSlider)null;
     this._starmapIdMap  = (Dictionary <int, Starmap.StarmapInfo>)null;
     this._scenarioIdMap = (Dictionary <int, Scenario.ScenarioInfo>)null;
 }
示例#19
0
        private void TimeSlider_OnMouseMove(object Sender, MouseEventArgs E)
        {
            ResizeTimeShower( );

            // Getting the progress and finding the offset from the top left corner of the slider, relative to the canvas containing the notifier.
            double mouseFromLeftEdge = E.GetPosition(TimeSlider).X;

            double barWidth = TimeSlider.ActualWidth - thumb.ActualWidth;
            double mousePos = Math.Min(Math.Max(E.GetPosition(TimeSlider).X - thumb.ActualWidth / 2, 0), barWidth);
            double Progress = mousePos / barWidth;

            Point translated = TimeSlider.TranslatePoint(new Point(0, 0), PopupContainer);

            // The half width of the popup.
            double halfWidth        = TimeShower.ActualWidth / 2;
            double OffsetFromBorder = translated.X + mouseFromLeftEdge - halfWidth;

            double MaxRight      = this.ActualWidth - TimeShower.ActualWidth + thumb.ActualWidth / 2;
            double PointerOffset = 0;

            if (OffsetFromBorder < 0)
            {
                PointerOffset = OffsetFromBorder;
            }
            else if (OffsetFromBorder > MaxRight)
            {
                PointerOffset = OffsetFromBorder - MaxRight;
            }

            TimeSpan hoverTime = TimeSpan.FromTicks(( long )(Player.MediaPlayer.GetMediaLength( ).Ticks *Progress));

            TimeShower.TimeLabel.Content = hoverTime.ToString(TimeFormat);

            Canvas.SetLeft(TimeShower.Pointer, halfWidth + PointerOffset);
            Canvas.SetLeft(TimeShower, Math.Min(Math.Max(0, OffsetFromBorder), MaxRight));
            Canvas.SetTop(TimeShower, translated.Y - TimeShower.ActualHeight - TimeShower.Pointer.ActualHeight);
        }
示例#20
0
        public void OnDateRangeDefined(DateTime start, DateTime end, List <KeyValuePair <DateTime, int> > areaChartDataPoints)
        {
            this.areaChartDataPoints = areaChartDataPoints;

            myMap.TimeExtent = new TimeExtent(start.AddHours(-1), end.AddHours(1));

            slider.MinimumValue = myMap.TimeExtent.Start;
            slider.MaximumValue = myMap.TimeExtent.End;
            slider.Value        = new TimeExtent(slider.MinimumValue, slider.MinimumValue.AddHours(2));
            slider.Intervals    = TimeSlider.CreateTimeStopsByTimeInterval(new TimeExtent(slider.MinimumValue, slider.MaximumValue), new TimeSpan(1, 0, 0, 0));

            DateTimeAxis axis = new DateTimeAxis();

            axis.Orientation           = AxisOrientation.X;
            axis.Visibility            = Visibility.Hidden;
            axis.IntervalType          = DateTimeIntervalType.Days;
            axis.FontSize              = 0.1;
            areaSeries.IndependentAxis = axis;

            areaSeries.DependentValuePath   = "Value";
            areaSeries.IndependentValuePath = "Key";
            areaSeries.ItemsSource          = areaChartDataPoints;
            areaSeries.LegendItems.Clear();
        }
示例#21
0
 public StateOne(TimeSlider _timeSlider) : base(_timeSlider)
 {
 }
示例#22
0
 public State(TimeSlider _timeSlider)
 {
     TimeSlider = _timeSlider;
 }
示例#23
0
    void Awake()
    {
        m_timeUI = GameObject.FindWithTag("TimeSlider");

        m_timeSliderScript = m_timeUI.GetComponent <TimeSlider>();
    }
示例#24
0
 // Use this for initialization
 void Start()
 {
     spawnEnimies = true;
     time         = GameObject.FindObjectOfType <TimeSlider>();
 }
        public void RenderClusterMap(DashboardHelper dashboardHelper, string latVar, string longVar, Brush clusterColor, string timeVar, string description)
        {
            this.dashboardHelper = dashboardHelper;
            this.latVar          = latVar;
            this.longVar         = longVar;
            this.timeVar         = timeVar;
            this.description     = description;
            this.clusterColor    = (SolidColorBrush)clusterColor;

            GraphicsLayer clusterLayer = myMap.Layers[layerId.ToString()] as GraphicsLayer;

            if (clusterLayer != null)
            {
                clusterLayer.Graphics.Clear();
            }
            else
            {
                clusterLayer    = new GraphicsLayer();
                clusterLayer.ID = layerId.ToString();
                myMap.Layers.Add(clusterLayer);
            }

            CustomCoordinateList coordinateList = GetCoordinates(dashboardHelper, latVar, longVar, timeVar);

            for (int i = 0; i < coordinateList.Coordinates.Count; i++)
            {
                ExtendedGraphic graphic = new ExtendedGraphic()
                {
                    Geometry = new MapPoint(coordinateList.Coordinates[i].X, coordinateList.Coordinates[i].Y, geoReference),
                    RecordId = coordinateList.Coordinates[i].RecordId,
                    Symbol   = MarkerSymbol
                };
                if (coordinateList.Coordinates[i].TimeSpan.HasValue)
                {
                    graphic.TimeExtent = new TimeExtent(coordinateList.Coordinates[i].TimeSpan.Value);
                }
                else
                {
                    graphic.TimeExtent = new TimeExtent(DateTime.MinValue, DateTime.MaxValue);
                }
                graphic.MouseLeftButtonUp += new MouseButtonEventHandler(graphic_MouseLeftButtonUp);
                clusterLayer.Graphics.Add(graphic);
            }
            Brush flareForeground;

            if (System.Drawing.Color.FromArgb(this.clusterColor.Color.A, this.clusterColor.Color.R, this.clusterColor.Color.G, this.clusterColor.Color.B).GetBrightness() > 0.5)
            {
                flareForeground = new SolidColorBrush(Colors.Black);
            }
            else
            {
                flareForeground = new SolidColorBrush(Colors.White);
            }
            FlareClusterer clusterer = new FlareClusterer()
            {
                FlareBackground   = clusterColor,
                FlareForeground   = flareForeground,
                MaximumFlareCount = 10,
                Radius            = 15,
                Gradient          = ClustererGradient
            };

            clusterLayer.Clusterer = clusterer;

            if (LegendStackPanel == null)
            {
                LegendStackPanel = new StackPanel();
            }

            LegendStackPanel.Children.Clear();

            if (string.IsNullOrEmpty(description))
            {
                description = SharedStrings.CASES;
            }

            System.Windows.Controls.ListBox legendList = new System.Windows.Controls.ListBox();
            legendList.Padding         = new Thickness(0, 10, 0, 0);
            legendList.Background      = Brushes.White;
            legendList.BorderBrush     = Brushes.Black;
            legendList.BorderThickness = new Thickness(0);
            legendList.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Disabled);

            TextBlock classTextBlock = new TextBlock();

            classTextBlock.Text                = description;
            classTextBlock.FontFamily          = new FontFamily("Segoe");
            classTextBlock.FontSize            = 12;
            classTextBlock.MaxWidth            = 256;
            classTextBlock.TextWrapping        = TextWrapping.Wrap;
            classTextBlock.HorizontalAlignment = HorizontalAlignment.Center;
            classTextBlock.VerticalAlignment   = VerticalAlignment.Center;
            classTextBlock.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Disabled);

            Ellipse circle = new Ellipse();

            circle.Width             = 14;
            circle.Height            = 14;
            circle.VerticalAlignment = VerticalAlignment.Top;
            circle.Margin            = new Thickness(0, 4, 7, 4);
            circle.Fill = this.clusterColor;

            StackPanel classStackPanel = new StackPanel();

            classStackPanel.Margin      = new Thickness(10, 0, 10, 10);
            classStackPanel.Orientation = System.Windows.Controls.Orientation.Horizontal;
            classStackPanel.Children.Add(circle);
            classStackPanel.Children.Add(classTextBlock);

            legendList.Items.Add(classStackPanel);

            LegendStackPanel.Children.Add(legendList);


            if (coordinateList.Coordinates.Count > 0)
            {
                myMap.Extent = new Envelope(ESRI.ArcGIS.Client.Bing.Transform.GeographicToWebMercator(new MapPoint(minX - 0.01, minY - 0.01, geoReference)), ESRI.ArcGIS.Client.Bing.Transform.GeographicToWebMercator(new MapPoint(maxX + 0.01, maxY + 0.01, geoReference)));
                if (!string.IsNullOrEmpty(timeVar))
                {
                    if (minTime != null && maxTime != null)
                    {
                        intervalCounts = new List <KeyValuePair <DateTime, int> >();
                        DateTime previousInterval        = DateTime.MinValue;
                        IEnumerable <DateTime> intervals = TimeSlider.CreateTimeStopsByTimeInterval(new TimeExtent(minTime, maxTime), new TimeSpan(1, 0, 0, 0));
                        foreach (DateTime interval in intervals)
                        {
                            int count = clusterLayer.Graphics.Count(x => x.TimeExtent.Start <= interval && x.TimeExtent.Start >= previousInterval);
                            intervalCounts.Add(new KeyValuePair <DateTime, int>(interval.Date, count));
                            previousInterval = interval;
                        }
                        if (DateRangeDefined != null)
                        {
                            DateRangeDefined(minTime, maxTime, intervalCounts);
                        }
                    }
                }
            }
        }
示例#26
0
        private void Update()
        {
            if (!Game.AddPiece)
            {
                return;
            }

            if (increaseTime.Pressed())
            {
                TimeSliderObject sliderObj = FindObjectOfType <TimeSliderObject>();
                TimeSlider       slider    = FindObjectOfType <TimeSlider>();
                sliderObj.SetPercentage(
                    Mathf.Clamp01((slider.delegateTimeScale + 0.1f) / 2f));
            }
            if (decreaseTime.Pressed())
            {
                TimeSliderObject sliderObj = FindObjectOfType <TimeSliderObject>();
                TimeSlider       slider    = FindObjectOfType <TimeSlider>();
                sliderObj.SetPercentage(
                    Mathf.Clamp01((slider.delegateTimeScale - 0.1f) / 2f));
            }
            if (timeTo100.Pressed())
            {
                FindObjectOfType <TimeSliderObject>().SetPercentage(0.5f);
            }
            if (timeTo0.Pressed())
            {
                FindObjectOfType <TimeSliderObject>().SetPercentage(0.0f);
            }

            if (Game.IsSimulating)
            {
                return;
            }

            //Debug code helpful for filling out blockIndices table
#if DEBUG
            if (Input.GetKeyDown(KeyCode.N))
            {
                var buttons = tabController.tabs[tabController.activeTab]
                              .GetComponent <BlockMenuControl>().buttons;
                for (int i = 0; i < buttons.Length; i++)
                {
                    Debug.Log("buttons[" + i + "] = " + buttons[i]);
                }
            }
#endif

            if (pipette.Pressed())
            {
                RaycastHit hit;
                var        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                if (Physics.Raycast(ray, out hit))
                {
                    var myName = hit.transform.GetComponent <MyBlockInfo>().blockName;
                    for (int i = 0; i < PrefabMaster.BlockPrefabs.Count; i++)
                    {
                        var type = PrefabMaster.BlockPrefabs[i].gameObject;
                        if ((type.GetComponent <MyBlockInfo>() &&
                             type.GetComponent <MyBlockInfo>().blockName == myName) ||
                            (type.GetComponentInChildren <MyBlockInfo>() &&
                             type.GetComponentInChildren <MyBlockInfo>().blockName == myName))
                        {
                            StartCoroutine(ExecuteWithDisabledGhost(() => { Game.AddPiece.SetBlockType(i); }));
                            break;
                        }
                    }
                }
            }

            if (openSettings.Pressed())
            {
                RaycastHit hit;
                var        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                if (Physics.Raycast(ray, out hit))
                {
                    var block = hit.transform.gameObject.GetComponent <BlockBehaviour>();
                    FindObjectOfType <KeyMapModeButton>().KeyMapOn();
                    BlockSelect(block);
                    BlockMapper.Open(block);
                }
            }

            if (nextTab.Pressed())
            {
                currentTab = InternalToOrderedTabIndex(tabController.activeTab);
                tabController.OpenTab(tabIndices[mod(++currentTab, tabIndices.Length)]);
            }
            if (previousTab.Pressed())
            {
                currentTab = InternalToOrderedTabIndex(tabController.activeTab);
                tabController.OpenTab(tabIndices[mod(--currentTab, tabIndices.Length)]);
            }

            // Don't react to block shortcuts when block settings are open to prevent
            // typing a slider value changing what block is selected
            if (BlockMapper.CurrentInstance == null)
            {
                for (int i = 0; i < 9; i++)
                {
                    if (blockKeys[i].Pressed())
                    {
                        var index = blockIndices[
                            InternalToOrderedTabIndex(tabController.activeTab)][i];
                        if (index != -1)
                        {
                            StartCoroutine(ExecuteWithDisabledGhost(() =>
                            {
                                tabController.tabs[tabController.activeTab]
                                .GetComponent <BlockMenuControl>()
                                .buttons[index].Set();
                            }));
                        }
                    }
                }
            }

            for (int i = 0; i < 7; i++)
            {
                if (tabKeys[i].Pressed())
                {
                    tabController.OpenTab(tabIndices[i]);
                }
            }
        }
示例#27
0
        public void RenderPointMap(DashboardHelper dashboardHelper, string latVar, string longVar, Brush pointColor, string timeVar, SimpleMarkerSymbol.SimpleMarkerStyle style, string description)
        {
            this.dashboardHelper = dashboardHelper;
            this.latVar          = latVar;
            this.longVar         = longVar;
            this.timeVar         = timeVar;
            this.style           = style;
            this.description     = description;
            this.pointColor      = (SolidColorBrush)pointColor;

            GraphicsLayer pointLayer = myMap.Layers[layerId.ToString()] as GraphicsLayer;

            if (pointLayer != null)
            {
                pointLayer.Graphics.Clear();
            }
            else
            {
                pointLayer    = new GraphicsLayer();
                pointLayer.ID = layerId.ToString();
                myMap.Layers.Add(pointLayer);
            }

            CustomCoordinateList coordinateList = GetCoordinates(dashboardHelper, latVar, longVar, timeVar);

            for (int i = 0; i < coordinateList.Coordinates.Count; i++)
            {
                ExtendedGraphic graphic = new ExtendedGraphic()
                {
                    Geometry = new MapPoint(coordinateList.Coordinates[i].X, coordinateList.Coordinates[i].Y, geoReference),
                    RecordId = coordinateList.Coordinates[i].RecordId,
                    Symbol   = MarkerSymbol
                };
                if (coordinateList.Coordinates[i].TimeSpan.HasValue)
                {
                    graphic.TimeExtent = new TimeExtent(coordinateList.Coordinates[i].TimeSpan.Value);
                }
                else
                {
                    graphic.TimeExtent = new TimeExtent(DateTime.MinValue, DateTime.MaxValue);
                }
                graphic.MouseLeftButtonUp += new MouseButtonEventHandler(graphic_MouseLeftButtonUp);
                pointLayer.Graphics.Add(graphic);
            }

            if (LegendStackPanel == null)
            {
                LegendStackPanel = new StackPanel();
            }

            LegendStackPanel.Children.Clear();

            if (string.IsNullOrEmpty(description))
            {
                description = SharedStrings.CASES;
            }

            if (!string.IsNullOrEmpty(description))
            {
                System.Windows.Controls.ListBox legendList = new System.Windows.Controls.ListBox();
                legendList.Padding         = new Thickness(0, 10, 0, 0);
                legendList.Background      = Brushes.White;
                legendList.BorderBrush     = Brushes.Black;
                legendList.BorderThickness = new Thickness(0);
                legendList.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Disabled);

                TextBlock classTextBlock = new TextBlock();
                classTextBlock.Text                = description;
                classTextBlock.FontFamily          = new FontFamily("Segoe");
                classTextBlock.FontSize            = 12;
                classTextBlock.MaxWidth            = 256;
                classTextBlock.TextWrapping        = TextWrapping.Wrap;
                classTextBlock.HorizontalAlignment = HorizontalAlignment.Center;
                classTextBlock.VerticalAlignment   = VerticalAlignment.Center;
                classTextBlock.SetValue(ScrollViewer.HorizontalScrollBarVisibilityProperty, ScrollBarVisibility.Disabled);

                TextBlock symbolTextBlock = new TextBlock();
                switch (style)
                {
                case SimpleMarkerSymbol.SimpleMarkerStyle.Circle:
                    symbolTextBlock.Text     = "●";
                    symbolTextBlock.FontSize = 16;
                    break;

                case SimpleMarkerSymbol.SimpleMarkerStyle.Cross:
                    symbolTextBlock.Text       = "+";
                    symbolTextBlock.FontSize   = 18;
                    symbolTextBlock.FontWeight = FontWeights.Bold;
                    break;

                case SimpleMarkerSymbol.SimpleMarkerStyle.Diamond:
                    symbolTextBlock.Text     = "♦";
                    symbolTextBlock.FontSize = 17;
                    break;

                case SimpleMarkerSymbol.SimpleMarkerStyle.Square:
                    symbolTextBlock.Text     = "■";
                    symbolTextBlock.FontSize = 16;
                    break;

                case SimpleMarkerSymbol.SimpleMarkerStyle.Triangle:
                    symbolTextBlock.Text     = "▲";
                    symbolTextBlock.FontSize = 16;
                    break;

                default:
                    symbolTextBlock.Text     = "▲";
                    symbolTextBlock.FontSize = 16;
                    break;
                }
                symbolTextBlock.FontSize = 28;

                symbolTextBlock.VerticalAlignment = VerticalAlignment.Top;
                symbolTextBlock.Margin            = new Thickness(0, 4, 7, 4);
                symbolTextBlock.Foreground        = this.pointColor;

                StackPanel classStackPanel = new StackPanel();
                classStackPanel.Margin      = new Thickness(10, 0, 10, 10);
                classStackPanel.Orientation = System.Windows.Controls.Orientation.Horizontal;
                classStackPanel.Children.Add(symbolTextBlock);
                classStackPanel.Children.Add(classTextBlock);

                legendList.Items.Add(classStackPanel);

                LegendStackPanel.Children.Add(legendList);
            }

            if (coordinateList.Coordinates.Count > 0)
            {
                myMap.Extent = new Envelope(ESRI.ArcGIS.Client.Bing.Transform.GeographicToWebMercator(new MapPoint(minX - 0.01, minY - 0.01, geoReference)), ESRI.ArcGIS.Client.Bing.Transform.GeographicToWebMercator(new MapPoint(maxX + 0.01, maxY + 0.01, geoReference)));
                if (!string.IsNullOrEmpty(timeVar))
                {
                    if (minTime != null && maxTime != null)
                    {
                        intervalCounts = new List <KeyValuePair <DateTime, int> >();
                        DateTime previousInterval        = DateTime.MinValue;
                        IEnumerable <DateTime> intervals = TimeSlider.CreateTimeStopsByTimeInterval(new TimeExtent(minTime, maxTime), new TimeSpan(1, 0, 0, 0));
                        foreach (DateTime interval in intervals)
                        {
                            int count = pointLayer.Graphics.Count(x => x.TimeExtent.Start <= interval && x.TimeExtent.Start >= previousInterval);
                            intervalCounts.Add(new KeyValuePair <DateTime, int>(interval.Date, count));
                            previousInterval = interval;
                        }
                        if (DateRangeDefined != null)
                        {
                            DateRangeDefined(minTime, maxTime, intervalCounts);
                        }
                    }
                }
            }
        }
        private void FeatureLayer_Initialized(object sender, EventArgs e)
        {
            TimeExtent extent = new TimeExtent(timeSlider.MinimumValue, timeSlider.MaximumValue);

            timeSlider.Intervals = TimeSlider.CreateTimeStopsByTimeInterval(extent, new TimeSpan(0, 6, 0, 0, 0));
        }
示例#29
0
        private void RenderMap()
        {
            txtLoading.Visibility        = Visibility.Collapsed;
            waitCursor.Visibility        = Visibility.Collapsed;
            LayerTypeSelector.Visibility = Visibility.Visible;

            ESRI.ArcGIS.Client.Bing.TileLayer layer = new TileLayer();
            layer.Token      = "Aua5s8kFcEZMx5lsd8Vkerz3frboU1CwzvOyzX_vgSnzsnbqV7xlQ4WTRUlN19_Q";
            layer.LayerStyle = TileLayer.LayerType.AerialWithLabels;

            GraphicsLayer pointLayer = new GraphicsLayer();

            pointLayer.ID = "pointLayer";

            GraphicsLayer zoneLayer = new GraphicsLayer();

            zoneLayer.ID = "zoneLayer";

            GraphicsLayer textLayer = new GraphicsLayer();

            textLayer.ID = "textLayer";

            GraphicsLayer clusterLayer = new GraphicsLayer();

            clusterLayer.ID = "clusterLayer";

            GraphicsLayer shapeFileLayer = new GraphicsLayer();

            shapeFileLayer.ID = "shapefileGraphicsLayer";

            ContextMenu menu         = new ContextMenu();
            MenuItem    mnuTimeLapse = new MenuItem();

            mnuTimeLapse.Header = "Create Time Lapse...";
            mnuTimeLapse.Click += new RoutedEventHandler(mnuTimeLapse_Click);
            menu.Items.Add(mnuTimeLapse);
            menu.Items.Add(new Separator());
            MenuItem mnuMarker = new MenuItem();

            mnuMarker.Header = "Add marker";
            mnuMarker.Click += new RoutedEventHandler(mnuMarker_Click);
            menu.Items.Add(mnuMarker);
            MenuItem mnuRadius = new MenuItem();

            mnuRadius.Header = "Add zone";
            mnuRadius.Click += new RoutedEventHandler(mnuRadius_Click);
            menu.Items.Add(mnuRadius);
            MenuItem mnuText = new MenuItem();

            mnuText.Header = "Add label";
            mnuText.Click += new RoutedEventHandler(mnuText_Click);
            menu.Items.Add(mnuText);
            MenuItem mnuClear = new MenuItem();

            mnuClear.Header = "Clear graphics";
            mnuClear.Click += new RoutedEventHandler(mnuClear_Click);
            menu.Items.Add(mnuClear);
            menu.Items.Add(new Separator());
            MenuItem mnuSave = new MenuItem();

            mnuSave.Header = "Save map as image...";
            mnuSave.Click += new RoutedEventHandler(mnuSave_Click);
            menu.Items.Add(mnuSave);

            myMap             = new Map();
            myMap.Background  = Brushes.White;
            myMap.Height      = MapContainer.ActualHeight;
            myMap.Width       = MapContainer.ActualWidth;
            myMap.ContextMenu = menu;
            myMap.Layers.Add(layer);
            myMap.Layers.Add(shapeFileLayer);
            myMap.Layers.Add(pointLayer);
            myMap.Layers.Add(textLayer);
            myMap.Layers.Add(zoneLayer);
            myMap.Layers.Add(clusterLayer);
            myMap.MouseMove            += new MouseEventHandler(myMap_MouseMove);
            myMap.MouseRightButtonDown += new MouseButtonEventHandler(myMap_MouseRightButtonDown);
            MapContainer.Children.Add(myMap);

            ESRI.ArcGIS.Client.Behaviors.ConstrainExtentBehavior extentBehavior = new ESRI.ArcGIS.Client.Behaviors.ConstrainExtentBehavior();
            extentBehavior.ConstrainedExtent = new Envelope(new MapPoint(-20000000, -12000000), new MapPoint(20000000, 12000000));
            System.Windows.Interactivity.Interaction.GetBehaviors(myMap).Add(extentBehavior);

            Navigation nav = new Navigation();

            nav.Margin = new Thickness(5);
            nav.HorizontalAlignment = HorizontalAlignment.Left;
            nav.VerticalAlignment   = VerticalAlignment.Top;
            nav.Map = myMap;
            MapContainer.Children.Add(nav);

            slider               = new TimeSlider();
            slider.Name          = "slider";
            slider.PlaySpeed     = new TimeSpan(0, 0, 1);
            slider.Height        = 20;
            slider.TimeMode      = TimeMode.CumulativeFromStart;
            slider.MinimumValue  = DateTime.Now.Subtract(TimeSpan.FromDays(7)).ToUniversalTime();
            slider.MaximumValue  = DateTime.Now.ToUniversalTime();
            slider.Value         = new TimeExtent(slider.MinimumValue, slider.MinimumValue.AddHours(2));
            slider.Intervals     = TimeSlider.CreateTimeStopsByTimeInterval(new TimeExtent(slider.MinimumValue, slider.MaximumValue), new TimeSpan(0, 2, 0, 0));
            slider.Padding       = new Thickness(0, 100, 0, 0);
            slider.ValueChanged += new EventHandler <TimeSlider.ValueChangedEventArgs>(slider_ValueChanged);
            areaSeries.Loaded   += new RoutedEventHandler(areaSeries_Loaded);
            stkTimeLapse.Children.Add(slider);

            //grdMapDef.Background = Brushes.Black;
            //myMap.Background = Brushes.Black;
            SetBackgroundColor(defaultBackgroundColor);

            AddSelectionCriteria();
            AddFormatOptions();
            AddLayerList();

            if (MapLoaded != null)
            {
                MapLoaded(this, new EventArgs());
            }
        }
示例#30
0
    void Start()
    {
        ftrack.eid         = new KeyValuePair <int, int>(132974, 67924813);
        ftrack.frc         = new trackData();
        ftrack.frc.azi_rad = 3.00769365471949f;
        ftrack.frc.dec_rad = 0.016708671281222f;
        ftrack.frc.mjd     = 58714.7322249641;
        ftrack.frc.ra_rad  = 2.59716876080088;
        ftrack.frc.rec_t0  = 10983.2956250753f;
        ftrack.frc.rec_x   = -83.0575967774025f;
        ftrack.frc.rec_y   = 93.7020767723102f;
        ftrack.frc.rec_z   = -46.6655356299309f;
        ftrack.frc.zen_rad = 1.5858330048395f;



        curEvent = new List <eventData>();
        GameObject timeCon = GameObject.Find("timeController");

        if (timeCon != null)
        {
            timeController     = timeCon.GetComponent <Slider>();
            playbackController = timeCon.GetComponent <TimeSlider>();
            if (playbackController != null)
            {
                playbackController.OnStartPlaying.AddListener(delegate { StartedPlaying(); });
                playbackController.OnStopPlaying.AddListener(delegate { StoppedPlaying(); });
            }
        }
        GameObject gapCon = GameObject.Find("deltaController");

        if (gapCon != null)
        {
            deltaController = gapCon.GetComponent <Slider>();
        }
        if (timeController != null)
        {
            timeController.onValueChanged.AddListener(delegate { ValueChange(); });
        }
        if (deltaController != null)
        {
            deltaController.onValueChanged.AddListener(delegate { ValueChange(); });
        }
        GameObject tspn = GameObject.Find("timeSpan");

        if (tspn != null)
        {
            timeSpan = tspn.GetComponent <RangeSlider>();
            if (timeSpan != null)
            {
                timeSpan.onValueChanged.AddListener(delegate { ValueChange(); });
            }
        }
        GameObject zCon = GameObject.Find("zoomController");

        if (zCon != null)
        {
            zoomControl = zCon.GetComponent <Slider>();
            if (zoomControl != null)
            {
                zoomControl.onValueChanged.AddListener(delegate { zoomChange(); });
            }
        }
        GameObject hCon = GameObject.Find("hairController");

        if (hCon != null)
        {
            hairControl = hCon.GetComponent <Slider>();
            hairCover   = hCon.transform.parent.gameObject;
            if (hairControl != null)
            {
                hairControl.onValueChanged.AddListener(delegate { hairChange(); });
                hairChange();
            }
        }

        GameObject tCon = GameObject.Find("towerToggle");

        if (tCon != null)
        {
            towerControl = tCon.GetComponent <Toggle>();
            if (towerControl != null)
            {
                towerControl.onValueChanged.AddListener(delegate { towerChange(); });
            }
        }
        GameObject czCon = GameObject.Find("zillaToggle");

        if (czCon != null)
        {
            czillaControl = czCon.GetComponent <Toggle>();
            if (czillaControl != null)
            {
                czillaControl.onValueChanged.AddListener(delegate { czillaChange(); });
            }
        }
        foreach (singleBallList lst in ballArray)
        {
            foreach (singleBall bl in lst.balls)
            {
                if (bl != null)
                {
                    bl.setColor(new Color(0.9f, 0.9f, 0.9f));
                    bl.setScale(baseScale);
                }
            }
        }

        bank = new PatchBank(bankSource);
        if (bank == null)
        {
            Debug.LogFormat("Couldn't load music bank: {0}", bankSource);
        }
        else
        {
            int     maxPatch = 0;
            Patch[] arr      = bank.GetBank(0);
            while (maxPatch < arr.Length)
            {
                if (arr[maxPatch] == null)
                {
                    break;
                }
                maxPatch++;
            }
            for (int i = 0; i < stringArray.Length; i++)
            {
                if (stringArray[i] != null)
                {
                    //Debug.Log(ballArray[i].balls.Length);
                    stringArray[i].SetupWithBank(bank, i, maxPatch, 20, 85, ballArray[i + 1].balls.Length, stringArray.Length);
                }
            }
        }
        // size = scale * ( 0.2 * accum ) ** power
        updateToSet(true);
        updateTrackRot();
    }
示例#31
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            IsRepeating  = true;
            UseAnimation = true;

            OriginMouseSpeed = (uint)System.Windows.Forms.SystemInformation.MouseSpeed;
            Topmost          = true;

            var vlcLibDirectory = new DirectoryInfo(Path.Combine(
                                                        System.Reflection.Assembly.GetEntryAssembly().Location.Replace("TinyVideoPlayer.exe", ""),
                                                        "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64"));
            var options = new []
            {
                //"--file-logging", "-vvv", "--extraintf=logger", "--logfile=Logs.log",
                "--no-ignore-config"
            };

            VideoControl.SourceProvider.CreatePlayer(vlcLibDirectory, options);
            VideoControl.RenderTransform = new TransformGroup {
                Children = new TransformCollection {
                    new TranslateTransform(), new ScaleTransform()
                }
            };

            #region Events subscribing

            VideoControl.SourceProvider.MediaPlayer.EndReached       += MediaPlayer_EndReached;
            VideoControl.SourceProvider.MediaPlayer.MediaChanged     += MediaPlayer_MediaChanged;
            VideoControl.SourceProvider.MediaPlayer.PositionChanged  += MediaPlayer_PositionChanged;
            VideoControl.SourceProvider.MediaPlayer.EncounteredError += MediaPlayer_EncounteredError;
            VideoControl.Loaded  += VideoControl_Loaded;
            DropZone.MouseWheel  += DropZone_MouseWheel;
            DropZone.Drop        += DropZone_Drop;
            DropZone.SizeChanged += DropZone_SizeChanged;
            DropZone.PreviewMouseLeftButtonDown += DropZone_PreviewMouseLeftButtonDown;
            DropZone.PreviewMouseMove           += DropZone_PreviewMouseMove;
            DropZone.PreviewMouseLeftButtonUp   += DropZone_PreviewMouseLeftButtonUp;
            DropZone.MouseDown               += DropZone_MouseDown;
            MediaGrid.MouseEnter             += MediaGrid_MouseEnter;
            MediaGrid.MouseLeave             += MediaGrid_MouseLeave;
            SoundGrid.MouseEnter             += SoundGrid_MouseEnter;
            SoundGrid.MouseLeave             += SoundGrid_MouseLeave;
            ToolGrid.MouseEnter              += ToolGrid_MouseEnter;
            ToolGrid.MouseLeave              += ToolGrid_MouseLeave;
            TimeGrid.MouseEnter              += TimeGrid_MouseEnter;
            TimeGrid.MouseLeave              += TimeGrid_MouseLeave;
            ResizeButton.Click               += MediaButton_ButtonClick;
            MaximizeButton.Click             += MediaButton_ButtonClick;
            FindMediaButton.Click            += MediaButton_ButtonClick;
            BrowserButton.Click              += MediaButton_ButtonClick;
            ToggleMuteButton.Click           += MediaButton_ButtonClick;
            ToggleRepeatButton.Click         += MediaButton_ButtonClick;
            VolumeSlider.ValueChanged        += VolumeSlider_ValueChanged;
            TimeSlider.ValueChanged          += TimeSlider_ValueChanged;
            TimeSlider.PreviewMouseDown      += TimeSlider_PreviewMouseDown;
            TimeSlider.PreviewMouseUp        += TimeSlider_PreviewMouseUp;
            ThumbButton.Click                += ThumbButton_Click;
            FavoriteButton.Click             += FavoriteButton_Click;
            this.PreviewMouseLeftButtonDown  += MainWindow_PreviewMouseLeftButtonDown;
            this.PreviewMouseRightButtonDown += MainWindow_PreviewMouseRightButtonDown;
            this.PreviewMouseMove            += MainWindow_PreviewMouseMove;
            this.MouseEnter += MainWindow_MouseEnter;
            this.MouseLeave += MainWindow_MouseLeave;

            #endregion // Events subscribing

            #region Init bindings

            MediaGrid.SetBinding(Canvas.LeftProperty, new MultiBinding
            {
                Converter          = new CenterConverter(),
                ConverterParameter = "left",
                Mode     = BindingMode.TwoWay,
                Bindings =
                {
                    new Binding("ActualWidth")
                    {
                        Source = DropZone
                    },
                    new Binding("ActualHeight")
                    {
                        Source = DropZone
                    },
                    new Binding("ActualWidth")
                    {
                        Source = MediaGrid
                    },
                    new Binding("ActualHeight")
                    {
                        Source = MediaGrid
                    }
                }
            });
            DropMenu.SetBinding(Canvas.LeftProperty, new MultiBinding
            {
                Converter          = new CenterConverter(),
                ConverterParameter = "left",
                Mode     = BindingMode.TwoWay,
                Bindings =
                {
                    new Binding("ActualWidth")
                    {
                        Source = DropZone
                    },
                    new Binding("ActualHeight")
                    {
                        Source = DropZone
                    },
                    new Binding("ActualWidth")
                    {
                        Source = DropMenu
                    },
                    new Binding("ActualHeight")
                    {
                        Source = DropMenu
                    }
                }
            });
            DropMenu.SetBinding(Canvas.TopProperty, new MultiBinding
            {
                Converter          = new CenterConverter(),
                ConverterParameter = "top",
                Mode     = BindingMode.TwoWay,
                Bindings =
                {
                    new Binding("ActualWidth")
                    {
                        Source = DropZone
                    },
                    new Binding("ActualHeight")
                    {
                        Source = DropZone
                    },
                    new Binding("ActualWidth")
                    {
                        Source = DropMenu
                    },
                    new Binding("ActualHeight")
                    {
                        Source = DropMenu
                    }
                }
            });
            DropText.SetBinding(Canvas.TopProperty, new MultiBinding
            {
                Converter          = new CenterConverter(),
                ConverterParameter = "top",
                Mode     = BindingMode.TwoWay,
                Bindings =
                {
                    new Binding("ActualWidth")
                    {
                        Source = DropZone
                    },
                    new Binding("ActualHeight")
                    {
                        Source = DropZone
                    },
                    new Binding("ActualWidth")
                    {
                        Source = DropText
                    },
                    new Binding("ActualHeight")
                    {
                        Source = DropText
                    }
                }
            });
            TimeSlider.SetBinding(Canvas.BottomProperty, new MultiBinding
            {
                Converter          = new CenterConverter(),
                ConverterParameter = "bottom",
                Mode     = BindingMode.TwoWay,
                Bindings =
                {
                    new Binding("ActualWidth")
                    {
                        Source = DropZone
                    },
                    new Binding("ActualHeight")
                    {
                        Source = DropZone
                    },
                    new Binding("ActualWidth")
                    {
                        Source = TimeSlider
                    },
                    new Binding("ActualHeight")
                    {
                        Source = TimeSlider
                    }
                }
            });

            #endregion //Init bindings

            #region Init Visibility states

            ResizeButton.Visibility       = Visibility.Hidden;
            FindMediaButton.Visibility    = Visibility.Hidden;
            BrowserButton.Visibility      = Visibility.Hidden;
            MaximizeButton.Visibility     = Visibility.Hidden;
            VolumeSlider.Visibility       = Visibility.Hidden;
            ToggleMuteButton.Visibility   = Visibility.Hidden;
            DropMenu.Visibility           = Visibility.Visible;
            TimeSlider.Visibility         = Visibility.Hidden;
            ThumbButton.Visibility        = Visibility.Hidden;
            FavoriteButton.Visibility     = Visibility.Hidden;
            ToggleRepeatButton.Visibility = Visibility.Hidden;

            #endregion //Init Visibility states
        }