示例#1
0
        private void btnCopyDash_Click(object sender, RoutedEventArgs e)
        {
            if (ApplicationViewModel.Instance.DemoMode)
            {
                DemoMode dm = new DemoMode();
                dm.Show();
                return;
            }


            AdminDatasourceViewModel AdminDSVM = new AdminDatasourceViewModel();
            string OldCanvasName = cmbSavedDash.SelectedValue.ToString();
            //int CanvasId = ((CanvasDto)cmbSavedDash.SelectedValue).DatasourceID;
            string OldDatasourceName = ((DashboardInfo)cmbSavedDash.SelectedItem).DataSource.ToString();

            //int OldDatasourceId = applicationViewModel.EwavDatasources.First(ds => ds.DatasourceName == currentDsName).DatasourceID;

            string NewCanvasName = txtCanvasName.Text;
            //int UserId = applicationViewModel.LoggedInUser.UserDto.UserID;
            //int NewDatasourceId = ((Ewav.BAL.EwavDatasourceDto)(cmbDataSource.SelectedValue)).DatasourceID;

            string NewDatasourceName = ((Ewav.BAL.EwavDatasourceDto)(cmbDataSource.SelectedValue)).DatasourceName;

            AdminDSVM.CopyDashboard(OldCanvasName, NewCanvasName, OldDatasourceName, NewDatasourceName);
            AdminDSVM.CopyDashboardCompletedEvent -= new EventHandler <SimpleMvvmToolkit.NotificationEventArgs <Exception> >(AdminDSVM_CopyDashboardCompletedEvent);
            AdminDSVM.CopyDashboardCompletedEvent += new EventHandler <SimpleMvvmToolkit.NotificationEventArgs <Exception> >(AdminDSVM_CopyDashboardCompletedEvent);
            AdminDSVM.ErrorNotice -= new EventHandler <SimpleMvvmToolkit.NotificationEventArgs <Exception> >(AdminDSVM_ErrorNotice);
            AdminDSVM.ErrorNotice += new EventHandler <SimpleMvvmToolkit.NotificationEventArgs <Exception> >(AdminDSVM_ErrorNotice);
        }
示例#2
0
        /// <summary>
        /// Handles the Click event of the btnFinish control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs" /> instance containing the event data.</param>
        private void btnFinish_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (ApplicationViewModel.Instance.DemoMode)
            {
                DemoMode dm = new DemoMode();
                dm.Show();
                //MessageBox.Show("New Datasources cannot be added in DEMO mode.");
                return;
            }

            localDto.OrganizationId  = OrganizationId;
            localDto.DatasourceName  = tbDSName.Text;
            localDto.AssociatedUsers = new List <UserDTO>();
            List <UserDTO> selectList = selectedList.ToList <UserDTO>();
            List <UserDTO> adminList  = new ObservableCollection <UserDTO>(OriginalList.Where(t1 => t1.UserRoleInOrganization.ToLower() == "administrator" || t1.UserRoleInOrganization.ToLower() == "superadministrator")).ToList <UserDTO>();

            selectList.AddRange(adminList);

            //localDto.AssociatedUsers.AddRange(selectList);

            localDto.AssociatedUsers = selectedList.ToList <UserDTO>();

            if (radEnable.IsChecked == true)
            {
                localDto.IsActive = true;
            }
            else
            {
                localDto.IsActive = false;
            }

            FinishProcessing();
        }
示例#3
0
        private static ITradeMode GetTradeMode()
        {
            ITradeMode result = null;

            SettingsRepository repo      = ServiceLocator.Current.GetInstance <SettingsRepository>();
            WebApiClient       apiClient = ServiceLocator.Current.GetInstance <WebApiClient>();

            var list = repo.GetAll().Result;

            Settings settings = list.First();

            if (settings.Mode == "Test")
            {
                result = new TestMode(apiClient, repo);
            }

            if (settings.Mode == "Work")
            {
                result = new WorkMode(apiClient);
            }

            if (settings.Mode == "Demo")
            {
                result = new DemoMode(apiClient);
            }

            return(result);
        }
示例#4
0
        public DemoStream(int frequency = 60) : base(ComponentType.Component2d, frequency, true) // True for demoMode
        {
            // Load demo file
            demoMode = new DemoMode("Running.qd");
            demoMode.LoadDemoFile();

            currentFrame = 0;
        }
示例#5
0
        public void Clean()
        {
            cameras.Clear();
            cameras = null;

            demoMode.Dispose();
            demoMode = null;
        }
示例#6
0
    public bool ShowOnlyCustomDecks()
    {
        DemoMode mode = this.m_mode;

        if ((mode != DemoMode.BLIZZCON_2014) && (mode != DemoMode.BLIZZCON_2015))
        {
            return(false);
        }
        return(true);
    }
示例#7
0
 //manual mode
 private void rb_manual_CheckedChanged(object sender, EventArgs e)
 {
     if (rb_manual.Checked)
     {
         timer1.Stop();
         curMode           = DemoMode.Manual;
         next_btn.Enabled  = curState != DemoState.End;
         start_btn.Enabled = false;
     }
 }
