Exemplo n.º 1
0
        /// <summary>
        /// Synchronously executes the <see cref="T:Microsoft.AspNetCore.Razor.TagHelpers.TagHelper" /> with the given <paramref name="context" /> and
        /// <paramref name="output" />.
        /// </summary>
        /// <param name="context">Contains information associated with the current HTML tag.</param>
        /// <param name="output">A stateful HTML element used to generate an HTML tag.</param>
        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            var currentPage = Path.GetFileNameWithoutExtension(ViewContext.ActionDescriptor.DisplayName);
            var activePages = ActivePage.Split(ActivePageDelimiter, StringSplitOptions.RemoveEmptyEntries);

            if (activePages.All(activePage => !string.Equals(currentPage, activePage, StringComparison.OrdinalIgnoreCase)))
            {
                return;
            }

            var classValue = new StringBuilder();

            if (context.AllAttributes.TryGetAttribute(ClassAttributeName, out var classAttribute))
            {
                classValue.Append(classAttribute.Value.ToString());
            }

            if (classValue.Length > 0)
            {
                classValue.Append(ClassDelimiter);
            }

            classValue.Append(ActiveClass);
            output.Attributes.SetAttribute(ClassAttributeName, classValue.ToString());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Try to singout
        /// </summary>
        /// <returns></returns>
        public OperationState tryToSingout()
        {
            OperationState state = OperationState.CONTINUE;

            if (ActivePage != null && ActivePage.IsModify)
            {
                state = ActivePage.TryToSaveBeforeClose();
                if (state == OperationState.STOP)
                {
                    return(OperationState.STOP);
                }
                state = closeApplication();
                applicationIsClosed = state == OperationState.CONTINUE ? true : false;
                return(state);
            }
            ApplicationManager.Instance.MainWindow.MenuBar.GetFileMenu().EnableSaveMenu(false);

            ApplicationManager.Instance.User = null;
            ApplicationManager.Instance.MainWindow.ConnectedUserPanel.Visibility = Visibility.Collapsed;
            ApplicationManagerBuilder builder = new ApplicationManagerBuilder();

            builder.loadPlugins();
            tryToLogin();
            ApplicationManager.Instance.MainWindow.displayMenuBar(null);

            return(state);
        }
        public static List <ActivePage> ConvertToActivePage(DataTable dt)
        {
            List <ActivePage> list = new List <ActivePage>();

            try
            {
                if (dt != null)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        var item = new ActivePage()
                        {
                            PKID      = Convert.ToInt32(row["PKID"] == DBNull.Value ? 0 : row["PKID"]),
                            Title     = row["Title"]?.ToString(),
                            HashKey   = row["HashKey"]?.ToString(),
                            RuleDesc  = row["RuleDesc"]?.ToString(),
                            StartDate = Convert.ToDateTime(row["StartDate"] == DBNull.Value ? DateTime.MinValue : row["StartDate"]),
                            EndDate   = Convert.ToDateTime(row["EndDate"] == DBNull.Value ? DateTime.MaxValue : row["EndDate"])
                        };
                        list.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(list);
        }
Exemplo n.º 4
0
 internal void Exit()
 {
     if (ActivePage != null)
     {
         ActivePage.Hide();
     }
 }
Exemplo n.º 5
0
        private void UpdateControls(bool enabled)
        {
            this.phPages.Enabled = enabled;
            this.btnBack.Enabled = enabled && this.buttonPrevious.Enabled;
            this.btnNext.Enabled = enabled && this.buttonNext.Enabled;

            if (ActivePage != null)
            {
                ActivePage.UpdateControls(enabled, false);
            }
        }
Exemplo n.º 6
0
        private void SaveDocument()
        {
            if (ActivePage != null)
            {
                ActivePage.Text = editor.Text;
                ActivePage.Save();
            }

            Repository.Add();
            Repository.Commit();
            Repository.Push();
            Repository.Pull();
            // TODO: Check time stamp on active document
            Repository.Update();
        }
Exemplo n.º 7
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {
            AppBackup.initStorage();
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings;
                ActivePage recentlyActive = (ActivePage)localSettings.Values["currentPage"];
                System.Diagnostics.Debug.WriteLine("Active Page:" + recentlyActive);
                if (recentlyActive == ActivePage.historyPage)
                {
                    rootFrame.Navigate(typeof(HistoryPage));
                }

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    await AppBackup.loadAppState();
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
Exemplo n.º 8
0
        private void MManagerOnActiveContentChanged(object _sender, EventArgs _eventArgs)
        {
            PropertyChanged.Cast(this, () => ActivePage);
            PropertyChanged.Cast(this, () => ForwardCommand);
            PropertyChanged.Cast(this, () => BackCommand);
            PropertyChanged.Cast(this, () => CloseCommand);
            PropertyChanged.Cast(this, () => RevertCommand);
            PropertyChanged.Cast(this, () => UndoCommand);
            PropertyChanged.Cast(this, () => RedoCommand);
            PropertyChanged.Cast(this, () => SaveCommand);

            if (ActivePage != null)
            {
                ActivePage.Selected();
            }
        }
Exemplo n.º 9
0
        public bool SetActive(Page pg)
        {
            if (pg != null && pg.Container == this)
            {
                if (ActivePage != null)
                {
                    ActivePage.Hide();
                }

                ActivePage = pg;
                ActivePage.Show();

                return(true);
            }

            return(false);
        }
Exemplo n.º 10
0
        public override void OnButtonClick(int buttonID)
        {
            if (buttonID == 0)
            {
                _currentPage--;

                if (_currentPage <= 1)
                {
                    _currentPage          = 1;
                    _buttonPrev.IsEnabled = false;
                    _buttonNext.IsEnabled = true;
                    _buttonPrev.IsVisible = false;
                    _buttonNext.IsVisible = true;
                }

                ChangePage(_currentPage);
                _currentPageLabel.Text = ActivePage.ToString();
                _currentPageLabel.X    = Width / 2 - _currentPageLabel.Width / 2;
            }
            else if (buttonID == 1)
            {
                _currentPage++;

                if (_currentPage >= _pagesCount)
                {
                    _currentPage          = _pagesCount;
                    _buttonPrev.IsEnabled = true;
                    _buttonNext.IsEnabled = false;
                    _buttonPrev.IsVisible = true;
                    _buttonNext.IsVisible = false;
                }

                ChangePage(_currentPage);
                _currentPageLabel.Text = ActivePage.ToString();
                _currentPageLabel.X    = Width / 2 - _currentPageLabel.Width / 2;
            }
            else if (buttonID == 2)
            {
                GameActions.Print(LanguageManager.Current.UI_GridLoot_ChooseContainer);
                TargetManager.SetTargeting(CursorTarget.SetGrabBag, 0, TargetType.Neutral);
            }
            else
            {
                base.OnButtonClick(buttonID);
            }
        }
Exemplo n.º 11
0
        public override void OnButtonClick(int buttonID)
        {
            if (buttonID == 0)
            {
                _currentPage--;

                if (_currentPage <= 1)
                {
                    _currentPage          = 1;
                    _buttonPrev.IsVisible = false;
                }

                _buttonNext.IsVisible = true;
                ChangePage(_currentPage);

                _currentPageLabel.Text = ActivePage.ToString();
                _currentPageLabel.X    = Width / 2 - _currentPageLabel.Width / 2;
            }
            else if (buttonID == 1)
            {
                _currentPage++;

                if (_currentPage >= _pagesCount)
                {
                    _currentPage          = _pagesCount;
                    _buttonNext.IsVisible = false;
                }

                _buttonPrev.IsVisible = true;

                ChangePage(_currentPage);

                _currentPageLabel.Text = ActivePage.ToString();
                _currentPageLabel.X    = Width / 2 - _currentPageLabel.Width / 2;
            }
            else if (buttonID == 2)
            {
                GameActions.Print(ResGumps.TargetContainerToGrabItemsInto);
                TargetManager.SetTargeting(CursorTarget.SetGrabBag, 0, TargetType.Neutral);
            }
            else
            {
                base.OnButtonClick(buttonID);
            }
        }
Exemplo n.º 12
0
        public void ChangeActivePage(ActivePage newPage)
        {
            m_activePage = newPage;
            switch (m_activePage)
            {
            case ActivePage.Category:
                OpenPageCategory();
                break;

            case ActivePage.ARViewer:
                OpenPageARViewer();
                break;

            default:
                break;
            }
            Debug.Log("Change active page to " + newPage.ToString());
        }
        ActivePage active; //Активная страница
        #endregion

        /// <summary>
        /// Конструктор главной модели представлений
        /// </summary>
        public MainViewModel()
        {
            active = new ActivePage();
            if (Properties.Settings.Default.First_Start)
            {
                Active = new RegView()
                {
                    DataContext = new RegViewModel(active)
                }
            }
            ;
            else
            {
                Active = new AuthView()
                {
                    DataContext = new AuthViewModel()
                }
            };
        }
Exemplo n.º 14
0
        /// <summary>
        /// Procède à la fermeture de la page.
        /// </summary>
        /// <param name="page"></param>
        /// <returns></returns>
        public void OnClosePage(object param)
        {
            Controllable page = (Controllable)param;

            if (page == null)
            {
                return;
            }
            try
            {
                if (OpenedPages.Contains(page))
                {
                    OpenedPages.Remove(page);
                }
                if (ActivePage != null && ActivePage.Equals(page))
                {
                    ActivePage = null;
                    FunctionalityType functionalityType = page.NavigationToken != null ? page.NavigationToken.FunctionalityType : FunctionalityType.MAIN_FONCTIONALITY;
                    bool isSubFonctionality             = functionalityType == FunctionalityType.SUB_FONCTIONALITY;
                    if (isSubFonctionality && page.ParentController != null)
                    {
                        openPage(page.ParentController);
                    }
                    else if (OpenedPages.Count > 0)
                    {
                        openPage(OpenedPages[OpenedPages.Count - 1]);
                        return;
                    }
                    else
                    {
                        openHomePage();
                    }
                }
            }
            catch (Exception e)
            {
                MessageDisplayer.DisplayError("Error", e.Message);
                return;
            }
            return;
        }
Exemplo n.º 15
0
        /// <summary>
        /// Try to close
        /// </summary>
        /// <returns></returns>
        public OperationState tryToCloseApplication()
        {
            if (applicationIsClosed)
            {
                return(OperationState.CONTINUE);
            }
            OperationState state = OperationState.CONTINUE;

            if (ActivePage != null && ActivePage.IsModify)
            {
                state = ActivePage.TryToSaveBeforeClose();
                if (state == OperationState.STOP)
                {
                    return(OperationState.STOP);
                }
                state = closeApplication();
                applicationIsClosed = state == OperationState.CONTINUE ? true : false;
                return(state);
            }

            var response = MessageDisplayer.DisplayYesNoQuestion("Exiting...", "Do you really want to exit B-Cephal ?");

            if (response == MessageBoxResult.No)
            {
                state = OperationState.STOP;
            }
            else
            {
                state = closeApplication();
                applicationIsClosed = state == OperationState.CONTINUE ? true : false;
            }
            if (ApplicationManager.Instance.MainWindow.MenuBar != null)
            {
                ApplicationManager.Instance.MainWindow.MenuBar.GetFileMenu().EnableSaveMenu(false);
            }
            return(state);
        }
Exemplo n.º 16
0
 private void Dialog_Loaded(object sender, System.Windows.RoutedEventArgs e)
 {
     pageNo = 0;
     ShowPage();
 }
Exemplo n.º 17
0
        public void ChangeActivePage(string newPage)
        {
            ActivePage parsed_enum = (ActivePage)System.Enum.Parse(typeof(ActivePage), newPage);

            ChangeActivePage(parsed_enum);
        }
Exemplo n.º 18
0
 private void DecreaseZoomLevel(object x)
 {
     ActivePage.SetZoomLevel(ActivePage.ZoomLevel - 0.25);
 }
Exemplo n.º 19
0
        private string messageError; //Сообщение об ошибке
        #endregion

        #region Constructors
        /// <summary>
        /// Конструктор для RegViewModel
        /// </summary>
        /// <param name="active">Активная страница</param>
        public RegViewModel(ActivePage active)
        {
            this.active = active;
            Enable      = true;
            Visibile    = Visibility.Hidden;
        }
Exemplo n.º 20
0
        private void ButtonSpecifySOPCLasses_Click(object sender, System.EventArgs e)
        {
            this._active_page = ActivePage.sop_classes_view;

            // Create and fill in the datagrid containing all information on available
            // and selected SOP classes
            this.UpdateSOPClassesView ();

            this.UpdatePageVisibility ();
        }
Exemplo n.º 21
0
 public void SetActivePage(PistachioPage activePage)
 {
     _activePage.Clear();
     ActivePage.Add(activePage);
 }
Exemplo n.º 22
0
 //A karaktereket kiválasztó gomb eseménykezelője
 private void Button_Characters(object sender, RoutedEventArgs e)
 {
     ap = ActivePage.Characters;
     GridView.ItemsSource = ViewModel.Characters;
 }
Exemplo n.º 23
0
        private void ChangeActivePage(PageDirection direction)
        {
            var lastActivePage = ActivePage;

            switch (direction)
            {
            case PageDirection.Back:
            {
                if (ActivePage == null)
                {
                    throw new Exception();
                }

                bool leavingLastPage = ActivePage == this.Pages.Last();

                if (ActivePage.LeavePage(direction))
                {
                    SetActivePage(this.Pages[activePageIndex - 1]);
                    ActivePage.EnterPage(direction);
                }

                if (leavingLastPage)
                {
                    UpdateButtonNextToFinish(false);
                }

                break;
            }

            case PageDirection.Next:
            {
                if (ActivePage == null)
                {
                    SetActivePage(this.Pages.First());
                    ActivePage.EnterPage(direction);
                }
                else
                {
                    if (ActivePage == this.Pages.Last())
                    {
                        bool finishResult = ActivePage.LeavePage(PageDirection.Finish);
                        if (finishResult)
                        {
                            CloseDialog(true);
                        }
                    }
                    else
                    {
                        bool leaveValidated = ActivePage.LeavePage(direction);
                        if (leaveValidated)
                        {
                            SetActivePage(this.Pages[activePageIndex + 1]);
                            ActivePage.EnterPage(direction);
                            if (ActivePage == this.Pages.Last())
                            {
                                UpdateButtonNextToFinish(true);
                            }
                        }
                    }
                }
                break;
            }

            default:
            {
                throw new InvalidOperationException("PageDirection.Finish");
            }
            }

            UpdateButtons(PageDirection.Back, activePageIndex > 0);
            UpdateButtons(PageDirection.Next, true); //ActivePage != this.Pages.Last());

            phPages.Controls.Clear();

            if (lastActivePage != null)
            {
                Control lastActivePageControl = lastActivePage as Control;
                lastActivePageControl.Visible = false;
            }

            Control control = ActivePage as Control;

            phPages.Controls.Add(control);
            control.Dock    = DockStyle.Fill;
            control.Visible = true;
            ChangePageTitle(ActivePage.DefaultPageTitle);

            //UpdateControls();
        }
Exemplo n.º 24
0
        public static void Game(int x, int y)
        {
            bool br = false;

            page = ActivePage.Main;
            HangmanMenuCoordinates = new Point(x, y);
            SetCursorPosition(x, y);
            WriteHr(0x2554, 0x2550, 0x2557);
            WriteDisplayWord("H a n g M a n");
            WriteHr(0x2560, 0x2550, 0x2563);
            WriteEmptyBordered(8);
            PrintHangman(0, -8, 0);

            WriteHr(0x2560, 0x2550, 0x2563);
            WriteBordered("1. Start Game", _hangmanHandler.IsGameStarted);
            WriteBordered("2. Stop Game", !_hangmanHandler.IsGameStarted);
            WriteBordered("");
            WriteBordered("3. Try Letter", !_hangmanHandler.IsGameStarted);
            WriteBordered("4. Try Solve", !_hangmanHandler.IsGameStarted);
            WriteBordered("");
            WriteBordered("5. Difficulty Selector");
            WriteBordered("");
            WriteBordered("6. History");
            WriteBordered("7. Rules");
            WriteBordered("");
            WriteBordered("0. Exit");
            WriteHr(0x2560, 0x2550, 0x2563);
            WriteBordered("Choice : ");
            WriteHr(0x255A, 0x2550, 0x255D);
            SetCursorPosition(11, CursorTop - 2);
            do
            {
                var Choice = System.Console.ReadKey(true).KeyChar - '0';
                if (Choice >= 0 && Choice <= 7)
                {
                    switch (Choice)
                    {
                    case 1:
                        if (!_hangmanHandler.IsGameStarted)
                        {
                            _hangmanHandler.StartGame();
                        }
                        break;

                    case 2:
                        if (_hangmanHandler.IsGameStarted)
                        {
                            _hangmanHandler.StopGame();
                        }
                        break;

                    case 3:
                        if (_hangmanHandler.IsGameStarted)
                        {
                            bool esc = false;
                            SetCursorPosition(2, CursorTop);
                            Write("Choice (Letter): ");
                            char letter = ' ';
                            do
                            {
                                var key = ReadKey(true);
                                if (key.Key == ConsoleKey.Escape || key.Key == ConsoleKey.D0)
                                {
                                    esc = true;
                                    break;
                                }
                                letter = key.KeyChar;
                            } while (!Char.IsLetter(letter));
                            if (!esc)
                            {
                                Write(letter);
                                _hangmanHandler.TryLetter(letter);
                            }
                            SetCursorPosition(0, CursorTop);
                            WriteBordered("Choice :                                       ");
                            SetCursorPosition(11, CursorTop - 1);
                        }
                        break;

                    case 4:
                        if (_hangmanHandler.IsGameStarted)
                        {
                            SetCursorPosition(2, CursorTop);
                            Write("Choice (Solve): ");
                            bool   esc       = false;
                            bool   canSubmit = false;
                            string word      = string.Empty;

                            do
                            {
                                var  key    = ReadKey(true);
                                char letter = key.KeyChar;
                                if (key.Key == ConsoleKey.Escape || key.Key == ConsoleKey.D0)
                                {
                                    esc = true;
                                    break;
                                }
                                else if (key.Key == ConsoleKey.Enter)
                                {
                                    if (canSubmit)
                                    {
                                        break;
                                    }
                                }
                                else if (key.Key == ConsoleKey.Backspace)
                                {
                                    if (word.Length - 1 >= 0)
                                    {
                                        word = word.Substring(0, word.Length - 1);
                                        Write("\b \b");
                                        SetCursorPosition(18, CursorTop);
                                        if (word.Length == _hangmanHandler.GivenWord.Length)
                                        {
                                            ForegroundColor = ConsoleColor.DarkGreen;
                                            canSubmit       = true;
                                        }
                                        else
                                        {
                                            ForegroundColor = ConsoleColor.DarkRed;
                                            canSubmit       = false;
                                        }
                                        Write(word.ToUpper());
                                        ForegroundColor = ConsoleColor.Gray;
                                    }
                                }
                                else if (Char.IsLetter(letter))
                                {
                                    word += letter;
                                    SetCursorPosition(18, CursorTop);
                                    if (word.Length == _hangmanHandler.GivenWord.Length)
                                    {
                                        ForegroundColor = ConsoleColor.DarkGreen;
                                        canSubmit       = true;
                                    }
                                    else
                                    {
                                        ForegroundColor = ConsoleColor.DarkRed;
                                        canSubmit       = false;
                                    }
                                    Write(word.ToUpper());
                                    ForegroundColor = ConsoleColor.Gray;
                                }
                            } while (true);
                            if (!esc)
                            {
                                _hangmanHandler.TrySolve(word);
                            }
                            SetCursorPosition(0, CursorTop);
                            WriteBordered("Choice :                                       ");
                            SetCursorPosition(11, CursorTop - 1);
                        }
                        break;

                    case 5:
                        page = ActivePage.Difficulties;
                        Clear();
                        SetCursorPosition(0, 0);
                        WriteHr(0x2554, 0x2550, 0x2557);
                        WriteDisplayWord("H a n g M a n");
                        WriteHr(0x2560, 0x2550, 0x2563);
                        WriteCenter("Difficulty Picker", true);
                        WriteHr(0x2560, 0x2550, 0x2563);
                        int index = 1;
                        foreach (var item in HangmanDifficulty.List)
                        {
                            WriteBordered("");
                            ForegroundColor = item.Name == _hangmanHandler.Difficulty.Name ? ConsoleColor.DarkGreen : ConsoleColor.Gray;
                            SetCursorPosition(2, CursorTop - 1);
                            WriteLine(index + ". " + item.Name);
                            ForegroundColor = ConsoleColor.Gray;
                            index++;
                        }
                        WriteBordered("");
                        WriteBordered(0 + ". Back");
                        WriteHr(0x2560, 0x2550, 0x2563);
                        WriteBordered("Choice : ");
                        WriteHr(0x255A, 0x2550, 0x255D);
                        SetCursorPosition(11, CursorTop - 2);
                        int choice;
                        do
                        {
                            choice = System.Console.ReadKey(true).KeyChar - '0';
                        } while (choice < 0 || choice >= index);

                        if (choice == 0)
                        {
                            Clear();
                            br = true;
                            break;
                        }
                        _hangmanHandler.Difficulty = HangmanDifficulty.List[choice - 1];
                        Clear();
                        br = true;
                        break;

                    case 7:
                        page = ActivePage.Rules;
                        Clear();
                        SetCursorPosition(0, 0);
                        WriteHr(0x2554, 0x2550, 0x2557);
                        WriteDisplayWord("H a n g M a n");
                        WriteHr(0x2560, 0x2550, 0x2563);
                        WriteCenter("Rules", true);
                        WriteHr(0x2560, 0x2550, 0x2563);
                        foreach (String str in _hangmanHandler.Rules.Split('\n'))
                        {
                            int      pL          = BufferWidth - 4;
                            string[] words       = str.Split(' ');
                            var      parts       = new Dictionary <int, string>();
                            string   part        = string.Empty;
                            int      partCounter = 0;
                            foreach (var word in words)
                            {
                                if (part.Length + word.Length < pL)
                                {
                                    part += string.IsNullOrEmpty(part) ? word : " " + word;
                                }
                                else
                                {
                                    parts.Add(partCounter, part);
                                    part = word;
                                    partCounter++;
                                }
                            }
                            parts.Add(partCounter, part);
                            foreach (var item in parts)
                            {
                                WriteBordered(item.Value);
                            }
                        }
                        WriteHr(0x2560, 0x2550, 0x2563);
                        WriteCenter("Press any key to exit.", true);
                        WriteHr(0x255A, 0x2550, 0x255D);
                        ReadKey(true);
                        Clear();
                        br = true;

                        break;

                    case 0:
                        return;
                    }
                }
            } while (true && !br);

            Game(x, y);
        }
Exemplo n.º 25
0
        private void ButtonActivityLogging_CheckedChanged(object sender, System.EventArgs e)
        {
            if (this.ButtonActivityLogging.Checked == false)
                return;

            this.ClearNavigationHistory ();

            this._active_page = ActivePage.activity_reporting;

            this.UpdatePageVisibility ();
        }
Exemplo n.º 26
0
        private void ButtonGeneralInformation_CheckedChanged(object sender, System.EventArgs e)
        {
            if (ButtonGeneralInformation.Checked == false)
                return;

            this.ClearNavigationHistory ();

            if (this.selected_description != "")
            {
                this._active_page = ActivePage.description;
                this.SessionBrowser.SelectedNode = this.last_selected_script;
            }
            else if (this.selected_script != "")
            {
                this._active_page = ActivePage.script;
                this.SessionBrowser.SelectedNode = this.last_selected_script;
            }
            else
            {
                this._active_page = ActivePage.session;
                this.SessionBrowser.SelectedNode = this.last_selected_session;
            }
            this.UpdatePageVisibility ();
        }
Exemplo n.º 27
0
 private void InCreaseZoomLevel(object x)
 {
     ActivePage.SetZoomLevel(ActivePage.ZoomLevel + 0.25);
 }
Exemplo n.º 28
0
 private void FitImage(object x)
 {
     ActivePage.SetZoomLevel(1);
 }
Exemplo n.º 29
0
        public ProjectForm(Project project_data)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            // Set the callback for activity logging.
            _activity_handler = new Dvtk.Events.ActivityReportEventHandler(this.OnActivityReportEvent);

            // Set the event handler used when a process if finished executing.
            this.RunningProcessEvent += new EventHandler(FinishRunningProcessExecution);

            this.project = project_data;

            if (this.project.GetNrSessions () > 0)
            {
                this.UpdateSessionTreeView ();
                this.SessionBrowser.Select();
            }
            else
            {
                // No session file is available, this means that no session is selected.
                // Normally when selecting a session, all controls on the form are updated and
                // resized. Now we have to explicitly resize the form.
                this._active_page = ActivePage.session;
                this.UpdatePageVisibility ();
                //this.ResizeProjectForm ();
            }

            // Initialize the tablestyle for the SOPClass view. This can be done
            // only once.
            this.SOPClasses.TableStyles.Add (this.CreateTableStyle());
        }
Exemplo n.º 30
0
 //A házakat kiválasztó gomb eseménykezelője
 private void Button_Houses(object sender, RoutedEventArgs e)
 {
     ap = ActivePage.Houses;
     GridView.ItemsSource = ViewModel.Houses;
 }
Exemplo n.º 31
0
 private void CM_Properties_Click(object sender, System.EventArgs e)
 {
     // Switch to the General Information view.
     this._active_page = ActivePage.session;
     this.ButtonGeneralInformation.Checked = true;
     this.UpdatePageVisibility ();
 }
Exemplo n.º 32
0
        private void SessionBrowser_DoubleClick(object sender, System.EventArgs e)
        {
            if (this.button_clicked == MouseButtons.Left)
            {
                string  script="";
                string  emulator = "";
                string  media_file = "";
                string  results="";

                TreeNode tree_node = this.SessionBrowser.SelectedNode;
                if (tree_node != null)
                {
                    // An item in the tree has been selected.
                    this.GetNodeProperties (tree_node, out script, out emulator, out media_file, out results);
                    if (results != "")
                    {
            //                        this.last_selected_result = tree_node;
                        this.ButtonDetailedValidation.Checked = true;
                    }
                    else if (script != "")
                    {
                        if (this.selected_session is Dvtk.Sessions.ScriptSession)
                        {
            //                            this.last_selected_script = tree_node;

                            FileInfo fileInfo = new FileInfo (script);

                            this._process_status = FormStatus.script_running;

                            // Update the UI to reflect that a script is executing
                            this.UpdateUIProcessRunning ();

                            //this.selected_session.StartResultsGathering (this.selected_session.SessionId.ToString ("000") + '_' + file.Name.Replace ('.', '_') + "_res.xml");
                            this.selected_session.StartResultsGatheringWithExpandedFileNaming(fileInfo.Name);

                            // Execute the selected script. This needs to be
                            // done in a seperate thread; we don't want the
                            // entire application to stall.
                            this.selected_script =
                                System.IO.Path.Combine(
                                (this.selected_session as Dvtk.Sessions.ScriptSession).DicomScriptRootDirectory,
                                script);

                            if ((fileInfo.Extension == ".ts") ||
                                (fileInfo.Extension == ".ds") ||
                                (fileInfo.Extension == ".dss"))
                            {
                                this.script_thread = null;
                                System.AsyncCallback cb = new AsyncCallback(this.OnScriptDone);
                                System.IAsyncResult ar =
                                ((Dvtk.Sessions.ScriptSession)this.selected_session).BeginExecuteScript(
                                    this.selected_script,
                                    false,
                                    cb);
                            }
                            else if (fileInfo.Extension == ".js")
                            {
                                this.script_thread = new Thread (new ThreadStart (this.ExecuteJSScript));
                                this.script_thread.Start();
                            }
                            else if (fileInfo.Extension == ".vbs")
                            {
                                this.script_thread = new Thread (new ThreadStart (this.ExecuteVBSScript));
                                this.script_thread.Start();
                            }
                        }
                    }
                    else
                    {
                        this._active_page = ActivePage.session;
            //                        this.last_selected_session = tree_node;
                        this.ButtonGeneralInformation.Checked = true;
                        this.UpdateSessionProperties ();
                        this.UpdatePageVisibility ();
                    }
                }
            }
        }
Exemplo n.º 33
0
        private void CM_Display_Click(object sender, System.EventArgs e)
        {
            // The Display functionality can be executed on script level and
            // on results level. We need to figure out which level has been
            // accessed and update the UI accordingly.
            string script = "";
            string emulator = "";
            string media_file = "";
            string results = "";

            this.GetNodeProperties (this.SessionBrowser.SelectedNode, out script, out emulator, out media_file, out results);
            if (results != "")
            {
                this._active_page = ActivePage.detailed_validation;
                this.selected_results =
                    System.IO.Path.Combine(
                    this.selected_session.ResultsRootDirectory,
                    results);
                this.ButtonDetailedValidation.Checked = true;

                this.ClearNavigationHistory ();
                this.UpdateDetailedResultsView ();
            }
            else
            {
                Dvtk.Sessions.ScriptSession scriptSession = this.selected_session as Dvtk.Sessions.ScriptSession;

                this.selected_script =
                    System.IO.Path.Combine(
                    scriptSession.DicomScriptRootDirectory,
                    script);
                /* If the directory in which the script is located contains a html directory named 'html',
                 * we need to look for a .html file with the same base name as the script.
                 * If such a file exists, we want to display the html file instead of the raw script file.
                 */
                DirectoryInfo   dir_info = new DirectoryInfo (scriptSession.DicomScriptRootDirectory);
                DirectoryInfo[]   html_dir = dir_info.GetDirectories("html");

                // Reset the selected description file
                this.selected_description = "";

                if (html_dir.Length > 0)
                {
                    string html_file = script.Replace ('.', '_') + ".html";
                    dir_info = (DirectoryInfo)html_dir.GetValue (0);
                    foreach (FileInfo file in dir_info.GetFiles())
                    {
                        if (file.Name == html_file)
                            this.selected_description =
                                System.IO.Path.Combine(
                                scriptSession.DicomScriptRootDirectory,
                                "html\\"+html_file);
                    }
                }

                if (this.selected_description != "")
                {
                    object Zero = 0;
                    object EmptyString = "";

                    this.WebDescriptionView.Navigate (this.selected_description, ref Zero, ref EmptyString, ref EmptyString, ref EmptyString);
                    this._active_page = ActivePage.description;
                }
                else
                {
                    this.ClearNavigationHistory ();
                    this.RichTextBoxScript.LoadFile (this.selected_script, RichTextBoxStreamType.PlainText);
                    this._active_page = ActivePage.script;
                }
                this.ButtonGeneralInformation.Checked = true;
            }
        }
Exemplo n.º 34
0
        public void Initialize(Action closeHandler,
                               TradeSharpServerTrade serverProxyAccount,
                               Action <TradeSignalUpdate> signalUpdateSelected,
                               Func <Account> getActualAccountData,
                               Func <string> getUserLogin,
                               Action <PerformerStat> investInPAMM,
                               SavePerformersGridSelectedColumnsDel savePerformersGridSelectedColumns,
                               LoadPerformersGridSelectedColumnsDel loadPerformersGridSelectedColumns,
                               Func <ActionOnSignal> getActionOnSignal,
                               Action <ActionOnSignal> setActionOnSignal,
                               ChatControlBackEnd chat)
        {
            var gr = CreateGraphics();

            this.closeHandler = closeHandler;
            this.chat         = chat;
            AccountModel.Instance.Initialize(getActualAccountData, getUserLogin, investInPAMM, serverProxyAccount.proxy, chat);
            SubscriptionModel.Instance.getActionOnSignal = getActionOnSignal;
            SubscriptionModel.Instance.setActionOnSignal = setActionOnSignal;
            subscriptionGrid.ShowTopPortfolio           += portfolio =>
            {
                LoadPortfolioSubscribers(portfolio);
                Page = ActivePage.Performers;
            };

            // strategies
            var criterias      = PerformerCriteriaFunctionCollection.Instance.criterias;
            var criteriaTitles = criterias.Select(c => c.Description).ToList();

            criteriaComboBox.Items.AddRange(criteriaTitles.Select(c => c as object).ToArray());
            criteriaComboBox.DropDownWidth = criteriaTitles.Max(c => gr.MeasureString(c, Font).ToSize().Width);
            criteriaComboBox.Width         = criteriaComboBox.DropDownWidth + SystemInformation.VerticalScrollBarWidth;

            var indexInCombo = countComboBox.Items.Cast <string>().IndexOf("50");

            countComboBox.SelectedIndex = indexInCombo < 0 ? 0 : indexInCombo;

            sortOrderComboBox.Items.AddRange(EnumItem <PerformerSortOrder> .items.Cast <object>().ToArray());

            SetupSortCombos(gr);

            criteriaComboBox.SelectedIndex = criterias.IndexOf(PerformerCriteriaFunctionCollection.Instance.SelectedFunction);

            //topFilterControl.SortOrder = sortOrderComboBox.SelectedIndex == 0 ? SortOrder.Ascending : SortOrder.Descending;
            topFilterControl.PerformerCriteriaFunctionCollectionChanged += OnPerformerCriteriaFunctionCollectionChanged;
            topFilterControl.PerformerCriteriaFunctionChanged           += OnPerformerCriteriaFunctionChanged;
            topFilterControl.CollapseButtonClicked        += CollapseTopFilterControlButtonClick;
            topFilterControl.RefreshButtonClicked         += RefreshButtonClick;
            topFilterControl.CreatePortfolioButtonClicked += CreatePortfolioButtonClick;

            IsExtendedPanelVisible = false;

            performersWorker.DoWork             += GetPerformers;
            performersWorker.RunWorkerCompleted += GetPerformersCompleted;

            performerFilterWorker.DoWork             += GetPerformersByFilters;
            performerFilterWorker.RunWorkerCompleted += GetPerformersByFiltersCompleted;

            // 4 refresh button
            refreshButtonColors = new[]
            {
                refreshButton.BackColor,
                HslColor.AdjuctBrightness(refreshButton.BackColor, 0.9f),
                HslColor.AdjuctBrightness(refreshButton.BackColor, 0.85f),
                HslColor.AdjuctBrightness(refreshButton.BackColor, 0.8f),
                HslColor.AdjuctBrightness(refreshButton.BackColor, 0.85f),
                HslColor.AdjuctBrightness(refreshButton.BackColor, 0.9f),
                refreshButton.BackColor,
                HslColor.AdjuctBrightness(refreshButton.BackColor, 1.1f),
                HslColor.AdjuctBrightness(refreshButton.BackColor, 1.15f),
                HslColor.AdjuctBrightness(refreshButton.BackColor, 1.2f),
                HslColor.AdjuctBrightness(refreshButton.BackColor, 1.15f),
                HslColor.AdjuctBrightness(refreshButton.BackColor, 1.1f)
            };
            topFilterControl.RefreshButtonEnabled = false;
            refreshButton.Enabled = false;

            performerGridCtrl.LoadPerformersGridSelectedColumns = loadPerformersGridSelectedColumns;
            performerGridCtrl.SavePerformersGridSelectedColumns = savePerformersGridSelectedColumns;
            performerGridCtrl.EnterRoomRequested += OnEnterRoomRequested;
            performerGridCtrl.PageTargeted       += page => Page = page;
            performerGridCtrl.SetupGrid();

            signalFastGrid.SignalUpdateSelected += signalUpdateSelected;

            // company top portfolios
            portfoliosWorker.DoWork             += GetPortfoloios;
            portfoliosWorker.RunWorkerCompleted += GetPortfoloiosCompleted;

            // my top
            myPortfoliosWorker.DoWork             += GetMyPortfolio;
            myPortfoliosWorker.RunWorkerCompleted += GetMyPortfolioCompleted;

            signalsToolStripMenuItem.CheckedChanged += ParametersContextMenuStripItemClicked;
            pammsToolStripMenuItem.CheckedChanged   += ParametersContextMenuStripItemClicked;
        }
Exemplo n.º 35
0
        /// <summary>
        /// This function closes the SOP classes view and shows the session properties page.
        /// </summary>
        /// <todo>
        /// Check with definition roots before (un)loading def files.
        /// </todo>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonReturnToSessionProperties_Click(object sender, System.EventArgs e)
        {
            this.LoadUnloadDefinitionFiles ();

            this._active_page = ActivePage.session;
            this.VScrollBarSessionInfo.Visible = true;
            this.PanelSessionProperties.Visible = true;
            this.RichTextBoxInfo.Visible = this.ShowRichTextBoxInfo;

            this.PanelSOPClasses.Visible = false;
            this.RichTextBoxScript.Visible = false;
            this.WebDescriptionView.Visible = false;

            this.PositionPageViewButtons ();
            this.ResizeSessionPropertiesView ();
        }
Exemplo n.º 36
0
        private void SessionBrowser_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
        {
            // It's possible that the user selected another session or an item from another session.
            // Remove the activity handler from the current selected session.
            if (this.selected_session != null)
                this.selected_session.ActivityReportEvent -= this._activity_handler;

            if (this._active_page == ActivePage.sop_classes_view)
            {
                // Before we switch session properties, we must load/unload
                // the necessary definition files.
                this.LoadUnloadDefinitionFiles ();
            }
            TreeNode tree_node = this.SessionBrowser.SelectedNode;
            if (tree_node != null)
            {
                string script = "";
                string emulator = "";
                string media_file = "";
                string results = "";

                this.selected_description = "";
                this.selected_results = "";
                this.selected_script = "";

                this.GetNodeProperties (tree_node, out script, out emulator, out media_file, out results);

                // We now know what session is selected in the browser. Set the activity handler to the
                // current selected session.
                this.selected_session.ActivityReportEvent += this._activity_handler;

                this.ClearNavigationHistory ();

                if (this.selected_session is Dvtk.Sessions.ScriptSession)
                {
                    Dvtk.Sessions.ScriptSession scriptSession = this.selected_session as Dvtk.Sessions.ScriptSession;
                    if (script != "")
                    {
                        string html_file = script.Replace ('.', '_') + ".html";
                        this.selected_script =
                            System.IO.Path.Combine(
                            scriptSession.DicomScriptRootDirectory,
                            script);
                        this.last_selected_script = tree_node;

                        /* A script is selected. If a description dir is available, check if the */
                        /* description dir contains a file named like the script with the extension */
                        /* of the script replaced with .html */
                        if (scriptSession.DescriptionDirectory != "")
                        {
                            DirectoryInfo   dir_info = new DirectoryInfo (scriptSession.DescriptionDirectory);

                            // Reset the selected description file
                            this.selected_description = "";

                            if (dir_info.Exists)
                            {
                                foreach (FileInfo file in dir_info.GetFiles())
                                {
                                    if (file.Name == html_file)
                                        this.selected_description = file.FullName;
                                }
                            }
                        }

                        if (this.selected_description != "")
                        {
                            object Zero = 0;
                            object EmptyString = "";

                            this.WebDescriptionView.Navigate (this.selected_description, ref Zero, ref EmptyString, ref EmptyString, ref EmptyString);
                            this._active_page = ActivePage.description;
                        }
                        else
                        {
                            this.ClearNavigationHistory ();

                            this.RichTextBoxScript.LoadFile (this.selected_script, RichTextBoxStreamType.PlainText);
                            this._active_page = ActivePage.script;
                        }
                        this.ButtonGeneralInformation.Checked = true;
                    }
                    else
                    {
                        if (results != "")
                        {
                            this._active_page = ActivePage.detailed_validation;
                            this.last_selected_result = tree_node;
                            this.selected_results =
                                System.IO.Path.Combine(
                                scriptSession.ResultsRootDirectory,
                                results);
                            this.ButtonDetailedValidation.Checked = true;

                            this.ClearNavigationHistory ();

                            this.UpdateDetailedResultsView ();
                        }
                        else
                        {
                            // The session file has been clicked. The view can be either
                            // the sop classes view or the session properties view. Don't change
                            // the view when the current view is sop classes view.
                            if (this._active_page != ActivePage.sop_classes_view)
                                this._active_page = ActivePage.session;
                            this.last_selected_session = tree_node;
                        }
                    }
                }
                if (this.selected_session is Dvtk.Sessions.MediaSession)
                {
                    Dvtk.Sessions.MediaSession media_session = (Dvtk.Sessions.MediaSession) this.selected_session;
                    if (results != "")
                    {
                        this._active_page = ActivePage.detailed_validation;
                        this.last_selected_result = tree_node;
                        this.selected_results =
                            System.IO.Path.Combine(
                            media_session.ResultsRootDirectory,
                            results);

                        this.ClearNavigationHistory ();

                        this.UpdateDetailedResultsView ();
                        this.ButtonDetailedValidation.Checked = true;
                    }
                    else
                    {
                        // The session file has been clicked. The view can be either
                        // the sop classes view or the session properties view. Don't change
                        // the view when the current view is sop classes view.
                        if (this._active_page != ActivePage.sop_classes_view)
                            this._active_page = ActivePage.session;
                        this.last_selected_session = tree_node;
                    }
                }
                if (this.selected_session is Dvtk.Sessions.EmulatorSession)
                {
                    Dvtk.Sessions.EmulatorSession emulator_session = (Dvtk.Sessions.EmulatorSession) this.selected_session;
                    if (results != "")
                    {
                        this._active_page = ActivePage.detailed_validation;
                        this.last_selected_result = tree_node;
                        this.selected_results =
                            System.IO.Path.Combine(
                            emulator_session.ResultsRootDirectory,
                            results);

                        this.ClearNavigationHistory ();

                        this.UpdateDetailedResultsView ();
                        this.ButtonDetailedValidation.Checked = true;
                    }
                    else
                    {
                        // The session file has been clicked. The view can be either
                        // the sop classes view or the session properties view. Don't change
                        // the view when the current view is sop classes view.
                        if (this._active_page != ActivePage.sop_classes_view)
                            this._active_page = ActivePage.session;
                        this.last_selected_session = tree_node;
                    }
                }

                // Update the title bar of the project form
                this.Text = string.Format("Active session: {0}", this.selected_session.SessionFileName);

                if (this._active_page == ActivePage.sop_classes_view)
                    this.UpdateSOPClassesView ();

                this.UpdateSessionProperties ();
                this.UpdatePageVisibility ();
                this.ResizeProjectForm ();

                // Update the mainform controls (menu, toolbar, title)
                ((MainForm)this.ParentForm).UpdateUIControls ();
            }
        }
Exemplo n.º 37
0
        private void ButtonDetailedValidation_CheckedChanged(object sender, System.EventArgs e)
        {
            if (this.ButtonDetailedValidation.Checked == false)
                return;

            this.ClearNavigationHistory ();

            this._active_page = ActivePage.detailed_validation;

            this.UpdatePageVisibility ();
        }
Exemplo n.º 38
0
 private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
 {
     GetAnnouncement();
     pageNo = 0;
     ShowPage();
 }