示例#1
0
    public void Start()
    {
        ResultsPanel ResultsPanel = GameObject.FindObjectOfType <ResultsPanel>(true);

        if (ResultsPanel != null)
        {
            this.ResultsPanel = ResultsPanel;
        }

        if (this.LevelText != null)
        {
            TextMeshPro levelText = GameObject.FindGameObjectWithTag("LevelText").GetComponent <TextMeshPro>();
            this.LevelText = levelText;
        }
        if (this.LevelText != null)
        {
            this.LevelText.text = "Level " + this.Board.LevelNumber;
        }

        //this is a security when we start directly the level from the editor (scene are not loaded in the same order sometinme)
        if (this.Board == null)
        {
            this.Board = Board.Instance;
        }

        if (this.Board == null)
        {
            Debug.LogError("There is no Board available... Aborting UIPanel init.");
        }
        else
        {
            this.Board.InitUI(this);
        }
    }
        private void AddResultsPanel(string pageName, string pageText, ResultsPanel resultsPanel)
        {
            resultsPagesOpen++;
            var newPage = new TabPage("Results " + resultsPagesOpen + " - " + pageText);

            newPage.Location = new System.Drawing.Point(4, 22);
            newPage.Size     = new System.Drawing.Size(1185, 569);
            newPage.TabIndex = 3;
            newPage.Name     = "resultsTab" + resultsPagesOpen;
            newPage.UseVisualStyleBackColor = true;
            newPage.ImageIndex = 3;

            resultsPanel.Location           = new System.Drawing.Point(3, 3);
            resultsPanel.Name               = "resultsPanel_" + resultsPagesOpen;
            resultsPanel.ResultsDescription = "Results " + resultsPagesOpen + " - " + pageText;
            resultsPanel.Size               = new System.Drawing.Size(1153, 525);
            resultsPanel.Anchor             = ((System.Windows.Forms.AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right)))));

            resultsPanel.TabIndex = 0;

            AddContextMenuToTab(newPage);

            newPage.Controls.Add(resultsPanel);

            this.tabControl1.TabPages.Add(newPage);
            this.tabControl1.SelectedTab = newPage;
        }
示例#3
0
        private void ParameterPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "IsEnabled")
            {
                var parameter = (ParameterInfo)sender;

                ResultsPanel.SetColumnVisibility(parameter.Name, parameter.IsEnabled ? Visibility.Visible : Visibility.Collapsed);
            }

            new ControlChangedCommand(this).Process(this);
        }
示例#4
0
	// Use this for initialization
	void Start () {
		if (hud == null) {
			hud = Instantiate (hudPrefab).GetComponentInChildren<Hud>();
			hud.gameController = this;
		}
		if (resultsPanel == null) {
			resultsPanel = Instantiate (resultsPanelPrefab).GetComponentInChildren<ResultsPanel>();
			resultsPanel.gameController = this;
		}
		StartRound ();
		mainCamera.GetComponent<AudioSource> ().enabled = false;
	}
示例#5
0
 // Start is called before the first frame update
 void Start()
 {
     if (label == null)
     {
         label = GetComponent <UILabel>();
     }
     if (parentPanel == null)
     {
         parentPanel = GetComponentInParent <ResultsPanel>();
     }
     SetText(fieldName);
 }
        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            var results = (List <ResultsContainer>)e.Result;

            foreach (var result in results)
            {
                var resultsPanel = new ResultsPanel();
                resultsPanel.SetResults(result, setups[0].SelectedLocalities);
                AddResultsPanel(result.PageName, result.Name, resultsPanel);
            }

            waitForm.Close();
        }
示例#7
0
 // Start is called before the first frame update
 void Start()
 {
     if (PlayerPrefs.GetInt("Education") == 0 && PlayerPrefs.GetInt("EducationFirst") == 1)
     {
         ResultsPanel.SetActive(true);
         CoinsArttır = 0;
         scoreArttir = 0;
         skorHesap(CoinsArttır);
     }
     else
     {
         enabled = false;
     }
 }