示例#8
0
        //private void LoadDemo(DemoMode mode)
        //{
        //    // Add to the array list
        //    demos.Add(mode);
        //}

        //private void LoadDemos()
        //{
        // Load the actual demos
        //LoadDemo(new BounceMode());
        //LoadDemo(new FontMode());
        //LoadDemo(new DragMode());
        //LoadDemo(new ViewportMode());
        //LoadDemo(new MultipleMode());
        //}

        private void StopDemo()
        {
            // Stop the demo, if any
            if (currentDemo != null)
            {
                currentDemo.Stop();
                //currentDemo.Dispose();
                currentDemo = null;
            }
            //System.GC.Collect();
        }
示例#9
0
        private void SaveAs_Click(object sender, RoutedEventArgs e)
        {
            if (ApplicationViewModel.Instance.DemoMode)
            {
                DemoMode dm = new DemoMode();
                dm.Show();
                return;
            }


            SaveAsCall();
        }
示例#10
0
 private void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(this);
     }
 }
示例#11
0
        /// <summary>
        /// Handles the Click event of the OKButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param>
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (ApplicationViewModel.Instance.DemoMode)
            {
                DemoMode dm = new DemoMode();
                dm.Show();
                return;
            }



            applicationViewModel.DeleteCanvas(applicationViewModel.CurrentCanvasId);
        }
示例#12
0
        // Start form
        private void CruskalFormcs_Load(object sender, EventArgs e)
        {
            curMode          = DemoMode.Slow;
            timer1.Interval  = 750;
            cruscalEdgesList = new List <Edge>();
            cruscalEdgesList.AddRange(Edges);

            SortEdgesList(cruscalEdgesList);
            PrepareForMethod();
            RecalculateDrawingCoordinates();
            Form1.RandomizeWeightsPositions(cruscalEdgesList);
            drawing_panel.Refresh();
        }
示例#13
0
        private void SwitchDemo(int demo)
        {
            //// Ignore if the demo request is too high
            //if (demo < 0 || demo + 1 > demos.Count)
            //{
            //    return;
            //}
            if (demo != this.demo)
            {
                this.demo = demo;
                // Stop the demo, if any
                StopDemo();

                switch (demo)
                {
                case 0:
                    currentDemo = new BounceMode();
                    currentDemo.Start();
                    break;

                case 1:
                    currentDemo = new FontMode();
                    currentDemo.Start();
                    break;

                case 2:
                    currentDemo = new DragMode();
                    currentDemo.Start();
                    break;

                case 3:
                    currentDemo = new ViewportMode();
                    currentDemo.Start();
                    break;

                case 4:
                    currentDemo = new MultipleMode();
                    currentDemo.Start();
                    break;

                default:
                    currentDemo = new BounceMode();
                    currentDemo.Start();
                    break;
                }

                //// Start it
                //currentDemo = demos[demo];
                //currentDemo.Start();
            }
        }
示例#14
0
 //skip animation mode
 private void rb_noanime_CheckedChanged(object sender, EventArgs e)
 {
     if (rb_noanime.Checked)
     {
         curMode           = DemoMode.NoAnime;
         timer1.Interval   = 1;
         start_btn.Enabled = curState != DemoState.End;
         next_btn.Enabled  = false;
         if (curState == DemoState.Going)
         {
             timer1.Start();
         }
     }
 }
示例#15
0
        private void Save_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (ApplicationViewModel.Instance.DemoMode)
            {
                DemoMode dm = new DemoMode();
                dm.Show();
                return;
            }


            //SaveFile(element);
            //applicationViewModel.LoadCanvasUserList(user);
            //UserDTO user = new UserDTO();
            //user.UserID = applicationViewModel.LoggedInUser.UserDto.UserID;
            //User ewavUser = applicationViewModel.LoggedInUser;
            //ewavUser.UserDto = user;
            //applicationViewModel.LoggedInUser = ewavUser;                //    new UserDTO() { UserID = "1" };
            //applicationViewModel.DatasourceId = 1;
            //if (applicationViewModel.UserIdForOpenedCanvas == Convert.ToInt32(applicationViewModel.LoggedInUser.UserDto.UserID))
            //{
            //    applicationViewModel.CurrentCanvasId = applicationViewModel.CanvasIdForOpenedCanvas;
            //}
            if (applicationViewModel.CurrentCanvasId > 0)
            {
                XElement element = applicationViewModel.SerializeCanvas();

                CanvasDto dto = new CanvasDto();

                //dto.CanvasName = txtSaveTitle.Text;
                //dto.CanvasDescription = txtSaveDesc.Text;
                //dto.CreatedDate = DateTime.Now;
                dto.ModifiedDate = DateTime.Now;
                dto.CreatedDate  = DateTime.Now;
                //dto.DatasourceID = applicationViewModel.LoggedInUser.UserDto.DatasourceID;
                dto.XmlData = element;
                //dto.UserId = Convert.ToInt32(applicationViewModel.LoggedInUser.UserDto.UserID);
                //dto.UserId.UserId1 = "1";
                dto.IsNewCanvas = false;
                dto.CanvasId    = applicationViewModel.CurrentCanvasId;
                applicationViewModel.SaveCanvas(element, dto);
                savedash         = new SaveDash("success");
                savedash.Closed += new EventHandler(savedash_Closed);
                savedash.Show();
            }
            else
            {
                SaveAsCall();
            }
        }
示例#16
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="disposing"></param>
 protected virtual void Dispose(bool disposing)
 {
     if (!this.disposed)
     {
         if (disposing)
         {
             this.screen.Dispose();
             if (currentDemo != null)
             {
                 currentDemo.Dispose();
                 currentDemo = null;
             }
         }
         this.disposed = true;
     }
 }
