Пример #1
0
        public Main()
        {
            QuitOption = QuitOption.QuitProgram;

            Current = this;

            File.Delete(m_shellContentMenuFilePath);

            InitializeComponent();

            this.Text = "Waveface ";

            m_dragDropClipboardHelper = new DragDrop_Clipboard_Helper();

            //initVirtualFolderForm();

            InitTaskbarNotifier();

            m_formSettings                = new FormSettings(this);
            m_formSettings.UseSize        = true;
            m_formSettings.UseLocation    = true;
            m_formSettings.UseWindowState = true;
            m_formSettings.AllowMinimized = false;
            m_formSettings.SaveOnClose    = true;

            //System.Net.ServicePointManager.DefaultConnectionLimit = 64;

            m_autoUpdator = new AppLimit.NetSparkle.Sparkle(WService.WebURL + "/extensions/windowsUpdate/versioninfo.xml");
            m_autoUpdator.StartLoop(true, TimeSpan.FromHours(5.0));

            s_logger.Trace("Constructor: OK");
        }
        public void DisplayMenu()
        {
            // Clear the console
            Console.Clear();

            // Write the header
            Console.WriteLine(Header);
            // Display the items in the menu
            foreach (MenuItem item in menuItems.Values)
            {
                item.DisplayMenuItem();
            }

            QuitOption.DisplayMenuItem();
        }
Пример #3
0
        private void doLogin(string email, string password)
        {
            Cursor = Cursors.WaitCursor;

            Program.ShowCrashReporter = true;

            try
            {
                QuitOption quit = _doLogin(email, password);
                if (quit == QuitOption.QuitProgram)
                {
                    Close();
                }
                else if (quit == QuitOption.Logout)
                {
                    Environment.Exit(-2);
                }
                else
                {
                    Environment.Exit(-1);
                }
            }
            catch (StationServiceDownException _e)
            {
                NLogUtility.Exception(s_logger, _e, "doLogin");

                MessageBox.Show(I18n.L.T("StationServiceDown"), "Waveface");
                Environment.Exit(-1);
            }
            catch (ServiceUnavailableException _e)
            {
                NLogUtility.Exception(s_logger, _e, "doLogin");

                // user should re-register station if receive service unavailable exception
                // so we close the login page here
                MessageBox.Show(I18n.L.T("RegisteredRequired", txtUserName.Text), "Waveface");
                Environment.Exit(-1);
            }
            catch (Exception _e)
            {
                NLogUtility.Exception(s_logger, _e, "doLogin");

                MessageBox.Show(I18n.L.T("LoginForm.LogInError") + " : " + _e.Message, "Waveface");
                Environment.Exit(-1);
            }
        }
Пример #4
0
        static CardinalDirection Movement(AvailableCommand Command)
        {
            string QuitOption;

            switch (Command)
            {
            //boundry case defined in offset from directionsFacing
            //modulus ensures value is always between 0-3
            case AvailableCommand.MoveLeft:
                return((CardinalDirection)((s_directionFacing - 1 + 4) % 4));

            case AvailableCommand.MoveRight:
                return((CardinalDirection)((s_directionFacing + 1 + 4) % 4));

            case AvailableCommand.MoveBackward:
                return((CardinalDirection)((s_directionFacing + 2 + 4) % 4));

            case AvailableCommand.MoveForward:
                return((CardinalDirection)s_directionFacing);

            case AvailableCommand.Quit:
                Console.WriteLine("Are you sure you want to quit? Yes/No: ");
                QuitOption = Console.ReadLine();
                QuitOption = QuitOption.ToLower();
                if (QuitOption == "yes")
                {
                    Environment.Exit(0);
                }
                if (QuitOption == "no")
                {
                    break;
                }
                if (QuitOption != "yes" || QuitOption != "no")
                {
                    QuitOption = Console.ReadLine();
                    QuitOption = QuitOption.Trim();
                    QuitOption = QuitOption.ToLower();
                    Console.WriteLine("Invalid input. Please enter 'yes' or 'no'.");
                }
                break;
            }
            return((CardinalDirection)s_directionFacing);
        }