示例#8
0
        private void fetchResults()
        {
            byte[] message = new ASCIIEncoding().GetBytes("133");
            ClientSocket.client.Send(message);
            byte[] response  = new byte[1024];
            int    bytesRead = ClientSocket.client.Receive(response);

            Array.Resize <byte>(ref response, bytesRead);
            if (GlobalHelpers.GetCode(response) == "233")
            {
                var gameResults = MessagePack.MessagePackSerializer.Deserialize <JSON_Classes.GetGameResultsResponse>(GlobalHelpers.GetMsgpack(response));
                switch (gameResults.Status)
                {
                case 0:
                    if (!stopThread)
                    {
                        this.Invoke((MethodInvoker) delegate
                        {
                            for (int i = 1; i < ResultsPanel.RowCount && i < gameResults.Results.Length; i++)
                            {
                                ResultsPanel.GetControlFromPosition(0, i).Text = gameResults.Results[i - 1].Username;
                                ResultsPanel.GetControlFromPosition(1, i).Text = (gameResults.Results[i - 1].CorrectAnswers + gameResults.Results[i - 1].WrongAnswers).ToString();
                                ResultsPanel.GetControlFromPosition(2, i).Text = gameResults.Results[i - 1].CorrectAnswers.ToString();
                                ResultsPanel.GetControlFromPosition(3, i).Text = gameResults.Results[i - 1].WrongAnswers.ToString();
                                ResultsPanel.GetControlFromPosition(4, i).Text = gameResults.Results[i - 1].AverageTime.ToString();
                            }
                            for (int i = ResultsPanel.RowCount; i <= gameResults.Results.Length; i++)
                            {
                                AddItem(gameResults.Results[i - 1].Username, gameResults.Results[i - 1].CorrectAnswers + gameResults.Results[i - 1].WrongAnswers, gameResults.Results[i - 1].CorrectAnswers, gameResults.Results[i - 1].WrongAnswers, gameResults.Results[i - 1].AverageTime);
                            }
                        });
                    }
                    break;

                default:
                    if (!stopThread)
                    {
                        this.Invoke((MethodInvoker) delegate
                        {
                            MessageBox.Show("There Was An Error Getting The Game Results!");
                            this.Close();
                            DialogResult = DialogResult.Abort;
                        });
                    }
                    break;
                }
            }
        }
示例#9
0
    private void Update()
    {
        float total = _simulator.RedCirclesCount + _simulator.BlueCirclesCount;
        float val   = total > 0 ? _simulator.RedCirclesCount / total : 0.5f;

        _mainUI.SetAdvantageSliderValue(val);
        if (_isGameComplete)
        {
            _mainUI.gameObject.SetActive(false);
            _view.gameObject.SetActive(false);
            ResultsPanel resultsPanel = _uiFactory.CreateResultsPanel();
            double       elapsedTime  = _simulator.SimulationRateInSeconds * _simulator.IterationsCount;
            resultsPanel.Setup(TimeSpan.FromSeconds(elapsedTime), _simulator.RedCirclesCount, _simulator.BlueCirclesCount, PlayAgainClickedHandler);
            _isGameComplete = false;
        }
    }
示例#10
0
        /// <summary>
        /// Shows the panels and populates with data from the stored strategies
        /// </summary>
        /// <param name="driverToShow">The driver whose data is being displayed</param>
        void ShowStintPanels(int driverToShow)
        {
            int        stint = 0;
            StintPanel tempPanel;

            Strategy strategyToShow = strategyViewerData.GetStrategy(driverToShow);

            foreach (Stint s in strategyToShow.Stints)
            {
                tempPanel          = new StintPanel(stint, Data.Drivers[driverToShow], strategyToShow);
                tempPanel.Location = new Point(leftBorder, topBorder * (1 + stint) + (80 * stint));
                StintPanels.Add(tempPanel);
                this.Controls.Add(tempPanel);
                stint++;
            }

            Results          = new ResultsPanel(driverToShow, strategyToShow);
            Results.Location = new Point(leftBorder, topBorder * (1 + StintPanels.Count) + (80 * StintPanels.Count));
            this.Controls.Add(Results);
        }