示例#17
0
        /// <summary>
        /// Handles the Click event of the HyperlinkButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs" /> instance containing the event data.</param>
        private void HyperlinkButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (ApplicationViewModel.Instance.DemoMode)
            {
                DemoMode dm = new DemoMode();
                dm.Show();
                return;
            }


            // TODO: Add event handler implementation here.
            this.DialogResult = false;
            ForgotPwd fp = new ForgotPwd();

            fp.Show();
        }
示例#18
0
        void Start()
        {
            if (GameManager.Instance != null)
            {
                mode = GameManager.Instance.Mode;
            }

            if (mode == DemoMode.ECSConversion)
            {
                SetupECSConversion();
            }

            if (mode == DemoMode.ECSPure)
            {
                SetupECSPure();
            }

            SpawnUnit(initialNumToSpawn);
        }
示例#19
0
//---------------------------------------------------------------------------
// SwitchModes - Invoked by the button on top of the screen
//---------------------------------------------------------------------------
        public void SwitchModes()
        {
            this.statementIndex = 0;
            switch (this.mode)
            {
            case DemoMode.Character:
            {
                this.mode                       = DemoMode.Checkerboard;
                this.TitleText.text             = "Checkerboard";
                this.SwitchModesButtonText.text = "View Character";
            }
            break;

            case DemoMode.Checkerboard:
            {
                this.mode                       = DemoMode.Character;
                this.TitleText.text             = "Multi-Part Character";
                this.SwitchModesButtonText.text = "View Checkerboard";
            }
            break;
            }
        }
示例#20
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            if (ApplicationViewModel.Instance.DemoMode)
            {
                DemoMode dm = new DemoMode();
                dm.Show();
                return;
            }



            waitCursor.Visibility = System.Windows.Visibility.Visible;
            UserListCollection userList = (UserListCollection)dgUsers.ItemsSource;

            var filteredList = from user in userList
                               where user.IsSelected == true
                               select new { FirstName = user.FirstName, LastName = user.LastName, UserID = user.UserId };
            List <int> userIds = new List <int>();



            foreach (var item in filteredList)
            {
                userIds.Add(item.UserID);
            }
            if (applicationViewModel.CurrentCanvasId > 0)
            {
                applicationViewModel.ShareCanvas(applicationViewModel.CurrentCanvasId, userIds);

                string xx = string.Join <int>(",", userIds);
            }
            else
            {
                MessageBox.Show("Cannot share unsaved canvas.");
            }

            //this.DialogResult = true;
        }
示例#21
0
        private void btnSendEmail_Click(object sender, RoutedEventArgs e)
        {
            if (ApplicationViewModel.Instance.DemoMode)
            {
                DemoMode dm = new DemoMode();
                dm.Show();
                return;
            }


            UserListCollection SharedUserList = (UserListCollection)dgSharedUsers.ItemsSource;



            var filteredList = from user in SharedUserList
                               where user.IsSelected == true
                               select new { FirstName = user.FirstName, LastName = user.LastName, UserID = user.UserId };
            List <int> userIds = new List <int>();

            if (filteredList.Count() == 0)
            {
                spMsg.Visibility       = System.Windows.Visibility.Visible;
                tbSaveError.Visibility = System.Windows.Visibility.Visible;
                return;
            }

            foreach (var item in filteredList)
            {
                userIds.Add(item.UserID);
            }
            if (applicationViewModel.CurrentCanvasId > 0)
            {
                applicationViewModel.ResendEmail(applicationViewModel.CurrentCanvasId, userIds);
            }
            waitCursor.Visibility  = System.Windows.Visibility.Visible;
            spMsg.Visibility       = System.Windows.Visibility.Collapsed;
            btnSendEmail.IsEnabled = false;
        }
示例#22
0
        private void Delete_Click(object sender, RoutedEventArgs e)
        {
            if (ApplicationViewModel.Instance.DemoMode)
            {
                DemoMode dm = new DemoMode();
                dm.Show();
                return;
            }


            if (applicationViewModel.CurrentCanvasId != -1) // if its equal to -1 means it belongs to different user or hasn't been saved.
            {
                dd         = new DeleteDash();
                dd.Closed += new EventHandler(dd_Closed);
                dd.Show();
            }
            else
            {
                WarningWindow error = new WarningWindow("This is a shared dashboard and cannot be deleted, or dashboard does not exist. ", "");
                error.Show();
                //MessageBox.Show("This canvas is either shared by someone or not saved. Please save the canvas before performing this operation.");
            }
        }
示例#23
0
        private void btnSave_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (ApplicationViewModel.Instance.DemoMode)
            {
                DemoMode dm = new DemoMode();
                dm.Show();
                return;
            }


            // TODO: Add event handler implementation here.
            //spMsg_Success.Visibility = System.Windows.Visibility.Visible;
            //spSave.Visibility = System.Windows.Visibility.Collapsed;
            //if (spMsg.Visibility != System.Windows.Visibility.Visible)
            //{
            //}
            //else
            //{
            //    //spMsg.Visibility = System.Windows.Visibility.Collapsed;
            //    //this.DialogResult = true;
            //}
            XElement element = applicationViewModel.SerializeCanvas();

            CanvasDto dto = new CanvasDto();

            dto.CanvasName        = txtSaveTitle.Text;
            dto.CanvasDescription = txtSaveDesc.Text;
            dto.CreatedDate       = DateTime.Now;
            dto.ModifiedDate      = DateTime.Now;
            // dto.DatasourceID = applicationViewModel.LoggedInUser.UserDto.DatasourceID;
            dto.DatasourceID = applicationViewModel.EwavSelectedDatasource.DatasourceID;
            dto.XmlData      = element;
            dto.UserId       = Convert.ToInt32(applicationViewModel.LoggedInUser.UserDto.UserID);
            dto.IsNewCanvas  = true;
            applicationViewModel.SelectedCanvasName = txtSaveTitle.Text;
            applicationViewModel.SaveCanvas(element, dto);
        }