Пример #5
0
        public void ForceLogout()
        {
            if (InvokeRequired)
            {
                Invoke(new MethodInvoker(
                           delegate { ForceLogout(); }
                           ));
            }
            else
            {
                MessageBox.Show(I18n.L.T("ForceLogout"), "Waveface", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);

                m_forceLogout = true;
                QuitOption    = QuitOption.Logout;

                Close();
            }
        }
Пример #6
0
        public void Station401ExceptionHandler(string message)
        {
            if (InvokeRequired)
            {
                Invoke(new MethodInvoker(
                           delegate { Station401ExceptionHandler(message); }
                           ));
            }
            else
            {
                MessageBox.Show(I18n.L.T("Station401Exception"), "Waveface", MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);

                m_forceLogout = true;
                QuitOption    = QuitOption.Logout;

                Close();
            }
        }
Пример #7
0
        public void Logout()
        {
            Program.ShowCrashReporter = false;

            QuitOption = QuitOption.Logout;

            try
            {
                if (NewPostManager != null)
                {
                    NewPostManager.AbortThread();
                    NewPostManager = null;
                }

                if (PhotoDownloader != null)
                {
                    PhotoDownloader.AbortThread();
                    PhotoDownloader = null;
                }

                if (UploadOriginPhotosToStationManager != null)
                {
                    UploadOriginPhotosToStationManager.AbortThread();
                    UploadOriginPhotosToStationManager = null;
                }

                if (StationState != null)
                {
                    StationState.AbortThread();
                    statusStrip = null;
                }
            }
            catch
            {
            }

            Close();
        }
Пример #8
0
        static AvailableCommand CommandHandler()
        {
            string QuitOption;

            while (true)
            {
                Console.WriteLine("".PadLeft(45, '-'));
                Console.WriteLine("Where will you go?");
                Console.WriteLine("The available movement commands are: 'move forward', 'move backward', 'move right', 'move left'");
                Console.WriteLine("The available looking commands are: 'look left', 'look right', 'turn around'");
                Console.WriteLine("You may enter 'quit' to exit the game.");
                Console.WriteLine("".PadLeft(45, '-'));
                string Command = CommandValid();

                switch (Command)
                {
                case "Quit":
                    Console.WriteLine("Are you sure you want to quit? Yes/No: ");
                    QuitOption = Console.ReadLine();
                    QuitOption = QuitOption.ToLower();
                    if (QuitOption == "yes")
                    {
                        Environment.Exit(0);
                    }
                    if (QuitOption == "no")
                    {
                        break;
                    }
                    if (QuitOption != "yes" || QuitOption != "no")
                    {
                        QuitOption = Console.ReadLine();
                        QuitOption = QuitOption.Trim();
                        QuitOption = QuitOption.ToLower();
                        Console.WriteLine("Invalid input. Please enter 'yes' or 'no'.");
                    }
                    return(AvailableCommand.Quit);

                case "move forward":
                    return(AvailableCommand.MoveForward);

                case "move backward":
                    return(AvailableCommand.MoveBackward);

                case "move right":
                    return(AvailableCommand.MoveRight);

                case "move left":
                    return(AvailableCommand.MoveLeft);

                case "look right":
                    s_directionFacing = (s_directionFacing + 1 + 4) % 4;
                    DisplayDirection();
                    break;

                case "look left":
                    s_directionFacing = (s_directionFacing - 1 + 4) % 4;
                    DisplayDirection();
                    break;

                case "turn around":
                    s_directionFacing = (s_directionFacing + 1 + 4) % 4;
                    break;

                default:
                {
                    Console.WriteLine("Invalid input. Please enter a valid command.");
                    continue;
                }
                }
            }
        }