示例#11
0
        /// <summary>
        /// Executes the document.
        /// </summary>
        /// <param name="document">The document to execute.</param>
        /// <param name="resultsPanel">The results panel to send the result to.</param>
        private async void ExecuteDocument([NotNull] IDocument document, [NotNull] ResultsPanel resultsPanel)
        {
            this.statusbar.GetText(out var text);

            try
            {
                this.isScriptRunning = true;

                this.statusbar.SetText($"Running {Path.GetFileName(document.Filename)}...");

                resultsPanel.Result = await document.ExecuteAsync();
            }
            finally
            {
                this.isScriptRunning = false;

                this.statusbar.SetText(text);

                this.shell.UpdateCommandUI(VSConstants.S_FALSE);
            }
        }
示例#12
0
        private IEnumerable <Strategy> CreateStrategies()
        {
            EmulationService.EmulationConnector.AddInfoLog(LocalizedStrings.Str3581);

            var parameters = _parameters.Where(p => p.IsEnabled).ToArray();

            parameters.ForEach(pv => pv.Value = pv.From);

            do
            {
                var strategy = CreateStrategy(parameters);
                strategy.Name = _strategyName + LocalizedStrings.Str3582 + _strategies.Count;

                _strategies.Add(strategy.Strategy, strategy);
                ResultsPanel.AddStrategies(new[] { strategy.Strategy });

                yield return(strategy);
            }while (GetNext(parameters, parameters.Length - 1));

            EmulationService.EmulationConnector.AddInfoLog(LocalizedStrings.Str3583);
        }
示例#13
0
    void Awake()
    {
        if (_mHandler == null)
        {
            _mHandler = this;
        }
        else
        {
            Destroy(gameObject);
        }

        matchUI = GameObject.Find("Canvas/MatchUI");
        timerUI = matchUI.transform.Find("Timer").GetComponent <Timer>();
        sb1     = matchUI.transform.Find("P1_Score").GetComponent <Scoreboard>();
        sb2     = matchUI.transform.Find("P2_Score").GetComponent <Scoreboard>();

        resultsUI      = GameObject.Find("Canvas/ResultsUI");
        resultsPanelUI = resultsUI.transform.Find("Panel").GetComponent <ResultsPanel>();

        arena        = GameObject.Find("Arena");
        arenaBuilder = arena.GetComponent <ArenaBuilder>();
    }
示例#14
0
        protected void checkedCategories_DataBound(object sender, EventArgs e)
        {
            ListItemCollection checkedCats = checkedCategories.Items;
            CheckBox           showInt     = ResultsPanel.FindControl("showIntStakeholders") as CheckBox;

            /* Remove last (special) and the first (general) categories */

            if (checkedCats.Count > 6) // check that there is the 'special' category (= 'Other' selected in start)
            {
                checkedCats.RemoveAt(6);
                showInt.Visible = true;
            }
            else
            {
                showInt.Visible = false;
            }
            checkedCats.RemoveAt(0);

            for (int i = 0; i < checkedCats.Count; i++)
            {
                checkedCats[i].Selected = true;
                checkedCats[i].Attributes.Add("Name", "checkedCategories");
            }
        }