示例#24
0
        internal static PlayerClusterViewModel BuildClusterViewModelForPlayer(ArkClusterContext context, ArkCloudInventory cloudInventory, DemoMode demoMode, bool incCreaturesCloud)
        {
            var vm = new PlayerClusterViewModel();

            if (incCreaturesCloud)
            {
                foreach (var c in cloudInventory.Dinos)
                {
                    var aliases = ArkSpeciesAliases.Instance.GetAliasesByClassName(c.ClassName);
                    var vmc     = new CloudCreatureViewModel
                    {
                        Name      = demoMode?.GetCreatureName(c.Id1, c.Id2, aliases?.FirstOrDefault()) ?? c.Name,
                        ClassName = c.ClassName,
                        Species   = aliases?.FirstOrDefault(),
                        Aliases   = aliases?.Skip(2).ToArray() ?? new string[] { }, //skip primary name and class name
                        Level     = c.Level
                    };
                    vm.Creatures.Add(vmc);
                }
            }

            return(vm);
        }
示例#25
0
        /// <summary>Draw some helpful gui</summary>
        public void OnGUI()
        {
            GUILayout.BeginArea(new Rect(5, 5, 220, Screen.height - 10), "", "Box");

            switch (activeDemo)
            {
            case DemoMode.ABPath:
                GUILayout.Label("Basic path. Finds a path from point A to point B."); break;

            case DemoMode.MultiTargetPath:
                GUILayout.Label("Multi Target Path. Finds a path quickly from one point to many others in a single search."); break;

            case DemoMode.RandomPath:
                GUILayout.Label("Randomized Path. Finds a path with a specified length in a random direction or biased towards some point when using a larger aim strenggth."); break;

            case DemoMode.FleePath:
                GUILayout.Label("Flee Path. Tries to flee from a specified point. Remember to set Flee Strength!"); break;

            case DemoMode.ConstantPath:
                GUILayout.Label("Finds all nodes which it costs less than some value to reach."); break;

            case DemoMode.FloodPath:
                GUILayout.Label("Searches the whole graph from a specific point. FloodPathTracer can then be used to quickly find a path to that point"); break;

            case DemoMode.FloodPathTracer:
                GUILayout.Label("Traces a path to where the FloodPath started. Compare the calculation times for this path with ABPath!\nGreat for TD games"); break;
            }

            GUILayout.Space(5);

            GUILayout.Label("Note that the paths are rendered without ANY post-processing applied, so they might look a bit edgy");

            GUILayout.Space(5);

            GUILayout.Label("Click anywhere to recalculate the path. Hold Alt to continuously recalculate the path while the mouse is pressed.");

            if (activeDemo == DemoMode.ConstantPath || activeDemo == DemoMode.RandomPath || activeDemo == DemoMode.FleePath)
            {
                GUILayout.Label("Search Distance (" + searchLength + ")");
                searchLength = Mathf.RoundToInt(GUILayout.HorizontalSlider(searchLength, 0, 100000));
            }

            if (activeDemo == DemoMode.RandomPath || activeDemo == DemoMode.FleePath)
            {
                GUILayout.Label("Spread (" + spread + ")");
                spread = Mathf.RoundToInt(GUILayout.HorizontalSlider(spread, 0, 40000));

                GUILayout.Label((activeDemo == DemoMode.RandomPath ? "Aim strength" : "Flee strength") + " (" + aimStrength + ")");
                aimStrength = GUILayout.HorizontalSlider(aimStrength, 0, 1);
            }

            if (activeDemo == DemoMode.MultiTargetPath)
            {
                GUILayout.Label("Hold shift and click to add new target points. Hold ctr and click to remove all target points");
            }

            if (GUILayout.Button("A to B path"))
            {
                activeDemo = DemoMode.ABPath;
            }
            if (GUILayout.Button("Multi Target Path"))
            {
                activeDemo = DemoMode.MultiTargetPath;
            }
            if (GUILayout.Button("Random Path"))
            {
                activeDemo = DemoMode.RandomPath;
            }
            if (GUILayout.Button("Flee path"))
            {
                activeDemo = DemoMode.FleePath;
            }
            if (GUILayout.Button("Constant Path"))
            {
                activeDemo = DemoMode.ConstantPath;
            }
            if (GUILayout.Button("Flood Path"))
            {
                activeDemo = DemoMode.FloodPath;
            }
            if (GUILayout.Button("Flood Path Tracer"))
            {
                activeDemo = DemoMode.FloodPathTracer;
            }

            GUILayout.EndArea();
        }
示例#26
0
 void Start()
 {
     d = GameObject.Find("Main Camera").GetComponent <DemoMode>();
 }
示例#27
0
        /// <summary>
        /// Handles the Click event of the btnFinish control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs" /> instance containing the event data.</param>
        private void btnFinish_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            if (ApplicationViewModel.Instance.DemoMode)
            {
                DemoMode dm = new DemoMode();
                dm.Show();
                return;
            }


            Storyboard2.Begin();
            tbStep1.Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
            rectStep1.Fill     = new SolidColorBrush(Color.FromArgb(255, 38, 198, 48));
            tbStep2.Foreground = new SolidColorBrush(Color.FromArgb(255, 122, 122, 122));
            rectStep2.Fill     = new SolidColorBrush(Color.FromArgb(255, 122, 122, 122));

            //userDto = userDtoCopy;
            //this.SelectedUserDto = new UserDTO();
            if (this.SelectedUserDto == null)
            {
                this.SelectedUserDto = new UserDTO();
            }
            this.SelectedUserDto.FirstName = tbFirstName.Text;
            this.SelectedUserDto.LastName  = tbLastName.Text;
            if (ApplicationViewModel.Instance.AuthenticationMode.ToString().ToLower() == "windows")
            {
                this.SelectedUserDto.Email    = tbEmailAddress.Text.ToString().ToLower();
                this.SelectedUserDto.UserName = tbUserID.Text.ToString().ToLower();
            }
            else
            {
                this.SelectedUserDto.Email    = autoEmail.Text.ToString().ToLower();
                this.SelectedUserDto.UserName = autoEmail.Text.ToLower();
            }

            this.SelectedUserDto.Phone = tbPhone.Text;
            //this.SelectedUserDto.RoleValue = Convert.ToInt32(Enum.Parse(typeof(RolesEnum), ((ComboBoxItem)cmbRole.SelectedValue).Content.ToString(), false));
            this.SelectedUserDto.UserRoleInOrganization = ((ComboBoxItem)cmbRole.SelectedItem).Content.ToString(); // cmbRole.SelectedValue.ToString();

            //this.SelectedUserDto.OrganizationID = User.Instance.UserDto.OrganizationID;
            this.SelectedUserDto.DatasourceList = ReadDatasourceList(this.SelectedUserDto.UserRoleInOrganization);

            UserOrganizationDto dto = new UserOrganizationDto();


            dto.Organization = new OrganizationDto();

            dto.Organization.Active           = this.SelectedOrg.Active;
            dto.Organization.AdminCount       = this.SelectedOrg.AdminCount;
            dto.Organization.AnalystCount     = this.SelectedOrg.AnalystCount;
            dto.Organization.DatasourceCount  = this.SelectedOrg.DatasourceCount;
            dto.Organization.DatasourcesCount = this.SelectedOrg.DatasourcesCount;
            dto.Organization.Description      = "";
            dto.Organization.Id              = this.SelectedOrg.Id;
            dto.Organization.Name            = this.SelectedOrg.Name;
            dto.Organization.SuperAdminCount = this.SelectedOrg.SuperAdminCount;
            dto.Organization.TotalUserCount  = this.SelectedOrg.TotalUserCount;


            dto.RoleId = Convert.ToInt32(Enum.Parse(typeof(RolesEnum), ((ComboBoxItem)cmbRole.SelectedValue).Content.ToString(), false));
            dto.Active = (cmbActive.SelectionBoxItem.ToString() == "Yes") ? true : false;


            switch (Mode)
            {
            case ModeType.Add:
                dto.User = this.SelectedUserDto;
                uvm.AddUser(dto);
                uvm.UserAdded       += new EventHandler(uvm_UserAdded);
                uvm.UserAddedFailed += new EventHandler(uvm_UserAddedFailed);
                break;

            case ModeType.Edit:
                this.SelectedUserDto.UserID       = this.SelectedUserDto.UserID;
                this.SelectedUserDto.PasswordHash = this.SelectedUserDto.PasswordHash;
                this.SelectedUserDto.UserEditType = UserEditType.EditingUserInfo;
                dto.User = this.SelectedUserDto;
                uvm.UpdateUser(dto);
                uvm.UserUpdated += new EventHandler(uvm_UserUpdated);
                break;

            default:
                break;
            }

            btnFinish.IsEnabled = false;
            this.DialogResult   = true;
        }