示例#15
0
        ///*Shows the sql being executed  */
        //protected void SqlDemographics_Inserting(object sender, SqlDataSourceCommandEventArgs e)
        //{
        //    SqlParameterCollection myCollection = (SqlParameterCollection)e.Command.Parameters;

        //    IEnumerator ie = myCollection.GetEnumerator();
        //    string strSQL = string.Empty;
        //    while ((ie.MoveNext()))
        //    {
        //        SqlParameter param = (SqlParameter)ie.Current;
        //        string strValue = string.Empty;
        //        if (param.Value == null)
        //            strValue = "NULL";
        //        else
        //            strValue = param.Value.ToString();

        //        strSQL += param.ParameterName.ToString() + "=" + strValue + "<BR />";
        //    }

        //    Response.Write(strSQL.ToString());
        //}


        protected void FinishButton_Click(object sender, EventArgs e)
        {
            string[] stringSeparators = new string[] { "--" };
            string[] questions        = HiddenQuestions.Value.Split(stringSeparators, System.StringSplitOptions.None);
            string[] answers          = HiddenAnswers.Value.Split(stringSeparators, System.StringSplitOptions.None);
            string[] ratings          = HiddenRatings.Value.Split(stringSeparators, System.StringSplitOptions.None);
            string   Culture          = System.Threading.Thread.CurrentThread.CurrentCulture.Name;

            DropDownList LanguageSelector = (DropDownList)CategoriesDataList.FindControl("LanguageSelector");

            targetCountry = LanguageSelector.SelectedValue;

            string timestamp       = GetTimestamp(System.DateTime.Now);
            string datetime        = DateTime.Now.ToString("yyyy-MM-dd H:mm:ss zzz");
            string anonymousUserId = "";

            for (int i = 0; i < questions.Length - 1; i++)
            {
                SqlCategories.InsertParameters["ModuleId"].DefaultValue        = this.ModuleId.ToString();
                SqlCategories.InsertParameters["QuestionnaireID"].DefaultValue = timestamp;
                SqlCategories.InsertParameters["QuestionID"].DefaultValue      = questions[i];
                SqlCategories.InsertParameters["Locale"].DefaultValue          = Culture;
                SqlCategories.InsertParameters["TargetedCountry"].DefaultValue = targetCountry;
                SqlCategories.InsertParameters["AnswerID"].DefaultValue        = answers[i];
                SqlCategories.InsertParameters["AnsweredOnDate"].DefaultValue  = datetime;

                if (Request.IsAuthenticated)
                {
                    SqlCategories.InsertParameters["AnsweredByUser"].DefaultValue = this.UserId.ToString();
                    SqlCategories.InsertParameters["AnonymousGuid"].DefaultValue  = "";
                }
                else
                {
                    HttpCookie pbpCookie = Request.Cookies.Get("puzzledByPolicy");
                    if (pbpCookie != null)
                    {
                        anonymousUserId = pbpCookie["anonymousId"];
                    }
                    else
                    {
                        anonymousUserId = SetCookie("puzzledByPolicy").ToString();
                    }
                    SqlCategories.InsertParameters["AnsweredByUser"].DefaultValue = "-1";
                    SqlCategories.InsertParameters["AnonymousGuid"].DefaultValue  = anonymousUserId;
                }
                // IP  = Request.UserHostAddress()
                SqlCategories.InsertParameters["Rating"].DefaultValue = ratings[i];
                try
                {
                    SqlCategories.Insert();
                }
                catch (FormatException ex)
                {
                    Response.Redirect("http://join.puzzledbypolicy.eu/");
                }
            }

            LinkButton sendingBtn = (LinkButton)sender;

            /* If SubmitDemogBtn has been clicked, we also save the demographics
             * answers
             */
            if (sendingBtn.ID.Equals("SubmitDemogBtn"))
            {
                if (Request.IsAuthenticated)
                {
                    SqlDemographics.InsertParameters["userID"].DefaultValue = this.UserId.ToString();
                }
                else
                {
                    SqlDemographics.InsertParameters["userID"].DefaultValue = anonymousUserId;
                }

                SqlDemographics.InsertParameters["QuestionnaireID"].DefaultValue = timestamp;

                if (!DEM_birthplace.Value.Equals(""))
                {
                    SqlDemographics.InsertParameters["Question1"].DefaultValue = DEM_birthplace.Value;
                }
                if (!DEM_livingplace.Value.Equals(""))
                {
                    SqlDemographics.InsertParameters["Question2"].DefaultValue = DEM_livingplace.Value;
                }
                if (!DEM_age.Value.Equals(""))
                {
                    SqlDemographics.InsertParameters["Question3"].DefaultValue = DEM_age.Value;
                }
                if (!DEM_sex.Value.Equals(""))
                {
                    SqlDemographics.InsertParameters["Question4"].DefaultValue = DEM_sex.Value;
                }
                if (!DEM_education.Value.Equals(""))
                {
                    SqlDemographics.InsertParameters["Question5"].DefaultValue = DEM_education.Value;
                }
                if (!DEM_profession.Value.Equals(""))
                {
                    SqlDemographics.InsertParameters["Question6"].DefaultValue = DEM_profession.Value;
                }
                if (!DEM_municipality.Value.Equals(""))
                {
                    SqlDemographics.InsertParameters["Question7"].DefaultValue = DEM_municipality.Value;
                }

                try
                {
                    SqlDemographics.Insert();
                }
                catch (FormatException ex)
                {
                    Response.Write(ex.Message);
                    return;
                    //Response.Redirect("http://join.puzzledbypolicy.eu/");
                }
            }

            LinkButton save     = (LinkButton)ResultsPanel.FindControl("SaveButton");
            LinkButton clear    = (LinkButton)ResultsPanel.FindControl("ClearButton");
            HyperLink  feedback = (HyperLink)ResultsPanel.FindControl("FeedbackButton");

            save.CssClass  = "saveBtn sBtn_" + Culture;
            clear.CssClass = "clearBtn clBtn_" + Culture;

            feedback.CssClass    = "feedbackBtn fBtn_" + Culture;
            feedback.NavigateUrl = ConfigurationManager.AppSettings["DomainName"] + "/" + Culture + "/feedback.aspx";
            feedback.Target      = "_blank";

            /*We set the hidden field to false so as not to popup the demographics
             * unless we reload the profiler
             */
            //showDemographicsPopup.Value = "false";


            /* Link with u-Debate.
             *
             * Completely agree/disagree: 3 points
             * Tend to agree/disagree :   1 point
             * Neutral/No opinion:       0 points
             *
             * Multiply by Ratings  1 -> 1
             *                      2 -> 2
             *                      3 -> 3
             *
             * Category   Questions
             *    1         2  - 4
             *    2         5  - 6
             *    3         7  - 8
             *    4         9  - 11
             *    5         12 - 14
             */

            int[] weights  = new int[13]; // 13 questions
            int[] extremes = new int[5];
            /* We skip the first(general) and last(specific) questions (plus the last empty cell) */
            for (int an = 1; an <= answers.Length - 3; an++)
            {
                if (answers[an] == "1" || answers[an] == "5")
                {
                    weights[an - 1] = 3;
                }
                else if (answers[an] == "2" || answers[an] == "4")
                {
                    weights[an - 1] = 1;
                }
                else
                {
                    weights[an - 1] = 0;
                }
                if (Convert.ToInt32(ratings[an]) > 0)
                {
                    weights[an - 1] *= Convert.ToInt32(ratings[an]);
                }
            }
            extremes[0] = weights[0] + weights[1] + weights[2];    // employment
            extremes[1] = weights[3] + weights[4];                 //studying
            extremes[2] = weights[5] + weights[6];                 //family reunification
            extremes[3] = weights[7] + weights[8] + weights[9];    //Long-term resident immigrants and citizenship
            extremes[4] = weights[10] + weights[11] + weights[12]; //Irregular migration, re-admission and return

            int topExtreme = 0;

            for (int i = 0; i < 5; i++)
            {
                if (extremes[i] > extremes[topExtreme])
                {
                    topExtreme = i;
                }
            }
            string threadUrl = String.Empty;

            string uDebateText = String.Empty;

            /* Check if the user had selected no answer/neutral in all questions
             * and just link to the home debate page if this is true
             */
            if (extremes[topExtreme] > 0)
            {
                uDebateText = Localization.GetString("uDebateLink" + (topExtreme + 1) + ".Text", LocalResourceFile);
            }
            else
            {
                topExtreme = -1; // no answer so we go to the default threadurl
            }
            if (Culture == "en-GB")
            {
                switch (topExtreme)
                {
                case 0: threadUrl = fetchThreadUrl("59", Culture); break;

                case 1: threadUrl = fetchThreadUrl("60", Culture); break;

                case 2: threadUrl = fetchThreadUrl("61", Culture); break;

                case 3: threadUrl = fetchThreadUrl("62", Culture); break;

                case 4: threadUrl = fetchThreadUrl("63", Culture); break;

                default: threadUrl = "http://join.puzzledbypolicy.eu/en-GB/uDebate.aspx"; break;
                }
            }
            else
            {
                switch (targetCountry)
                {
                case "el-GR": switch (topExtreme)
                    {
                    case 0: threadUrl = fetchThreadUrl("65", Culture); break;

                    case 1: threadUrl = fetchThreadUrl("76", Culture); break;

                    case 2: threadUrl = fetchThreadUrl("77", Culture); break;

                    case 3: threadUrl = fetchThreadUrl("69", Culture); break;

                    case 4: threadUrl = fetchThreadUrl("71", Culture); break;

                    default: threadUrl = "http://join.puzzledbypolicy.eu/el-GR/uDebate.aspx"; break;
                    }
                    break;

                case "es-ES": switch (topExtreme)
                    {
                    case 0: threadUrl = fetchThreadUrl("35", Culture); break;

                    case 1: threadUrl = fetchThreadUrl("36", Culture); break;

                    case 2: threadUrl = fetchThreadUrl("37", Culture); break;

                    case 3: threadUrl = fetchThreadUrl("38", Culture); break;

                    case 4: threadUrl = fetchThreadUrl("39", Culture); break;

                    default: threadUrl = "http://join.puzzledbypolicy.eu/es-ES/uDebate.aspx"; break;
                    }
                    break;

                case "it-IT": switch (topExtreme)
                    {
                    case 0: threadUrl = fetchThreadUrl("26", Culture); break;

                    case 1: threadUrl = fetchThreadUrl("48", Culture); break;

                    case 2: threadUrl = fetchThreadUrl("49", Culture); break;

                    case 3: threadUrl = fetchThreadUrl("50", Culture); break;

                    case 4: threadUrl = fetchThreadUrl("51", Culture); break;

                    default: threadUrl = "http://join.puzzledbypolicy.eu/it-IT/uDebate.aspx"; break;
                    }
                    break;

                case "hu-HU": switch (topExtreme)
                    {
                    case 0: threadUrl = fetchThreadUrl("42", Culture); break;

                    case 1: threadUrl = fetchThreadUrl("72", Culture); break;

                    case 2: threadUrl = fetchThreadUrl("73", Culture); break;

                    case 3: threadUrl = fetchThreadUrl("74", Culture); break;

                    case 4: threadUrl = fetchThreadUrl("75", Culture); break;

                    default: threadUrl = "http://join.puzzledbypolicy.eu/hu-HU/uDebate.aspx"; break;
                    }
                    break;

                default: switch (topExtreme)
                    {
                    case 0: threadUrl = fetchThreadUrl("59", Culture); break;

                    case 1: threadUrl = fetchThreadUrl("60", Culture); break;

                    case 2: threadUrl = fetchThreadUrl("61", Culture); break;

                    case 3: threadUrl = fetchThreadUrl("62", Culture); break;

                    case 4: threadUrl = fetchThreadUrl("63", Culture); break;

                    default: threadUrl = "http://join.puzzledbypolicy.eu/en-GB/uDebate.aspx"; break;
                    }
                    break;
                }
            }

            if (!Page.ClientScript.IsClientScriptBlockRegistered("exampleScript"))
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "exampleScript", @"
                <script language = 'javascript'>
                  jQuery(document).ready(function() {
                       jQuery('#uDebateProposal').html(""<h3>"
                                                        + Localization.GetString("uDebateHeader.Text", LocalResourceFile) + "</h3>"
                                                        + uDebateText + "<p align='center'> <a href='" + threadUrl
                                                        + @"' target='_blank'>"
                                                        + Localization.GetString("TakePart", LocalResourceFile) + @"</a></p>"");
                         jQuery('.trigger').show();
                         jQuery('.trigger').addClass('active'); 
                         jQuery('.uDebateLinkDiv').show();                         
                  });
                </script>
                ");
            }

            //jQuery('#uDebateLinkDiv').animate({'bottom': '+=213px'}, 4000);

            //String host = ConfigurationManager.AppSettings["hostServer"];
            //String host = "http://join.puzzledbypolicy.eu";
            String host = ConfigurationManager.AppSettings["DomainName"];

            String resultsService = host +
                                    "/PProfilerResults/BarChartData.aspx?questions=" +
                                    HiddenQuestions.Value + "&answers=" +
                                    HiddenAnswers.Value + "&ratings=" +
                                    HiddenRatings.Value + "&locale=" + targetCountry;

            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(new StringReader(GetMessage(resultsService)));

            XmlNodeList xmlnodelist = xmlDoc.GetElementsByTagName("graph");

            if (xmlnodelist.Count > 0)
            {
                XmlNode xmlnode = xmlnodelist.Item(0);

                XmlNodeList valueslist = xmlnode.ChildNodes;

                foreach (XmlNode value in valueslist)
                {
                    ProfilerResults += value.Attributes["title"].Value + ": ";
                    ProfilerResults += value.InnerText + "% ";
                }
            }
        }