示例#28
0
        internal static List <TamedCreatureViewModel> BuildCreatureViewModelsForPlayerId(ArkServerContext context, IConfig config, int playerId, DemoMode demoMode, bool incBaseStats = false)
        {
            var result = new List <TamedCreatureViewModel>();

            if (context.TamedCreatures != null)
            {
                var player               = context.Players?.FirstOrDefault(x => x.Id == playerId);
                var playercreatures      = context.NoRafts.Where(x => x.TargetingTeam == playerId || x.OwningPlayerId.HasValue && x.OwningPlayerId == playerId).ToArray();
                var playercreatures_cryo = player?.Items?.OfType <ArkItemCryopod>().Where(x => x.Dino != null).Select(x => x.Dino).ToArray() ?? new ArkTamedCreature[] { };
                var tribe          = player != null ? player.Tribe : context.Tribes?.FirstOrDefault(x => x.MemberIds.Contains(playerId));
                var tribecreatures = tribe != null?context.NoRafts.Where(x => x.TargetingTeam == tribe.Id && !playercreatures.Any(y => y.Id == x.Id)).ToArray() : new ArkTamedCreature[]
                {
                };
                var tribecreatures_cryo = tribe?.Items?.OfType <ArkItemCryopod>().Where(x => x.Dino != null).Select(x => x.Dino).ToArray() ?? new ArkTamedCreature[] { };
                foreach (var item in playercreatures.Select(x => new { c = x, o = "player", cryo = false })
                         .Concat(playercreatures_cryo.Select(x => new { c = x, o = "player", cryo = true }))
                         .Concat(tribecreatures.Select(x => new { c = x, o = "tribe", cryo = false }))
                         .Concat(tribecreatures_cryo.Select(x => new { c = x, o = "tribe", cryo = true })))
                {
                    var currentFood = item.c.CurrentStatusValues?.Length > 4 ? item.c.CurrentStatusValues[4] : null;
                    var maxFood     = item.c.BaseStats?.Length > 4 && item.c.TamedStats?.Length > 4 ?
                                      ArkDataHelper.CalculateMaxStat(
                        ArkSpeciesStatsData.Stat.Food,
                        item.c.ClassName,
                        true,
                        item.c.BaseStats[4],
                        item.c.TamedStats[4],
                        (decimal)(item.c.DinoImprintingQuality ?? 0f),
                        (decimal)(item.c.TamedIneffectivenessModifier ?? 0f)) : null;

                    //baby food formula: max * 0.1 + (max - (max * 0.1)) * age
                    if (maxFood.HasValue && item.c.BabyAge.HasValue)
                    {
                        maxFood = maxFood.Value * 0.1 + (maxFood.Value - maxFood.Value * 0.1) * item.c.BabyAge.Value;
                    }

                    var foodStatus = currentFood.HasValue && maxFood.HasValue ? currentFood.Value / (float)maxFood.Value : (float?)null;
                    if (foodStatus.HasValue && foodStatus > 1f)
                    {
                        foodStatus = 1f;
                    }

                    //baby fully grown
                    var babyFullyGrownTimeApprox = (DateTime?)null;
                    if (item.c.IsBaby && item.c.BabyAge.HasValue && context.SaveState.GameTime.HasValue)
                    {
                        var babyFullyGrown = ArkDataHelper.CalculateBabyFullyGrown(item.c.ClassName, item.c.BabyAge.Value, context.Config.ArkMultipliers);
                        babyFullyGrownTimeApprox = context.SaveState.GetApproxDateTimeOf(context.SaveState.GameTime.Value + babyFullyGrown);
                    }

                    var aliases = ArkSpeciesAliases.Instance.GetAliasesByClassName(item.c.ClassName);
                    var vmc     = new TamedCreatureViewModel
                    {
                        Id1            = item.c.Id1,
                        Id2            = item.c.Id2,
                        Name           = demoMode?.GetCreatureName(item.c.Id1, item.c.Id2, aliases?.FirstOrDefault()) ?? item.c.Name,
                        ClassName      = item.c.ClassName,
                        Species        = aliases?.FirstOrDefault(),
                        Aliases        = aliases?.Skip(2).ToArray() ?? new string[] { }, //skip primary name and class name
                        Gender         = item.c.Gender.ToString(),
                        BaseLevel      = item.c.BaseLevel,
                        Level          = item.c.Level,
                        Experience     = item.c.ExperiencePoints ?? 0f,
                        BabyAge        = item.c.IsBaby ? item.c.BabyAge : null,
                        Imprint        = item.c.DinoImprintingQuality,
                        FoodStatus     = foodStatus,
                        Latitude       = item.cryo ? null : item.c.Location?.Latitude,
                        Longitude      = item.cryo ? null : item.c.Location?.Longitude,
                        TopoMapX       = item.cryo ? null : item.c.Location?.TopoMapX,
                        TopoMapY       = item.cryo ? null : item.c.Location?.TopoMapY,
                        NextMating     = !item.c.IsBaby && item.c.Gender == ArkCreatureGender.Female ? item.c.NextAllowedMatingTimeApprox : null,
                        BabyFullyGrown = babyFullyGrownTimeApprox,
                        BabyNextCuddle = item.c.BabyNextCuddleTimeApprox,
                        OwnerType      = item.o,
                        InCryopod      = item.cryo,
                        Parents        = item.c.DinoAncestors?.Length > 0 && item.c.DinoAncestorsMale?.Length > 0 ? new CreatureParentsViewModel
                        {
                            Female = new CreatureIdViewModel {
                                Id1 = item.c.DinoAncestors.First().FemaleId1, Id2 = item.c.DinoAncestors.First().FemaleId2
                            },
                            Male = new CreatureIdViewModel {
                                Id1 = item.c.DinoAncestorsMale.First().MaleId1, Id2 = item.c.DinoAncestorsMale.First().MaleId2
                            }
                        } : null,
                        RandomMutationsFemale = item.c.RandomMutationsFemale,
                        RandomMutationsMale   = item.c.RandomMutationsMale,
                    };
                    if (incBaseStats)
                    {
                        //0: health
                        //1: stamina
                        //2: torpor
                        //3: oxygen
                        //4: food
                        //5: water
                        //6: temperature
                        //7: weight
                        //8: melee damage
                        //9: movement speed
                        //10: fortitude
                        //11: crafting speed

                        vmc.BaseStats = new CreatureStatsViewModel
                        {
                            Health        = item.c.BaseStats[0],
                            Stamina       = item.c.BaseStats[1],
                            Oxygen        = item.c.BaseStats[3],
                            Food          = item.c.BaseStats[4],
                            Weight        = item.c.BaseStats[7],
                            Melee         = item.c.BaseStats[8],
                            MovementSpeed = item.c.BaseStats[9]
                        };

                        vmc.TamedStats = new CreatureStatsViewModel
                        {
                            Health        = item.c.TamedStats[0],
                            Stamina       = item.c.TamedStats[1],
                            Oxygen        = item.c.TamedStats[3],
                            Food          = item.c.TamedStats[4],
                            Weight        = item.c.TamedStats[7],
                            Melee         = item.c.TamedStats[8],
                            MovementSpeed = item.c.TamedStats[9]
                        };

                        var statValues = ArkSpeciesStats.Instance.Data.GetStatValues(item.c);
                        vmc.StatValues = new CreatureStatValuesViewModel
                        {
                            Tamed          = statValues.tamed,
                            TamedNoImprint = statValues.tamedNoImprint,
                            Wild           = statValues.wild,
                        };
                    }
                    result.Add(vmc);
                }
            }

            return(result);
        }
        /// <summary>
        /// Handler for recognized speech events.
        /// </summary>
        /// <param name="sender">object sending the event.</param>
        /// <param name="e">event arguments.</param>
        public void SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            // Ignore speech if the coach is talking
            // (Does not work perfectly, confidence threshold set higher for this reason)
            if (coach.isSpeaking)
            {
                return;
            }

            // Speech utterance confidence below which we treat speech as if it hadn't been heard
            const double ConfidenceThreshold = 0.7;

            if (e.Result.Confidence >= ConfidenceThreshold)
            {
                if (!listening)
                {
                    switch (e.Result.Semantics["type"].Value.ToString())
                    {
                        case "startlisten":
                            coach.Speak("Ready");
                            signal.Text = "Ready";
                            ClearAll();
                            listening = true;
                            break;
                    }
                }
                else
                {
                    switch (e.Result.Semantics["type"].Value.ToString())
                    {
                        case "stoplisten":
                            coach.Speak("Understood.  Bye, for now.");
                            ClearAll();
                            signal.Text = "Deactivated";
                            listening = false;
                            break;
                        case "simple":
                            switch (e.Result.Semantics["command"].Value.ToString())
                            {
                                case "recording":
                                    StartRecordingSkeleton("recording");
                                    break;
                                case "stoprecording":
                                    StopRecordingSkeleton();
                                    break;
                                case "show":
                                    if (currentPose != null)
                                    {
                                        dm = DemoMode.POSE;
                                    }
                                    else if (currentAction != null)
                                    {
                                        dm = DemoMode.ACTION;
                                    }
                                    break;
                                case "hide":
                                    dm = DemoMode.NONE;
                                    break;
                                case "incorrect":
                                    if (cpm == CompareMode.POSE)
                                    {
                                        critiquePose = true;
                                    }
                                    else if (cpm == CompareMode.ACTION || cpm == CompareMode.SIMUL_ACTION)
                                    {
                                        EvaluateAction();
                                    }
                                    break;
                                case "again":
                                    if (previousSpeech != null)
                                    {
                                        SpeechRecognized(null, previousSpeech);
                                    }
                                    break;
                                case "exit":
                                    this.Close();
                                    break;
                                case "clear":
                                    ClearAll();
                                    break;
                                case "calibrate":
                                    cpm = CompareMode.CALIBRATE;
                                    break;
                                case "showdemoaction":
                                    actionFrameCount = 0;
                                    cpm = cpm == CompareMode.ACTION ? CompareMode.SIMUL_ACTION : cpm;
                                    break;
                                case "hidedemoaction":
                                    actionFrameCount = 0;
                                    cpm = cpm == CompareMode.SIMUL_ACTION ? CompareMode.ACTION : cpm;
                                    break;
                            }
                            break;
                        case "pose":
                            CheckPose(e.Result.Semantics["pose"].Value.ToString());
                            previousSpeech = e;
                            break;
                        case "action":
                            WatchAction(e.Result.Semantics["action"].Value.ToString());
                            previousSpeech = e;
                            break;
                    }
                }
            }
        }