示例#16
0
        public Rvt.Result OnStartup(UIControlledApplication application)
        {
//         Schema = null;
            curApp        = this;
            uiApplication = application;
            ExtEvents     = new ExternalEventsContainer();

            try
            {
                // Add Panel to Add_Ins tab
                RibbonPanel panel = application.CreateRibbonPanel("BIM Bot");

                // Add Button to the BIM Bot panel
                PushButton pushButton = panel.AddItem(new PushButtonData("BIMBot", "About BIM Bot", Assembly.GetExecutingAssembly().Location, "Bimbot.AboutAddin")) as PushButton;
                SetImage(pushButton, Properties.Resources.BIMserver_BimBot);

                PluginToggleButtonResults = panel.AddItem(new PushButtonData("ToggleResults", "Hide Results", Assembly.GetExecutingAssembly().Location, "Bimbot.ToggleResults"));
                SetImage(PluginToggleButtonResults as PushButton, Properties.Resources.BIMserver_BimBot);
                PluginToggleButtonResults.ToolTip         = "Toggles the window results";
                PluginToggleButtonResults.LongDescription = "Showing or hiding the last responses of the BIM Bot services performed";

                PluginToggleButtonServices = panel.AddItem(new PushButtonData("ToggleServices", "Hide Services", Assembly.GetExecutingAssembly().Location, "Bimbot.ToggleServices"));
                SetImage(PluginToggleButtonServices as PushButton, Properties.Resources.BIMserver_BimBot);
                PluginToggleButtonServices.ToolTip         = "Toggles the window services";
                PluginToggleButtonServices.LongDescription = "Showing or hiding the BIM Bot services assigned to this Revit project";



                // Create The DockablePanels for showing the service results and services
                DockableResultPanel = new ResultsPanel(ExtEvents);
                application.RegisterDockablePane(OutputPaneId, "BIM Bot results", DockableResultPanel as IDockablePaneProvider);

                DockableServicesPanel = new ServicesPanel(ExtEvents);
                application.RegisterDockablePane(ServicePaneId, "BIM Bot services", DockableServicesPanel as IDockablePaneProvider);

                // Get the listbutton that manages the dockable views
                adWin.RibbonListButton listBut = (adWin.RibbonListButton)adWin.ComponentManager.Ribbon.Tabs.Where(t => t.Id.Equals("View")).SelectMany(t => t.Panels).
                                                 Where(p => p.Source.Id.Equals("manageviews_shr")).SelectMany(p => p.Source.Items).
                                                 Where(b => b.Id.Equals("HID_APPLICATION_ELEMENTS_RibbonListButton")).First();

                // Add the bimbot result view activation button
                ViewToggleButtonResults      = new adWin.RibbonToggleButton();
                ViewToggleButtonResults.Name = "Bimbot output";
//            ViewToggleButtonResults.Id = "ID_RESULT_BUTTON";
                ViewToggleButtonResults.IsEnabled        = false;
                ViewToggleButtonResults.ToolTip          = "Show the Bimbots output panel";
                ViewToggleButtonResults.PropertyChanged += new PropertyChangedEventHandler(toggleButtonResult_PropertyChanged);
                listBut.Items.Insert(listBut.Items.Count - 3, ViewToggleButtonResults);

                // Add the bimbot service view activation button
                ViewToggleButtonServices      = new adWin.RibbonToggleButton();
                ViewToggleButtonServices.Name = "Bimbot services";
//            ViewToggleButtonServices.Id = "ID_SERVICE_BUTTON";
                ViewToggleButtonServices.IsEnabled        = false;
                ViewToggleButtonServices.ToolTip          = "Show the Bimbots services panel";
                ViewToggleButtonServices.PropertyChanged += new PropertyChangedEventHandler(toggleButtonService_PropertyChanged);
                listBut.Items.Insert(listBut.Items.Count - 3, ViewToggleButtonServices);

                // Set the event handler to handle te view activation buttons
//            adWin.ComponentManager.UIElementActivated += new EventHandler<adWin.UIElementActivatedEventArgs>(ComponentManager_UIElementActivated);


                // Register events
                application.DockableFrameVisibilityChanged        += new EventHandler <DockableFrameVisibilityChangedEventArgs>(Application_DockableFrameVisibilityChanged);
                application.ControlledApplication.DocumentOpened  += new EventHandler <DocumentOpenedEventArgs>(Application_DocumentOpened);
                application.ControlledApplication.DocumentClosing += new EventHandler <DocumentClosingEventArgs>(Application_DocumentClosing);
                application.ViewActivated += new EventHandler <ViewActivatedEventArgs>(Application_ViewActivated);
            }
            catch (Exception)
            {
                return(Autodesk.Revit.UI.Result.Failed);
            }

            // Add view buttons for the Dockable panels in Revits UI
            return(Rvt.Result.Succeeded);
        }
示例#17
0
 private void resultsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     ResultsPanel.BringToFront();
 }
示例#18
0
 private void EmulationServiceOnProgressChanged(StrategyContainer strategy, int value)
 {
     ResultsPanel.UpdateProgress(strategy.Strategy, value);
 }
示例#19
0
        public OptimizatorContent()
        {
            InitializeComponent();

            ParametersGrid.ItemsSource = _parameters;

            var isInitialization = false;

            var cmdSvc = ConfigManager.GetService <IStudioCommandService>();

            cmdSvc.Register <StartStrategyCommand>(this, true,
                                                   cmd =>
            {
                var error = Strategy.CheckCanStart(false);
                if (error != null)
                {
                    new MessageBoxBuilder()
                    .Owner(this)
                    .Caption(LocalizedStrings.Str3577)
                    .Text(error)
                    .Warning()
                    .Show();

                    return;
                }

                try
                {
                    _parameters.ForEach(p => p.Check());
                }
                catch (Exception excp)
                {
                    new MessageBoxBuilder()
                    .Owner(this)
                    .Caption(LocalizedStrings.Str3577)
                    .Text(excp.Message)
                    .Warning()
                    .Show();

                    return;
                }

                isInitialization = true;

                _strategies.Clear();
                ResultsPanel.Clear();

                Task.Factory.StartNew(() =>
                {
                    EmulationService.Strategies = CreateStrategies().ToEx(GetIterationCount());
                    EmulationService.StartEmulation();

                    isInitialization = false;
                });
            },
                                                   cmd => EmulationService != null && EmulationService.CanStart && !isInitialization);

            cmdSvc.Register <StopStrategyCommand>(this, true,
                                                  cmd => EmulationService.StopEmulation(),
                                                  cmd => EmulationService != null && EmulationService.CanStop);

            ResultsPanel.AddContextMenuItem(new Separator());
            ResultsPanel.AddContextMenuItem(new MenuItem {
                Header = LocalizedStrings.Str3578, Command = OpenStrategyCommand, CommandTarget = this
            });
            ResultsPanel.AddContextMenuItem(new MenuItem {
                Header = LocalizedStrings.Str3579, Command = SetParametersCommand, CommandTarget = this
            });
        }