示例#30
0
 public void SetMode(DemoMode mode)
 {
     object[] objArray1 = new object[] { mode };
     base.method_8("SetMode", objArray1);
 }
 private void ProcessAction()
 {
     currentAction.DetermineBestFrames(actionFrames);
     actionFrames = KinectFrameUtils.GetStartCorrectedFrames(actionFrames, currentAction.bestFrames);
     currentAction.ShiftBestFrames(actionFrames.ElementAt(0).Joints[JointType.HipCenter].Position);
     cpm = CompareMode.SIMUL_ACTION;
     dm = DemoMode.NONE;
     correctBonePen = new Pen(Brushes.Blue, 6);
 }
        private void ClearAll()
        {
            signal.Text = "Ready";
            currentPose = null;
            currentAction = null;

            dm = DemoMode.NONE;
            cpm = CompareMode.NONE;

            watchingAction = false;
            actionStarted = false;
            actionFrames = new List<Skeleton>();
            actionFrameCount = 0;

            StopRecordingSkeleton();
        }
示例#33
0
        /** Draw some helpful gui */
        public void OnGUI () {
            GUILayout.BeginArea (new Rect (5,5,220,Screen.height-10),"","Box");
		
            switch (activeDemo) {
                case DemoMode.ABPath:
                    GUILayout.Label ("Basic path. Finds a path from point A to point B."); break;
                case DemoMode.MultiTargetPath:
                    GUILayout.Label ("Multi Target Path. Finds a path quickly from one point to many others in a single search."); break;
                case DemoMode.RandomPath:
                    GUILayout.Label ("Randomized Path. Finds a path with a specified length in a random direction or biased towards some point when using a larger aim strenggth."); break;
                case DemoMode.FleePath:
                    GUILayout.Label ("Flee Path. Tries to flee from a specified point. Remember to set Flee Strength!"); break;
                case DemoMode.ConstantPath:
                    GUILayout.Label ("Finds all nodes which it costs less than some value to reach."); break;
                case DemoMode.FloodPath:
                    GUILayout.Label ("Searches the whole graph from a specific point. FloodPathTracer can then be used to quickly find a path to that point"); break;
                case DemoMode.FloodPathTracer:
                    GUILayout.Label ("Traces a path to where the FloodPath started. Compare the claculation times for this path with ABPath!\nGreat for TD games"); break;
            }
		
            GUILayout.Space (5);
		
            GUILayout.Label ("Note that the paths are rendered without ANY post-processing applied, so they might look a bit edgy");
		
            GUILayout.Space (5);
		
            GUILayout.Label ("Click anywhere to recalculate the path. Hold Alt to continuously recalculate the path while the mouse is pressed.");
		
            if (activeDemo == DemoMode.ConstantPath || activeDemo == DemoMode.RandomPath || activeDemo == DemoMode.FleePath) {
                GUILayout.Label ("Search Distance ("+searchLength+")");
                searchLength = Mathf.RoundToInt (GUILayout.HorizontalSlider (searchLength,0,100000));
            }
		
            if (activeDemo == DemoMode.RandomPath || activeDemo == DemoMode.FleePath) {
                GUILayout.Label ("Spread ("+spread+")");
                spread = Mathf.RoundToInt (GUILayout.HorizontalSlider (spread,0,40000));
			
                GUILayout.Label ((activeDemo == DemoMode.RandomPath ? "Aim strength" : "Flee strength") + " ("+aimStrength+")");
                aimStrength = GUILayout.HorizontalSlider (aimStrength,0,1);
            }
		
            if (activeDemo == DemoMode.MultiTargetPath) {
                GUILayout.Label ("Hold shift and click to add new target points. Hold ctr and click to remove all target points");
            }
		
            if (GUILayout.Button ("A to B path")) activeDemo = DemoMode.ABPath;
            if (GUILayout.Button ("Multi Target Path")) activeDemo = DemoMode.MultiTargetPath;
            if (GUILayout.Button ("Random Path")) activeDemo = DemoMode.RandomPath;
            if (GUILayout.Button ("Flee path")) activeDemo = DemoMode.FleePath;
            if (GUILayout.Button ("Constant Path")) activeDemo = DemoMode.ConstantPath;
            if (GUILayout.Button ("Flood Path")) activeDemo = DemoMode.FloodPath;
            if (GUILayout.Button ("Flood Path Tracer")) activeDemo = DemoMode.FloodPathTracer;
		
            GUILayout.EndArea ();
        }
示例#34
0
        internal static PlayerServerViewModel BuildViewModelForPlayer(
            ArkServerContext context,
            IConfig config,
            ArkPlayer player,
            DemoMode demoMode,
            bool incProfile,
            bool incProfileDetailed,
            bool incCreatures,
            bool incCreaturesBaseStats,
            bool incCreaturesCloud,
            bool incCrops,
            bool incGenerators,
            bool incKibblesEggs,
            bool incTribeLog)
        {
            var tribe = player.Tribe;
            var vm    = new PlayerServerViewModel
            {
                ClusterKey    = context.Config.Key,
                SteamId       = player.SteamId,
                FakeSteamId   = demoMode?.GetSteamId(player.SteamId),
                CharacterName = demoMode?.GetPlayerName(player.Id) ?? player.CharacterName,
                TribeId       = player.TribeId,
                TribeName     = tribe != null?demoMode?.GetTribeName(tribe.Id) ?? tribe?.Name : null,
                SavedAt       = player.SavedAt
            };

            if (incProfileDetailed)
            {
                vm.Latitude  = player.Location?.Latitude;
                vm.Longitude = player.Location?.Longitude;
                vm.TopoMapX  = player.Location?.TopoMapX;
                vm.TopoMapY  = player.Location?.TopoMapY;

                if (!player.IsExternalPlayer)
                {
                    vm.Gender       = player.Gender.ToString();
                    vm.Level        = player.CharacterLevel;
                    vm.EngramPoints = player.TotalEngramPoints;
                }
            }

            if (incCreatures)
            {
                vm.Creatures.AddRange(BuildCreatureViewModelsForPlayerId(context, config, player.Id, demoMode, incCreaturesBaseStats));
            }
            if (incKibblesEggs)
            {
                vm.KibblesAndEggs = BuildKibblesAndEggsViewModelsForPlayerId(context, player.Id);
            }
            if (incCrops)
            {
                vm.CropPlots = BuildCropPlotViewModelsForPlayerId(context, player.Id);
            }
            if (incGenerators)
            {
                vm.Generators = BuildGeneratorViewModelsForPlayerId(context, player.Id);
            }
            if (incTribeLog)
            {
                vm.TribeLog = BuildTribeLogViewModelsForPlayerId(context, player.Id, config.WebApp.TribeLogLimit, config.WebApp.TribeLogColors);
            }

            return(vm);
        }