MainWindow.xaml 的交互逻辑
Inheritance: Client.Window
Esempio n. 1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Root = ((Client.MainWindow)(target));
                return;

            case 2:
                this.LogOut = ((System.Windows.Controls.Button)(target));
                return;

            case 3:
                this.LogIn = ((System.Windows.Controls.Button)(target));
                return;

            case 4:
                this.SignIn = ((System.Windows.Controls.Button)(target));
                return;

            case 5:
                this.SaveConfigs = ((System.Windows.Controls.Button)(target));
                return;

            case 6:
                this.GetConfigsByPeriod = ((System.Windows.Controls.Button)(target));
                return;
            }
            this._contentLoaded = true;
        }
Esempio n. 2
0
 public static void Main(string[] args)
 {
     Application.Init ();
     MainWindow win = new MainWindow ();
     win.Show ();
     Application.Run ();
 }
Esempio n. 3
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     windowChat = (WindowChat)this.Owner;
     mainWindow = (MainWindow)this.Owner.Owner;
     currentConversation = windowChat.currentConversations.Last().Key;
     this.Title += currentConversation;
 }
Esempio n. 4
0
        public AddUser(MainWindow owner)
        {
            parent = owner;
            InitializeComponent();
            // Need to get the roles

            // Need to get the groups
        }
 public void displayContacts(MainWindow top)
 {
     foreach (Contact cont in klient.getContactsByUser(top.LoggedUser, 10).ToList()) 
     {
         Contactsview.Items.Add(cont.FirstName + " " + cont.LastName);
     }
     top1 = top;
 }
 private void Application_Startup(object sender, StartupEventArgs e)
 {
     // create the main window and assign your datacontext
     MainWindow main;
     main = new MainWindow();
     main.Show();
     main.ShowOptionsWindow();
 }
 public SelectActionUI(ClientLogic client, string folder, MainWindow main)
 {
     InitializeComponent();
     mw = main;
     clientLogic = client;
     folderRoot = folder;
     App.Current.MainWindow.Width = 400;
     App.Current.MainWindow.Height = 400;
 }
 public Restore(ClientLogic client, MainWindow mainw)
 {
     InitializeComponent();
     clientlogic = client;
     mw = mainw;
     RestoreUC main = new RestoreUC(clientlogic, mw);
     App.Current.MainWindow = this;
     App.Current.MainWindow.Content = main;
 }
 public MenuControl()
 {
     InitializeComponent();
     ((MainWindow)App.Current.MainWindow).IsCloseButtonEnabled = true;
     exit = false;
     lastCheck = String.Empty;
     App.Current.MainWindow.Title = "Mycloud";
     mw = (MainWindow)App.Current.MainWindow;
     mw.clientLogic.event_1 = new AutoResetEvent(false);
     updating = false;
 }
        public DownloadFile(ClientLogic clientLogic, string root, string nameFile, Boolean searchPass, MainWindow mainw, String idFile)
        {
            try
            {
                InitializeComponent();
                mw = mainw;
                clientlogic = clientLogic;
                search = searchPass;
                folder = root;
                namefile = nameFile;
                completePath = folder + @"\" + namefile;
                App.Current.MainWindow.Width = 600;
                App.Current.MainWindow.Height = 430;
                clientLogic.WriteStringOnStream(ClientLogic.GETVFILE + clientLogic.username + "+" + folder + "+" + completePath + "+" + idFile);
                String retFiles;
                Boolean exit = false;

                while (!exit)
                {
                    retFiles = clientLogic.ReadStringFromStream();
                    String[] parametri = retFiles.Split('+');
                    String comando = parametri[1];
                    if (comando.Equals("FLP"))
                    {
                        addElementToListbox(parametri[3]);
                        clientlogic.WriteStringOnStream(ClientLogic.OK);
                    }
                    else if (comando.Equals("ENDLIST") || comando.Equals("INFO"))
                    {
                        exit = true;
                    }
                    else
                    {
                        exit = true;
                    }
                }
                if (!search)
                    addElementToListbox("...");
            }
            catch
            {
                if (App.Current.MainWindow is Restore)
                    App.Current.MainWindow.Close();
                if (clientLogic.clientsocket.Client.Connected)
                {
                    clientLogic.clientsocket.GetStream().Close();
                    clientLogic.clientsocket.Close();
                }
                App.Current.MainWindow = mainw;
                MainControl main = new MainControl(1);
                App.Current.MainWindow.Content = main;
                return;
            }
        }
 public DownloadFolder(ClientLogic clientlogic, string fold, MainWindow main)
 {
     InitializeComponent();
     downloading = false;
     mw = main;
     folderRoot = fold;
     clientLogic = clientlogic;
     App.Current.MainWindow.Width = 500;
     App.Current.MainWindow.Height = 215;
     string folderCreated = folderRoot.Substring(folderRoot.LastIndexOf((@"\")) + 1);
     pathRoot = clientlogic.folderR + @"\" + folderCreated;
     System.IO.Directory.CreateDirectory(pathRoot);
 }
Esempio n. 12
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            #if PORTABLE
                var programDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                Log.LogFile = Path.Combine(programDir, "log.txt");
                MakePortable(User.Default);
            #endif

            MigrateUserSettings();

            var mainWindow = new MainWindow();
            mainWindow.Show();
        }
Esempio n. 13
0
        public MainWindowViewModel(MainWindow window)
        {
            _window = window;

            Log.LogLevel = User.Default.DebugLoggingOn ? LogLevel.Debug : LogLevel.Error;

            _changefile = new FileChangeObserver();
            _changefile.OnFileChanged += () => _window.Dispatcher.BeginInvoke(new Action(ReloadFile));

            SortType = (SortType)User.Default.CurrentSort;

            if (!string.IsNullOrEmpty(User.Default.FilePath))
                LoadTasks(User.Default.FilePath);
        }
 public StartDownload(ClientLogic client, string file, string versionP, string rootF, MainWindow main, String sIdFile)
 {
     InitializeComponent();
     mw = main;
     downloading = false;
     clientLogic = client;
     fileName = file;
     versione = versionP;
     root = rootF;
     App.Current.MainWindow.Width = 300;
     App.Current.MainWindow.Height = 300;
     downloadName.Content = System.IO.Path.GetFileName(file); ;
     idFile = sIdFile;
     RiceviFile();
 }
Esempio n. 15
0
        public Chat(Guid userId ,Guid contactId, string contactNickname, MainWindow parentMainWindow)
        {
            InitializeComponent();
            ContactId = contactId;
            UserId = userId;
            ContactNick = contactNickname;
            Title = "Chat with " + ContactNick;
            NameLabel.Content = contactNickname;
            parent = parentMainWindow;
            _messageHistory = new List<Dictionary<string, object>>();
            _messageHistory = MainWindow.ServerClient.GetMessageHistory(UserId, ContactId);
            Refresh();
            StartConnection();

        }
Esempio n. 16
0
		public MainWindowViewModel(MainWindow window)
		{
			_window = window;

			Log.LogLevel = User.Default.DebugLoggingOn ? LogLevel.Debug : LogLevel.Error;

			//add view on change file
			_changefile = new ObserverChangeFile();
			_changefile.OnFileTaskListChange += () => _window.Dispatcher.BeginInvoke(new Action(delegate() { Refresh(); }));

			SortType = (SortType)User.Default.CurrentSort;

			if (!string.IsNullOrEmpty(User.Default.FilePath))
				LoadTasks(User.Default.FilePath);
		}
Esempio n. 17
0
        /// <summary>
        /// Constructor for new Game
        /// </summary>
        /// <param name="window">MainWindow object of application</param>
        public Game(MainWindow window)
        {
            timer.Enabled = true;

            this.window = window;

            players = new List<Player>();
            playerControls = new Dictionary<Player, PlayersStatsControl>();

            skills = new List<Skill>();
            skillControls = new Dictionary<Skill, SkillControl>();

            hits = new List<Hit>();
            window.listBoxOut.ItemsSource = hits;
        }
 private void OnGameSessionJoin(object sender, BoolEventArgs e)
 {
     connectAnimation.Stop();
     if(e.Ok)
     {
         var mw = new MainWindow();
         mw.Show();
         mw.Closed += (s, o) => Show();
         mw.serverListWindow = this;
         Hide();
     }
     else
     {
         MessageBox.Show("Не удалось подключиться к игре: " + e.Error);
     }
 }
Esempio n. 19
0
        public MainWindowViewModel(MainWindow window)
        {
            _window = window;
            _selectedTasks = new List<Task>();

            Log.LogLevel = User.Default.DebugLoggingOn ? LogLevel.Debug : LogLevel.Error;

            Log.Debug("Initializing Todotxt.net");

            SortType = (SortType)User.Default.CurrentSort;


            if (!string.IsNullOrEmpty(User.Default.FilePath))
            {
                LoadTasks(User.Default.FilePath);
            }
        }
Esempio n. 20
0
 private void btnEnter_Click(object sender, RoutedEventArgs e)
 {
     string login = TbLogin.Text;
     string password = PbPassword.Password;
     Guid? result =  MainWindow.ServerClient.Authorize(login, password);
     if (result == null)
     {
         MessageBox.Show("Неверный логин или пароль", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
         TbLogin.Clear();
         PbPassword.Clear();
     }
     else
     {
         _userId = (Guid) result;
         this.Hide();
         var contatcs = new MainWindow(_userId, login);
         contatcs.Activate();
         contatcs.Show();
         this.Close();
     }
 }
Esempio n. 21
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     ResourceManager.Instance.LoginName = loginTB.Text;
     bool loginSuccess = ResourceManager.Instance.Login();
     if(loginSuccess == false && ResourceManager.Instance.IsConnected == false)
     {
         MessageBox.Show("Service connection couldn't be established.\nCheck service is running and try again.",
             "Service not running", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     else if (loginSuccess == false && ResourceManager.Instance.IsConnected == true)
     {
         MessageBox.Show("Login failed please try again.", "Service login failed", MessageBoxButton.OK, MessageBoxImage.Information);
     }
     else
     {
         MainWindow mainWin = new MainWindow();
         mainWin.Show();
         mainWin.loginNameLbl.Content = "Logged in as: "+ResourceManager.Instance.LoginName;
         Close();
     }
 }
Esempio n. 22
0
        private async void Application_Startup(object sender, StartupEventArgs e)
        {
            var frm = new MainWindow();
            frm.ShowDialog();
            //var connection = new HubConnection("http://serverofwhitenoodlehub.azurewebsites.net/");
            var connection = new HubConnection("http://localhost:2773/");
            var hub = connection.CreateHubProxy("NoodlesServerHub");
            await connection.Start();

            var main = new Guest();
            var bcon = frm.DataContext as MainPageViewModel;
            var con = main.DataContext as GuestViewModel;
            if(bcon == null || con == null) Current.Shutdown();
            /*hub["UserName"] =*/ con.Guest.Name = bcon.Name;
            con.Guest.Allergy = bcon.AllergyType;
            
            con.SetHub(hub);

            main.ShowDialog();

            Current.Shutdown();

        }
Esempio n. 23
0
		public UpdateChecker(MainWindow window)
		{
			_window = window;
		}
        public RestoreUC(ClientLogic clientLogic, MainWindow mainw)
        {
            try
            {
                InitializeComponent();
                clientlogic = clientLogic;
                mw = mainw;
                App.Current.MainWindow.Width = 400;
                App.Current.MainWindow.Height = 400;
                clientLogic.WriteStringOnStream(ClientLogic.GETFOLDERUSER + clientLogic.username);
                String retFolders = clientLogic.ReadStringFromStream();
                String[] parametri = retFolders.Split('+');
                String comando = parametri[1];
                if (comando.Equals("OK"))
                {
                    String[] folders = parametri[2].Split(';');
                    int numParametri = folders.Length;
                    if (numParametri > 1)
                    {
                        noFolder.Visibility = Visibility.Hidden;
                        for (int i = 0; i < numParametri; i++)
                        {
                            if (folders[i] != string.Empty)
                            {
                                addElementToListbox(folders[i]);
                            }
                        }

                    }
                    else
                    {
                        noFolder.Visibility = Visibility.Visible;
                    }
                }
                else
                {
                    if (App.Current.MainWindow is Restore)
                        App.Current.MainWindow.Close();
                    if (clientLogic.clientsocket.Client.Connected)
                    {
                        clientLogic.clientsocket.GetStream().Close();
                        clientLogic.clientsocket.Close();
                    }
                    App.Current.MainWindow = mainw;
                    MainControl main = new MainControl(1);
                    App.Current.MainWindow.Content = main;
                    return;
                }
            }
            catch
            {
                if (App.Current.MainWindow is Restore)
                    App.Current.MainWindow.Close();
                if (clientLogic.clientsocket.Client.Connected)
                {
                    clientLogic.clientsocket.GetStream().Close();
                    clientLogic.clientsocket.Close();
                }
                App.Current.MainWindow = mainw;
                MainControl main = new MainControl(1);
                App.Current.MainWindow.Content = main;
                return;
            }


        }
Esempio n. 25
0
 public AddGroup(MainWindow owner)
 {
     parent = owner;
     InitializeComponent();
 }
        public void TryConnect(IPAddress iPAddress, int port, string login, string password, MainWindow main)
        {
            Task.Run(() =>
            {
                this.main = main;
                try
                {
                    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
                    IPEndPoint ipPoint = new IPEndPoint(iPAddress, port);
                    Socket socket      = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                    socket.Connect(ipPoint);
                    using (var networkStream = new NetworkStream(socket, true))
                        using (var sslStream = new SslStream(networkStream, false, ValidateServerCertificate))
                        {
                            this.SslStream = sslStream;
                            sslStream.AuthenticateAsClient("SecureServer");
                            AutentificationData data;
                            data.login      = login;
                            data.password   = password;
                            byte[] SendData = Encoding.UTF8.GetBytes("auth:" + JsonConvert.SerializeObject(data) + "<EOF>");
                            sslStream.Write(SendData);
                            sslStream.Flush();
                            string serverMessage = ReadMessage();

                            if (main.DisplayRoleInterface(serverMessage))
                            {
                                StartHandlingAnswer();
                            }
                            main.Dispatcher.Invoke(() => main.TryEnter.IsEnabled = true);
                        };

                    socket.Close();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                }
            });
        }
Esempio n. 27
0
 public AddNewContact(MainWindow mainWindow, Guid userId)
 {
     MainWindow = mainWindow;
     _currentUserId = userId;
     InitializeComponent();
 }
Esempio n. 28
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            mainWindow = (MainWindow)this.Owner;
            this.Title += "you are " + mainWindow.username;
            currentConversations = new Dictionary<string, WindowDialog>();

            var chatMessages = mainWindow.proxy.ReceiveFromChat(new ChatMessage(null, null));
            foreach (var message in chatMessages)
            {
                listBoxChat.Items.Add(message.From + ": " + message.Text);
            }

            var onlineMembers = mainWindow.proxy.GetOnlineMembers();
            foreach (var member in onlineMembers)
            {
                var listBoxItem = new ListBoxItem();
                listBoxItem.Content = member;
                listBoxItem.MouseDoubleClick += this.listBoxItem_MouseDoubleClick;
                listBoxContactlist.Items.Add(listBoxItem);
            }

            ControlTimers();
        }
Esempio n. 29
0
 public ViewUser(MainWindow owner)
 {
     parent = owner;
     InitializeComponent();
 }
Esempio n. 30
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.mainwindow = ((Client.MainWindow)(target));

            #line 11 "..\..\MainWindow.xaml"
                this.mainwindow.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Window_MouseDown);

            #line default
            #line hidden
                return;

            case 2:
                this.temp = ((System.Windows.Controls.TextBox)(target));
                return;

            case 3:
                this.screen = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 4:
                this.ID_Box = ((System.Windows.Controls.TextBox)(target));

            #line 280 "..\..\MainWindow.xaml"
                this.ID_Box.LostFocus += new System.Windows.RoutedEventHandler(this.ID_Box_LostFocus);

            #line default
            #line hidden

            #line 281 "..\..\MainWindow.xaml"
                this.ID_Box.GotFocus += new System.Windows.RoutedEventHandler(this.ID_Box_GotFocus);

            #line default
            #line hidden
                return;

            case 5:
                this.PW_Box_Text = ((System.Windows.Controls.TextBox)(target));

            #line 285 "..\..\MainWindow.xaml"
                this.PW_Box_Text.GotFocus += new System.Windows.RoutedEventHandler(this.PW_Box_GotFocus);

            #line default
            #line hidden
                return;

            case 6:
                this.PW_Box = ((System.Windows.Controls.PasswordBox)(target));

            #line 288 "..\..\MainWindow.xaml"
                this.PW_Box.KeyDown += new System.Windows.Input.KeyEventHandler(this.PW_Box_KeyDown);

            #line default
            #line hidden

            #line 288 "..\..\MainWindow.xaml"
                this.PW_Box.LostFocus += new System.Windows.RoutedEventHandler(this.PW_Box_LostFocus);

            #line default
            #line hidden

            #line 289 "..\..\MainWindow.xaml"
                this.PW_Box.GotFocus += new System.Windows.RoutedEventHandler(this.PW_Box_GotFocus);

            #line default
            #line hidden
                return;

            case 7:
                this.Login_btn = ((System.Windows.Controls.Button)(target));

            #line 295 "..\..\MainWindow.xaml"
                this.Login_btn.Click += new System.Windows.RoutedEventHandler(this.Login_btn_Click);

            #line default
            #line hidden
                return;

            case 8:
                this.SingUP_btn = ((System.Windows.Controls.Button)(target));

            #line 318 "..\..\MainWindow.xaml"
                this.SingUP_btn.Click += new System.Windows.RoutedEventHandler(this.SingUP_btn_Click);

            #line default
            #line hidden
                return;

            case 9:
                this.Geust_Login = ((System.Windows.Controls.Button)(target));

            #line 321 "..\..\MainWindow.xaml"
                this.Geust_Login.Click += new System.Windows.RoutedEventHandler(this.Geust_Login_Button_Click);

            #line default
            #line hidden
                return;

            case 10:
                this.Forget_btn = ((System.Windows.Controls.Button)(target));

            #line 324 "..\..\MainWindow.xaml"
                this.Forget_btn.Click += new System.Windows.RoutedEventHandler(this.Forget_btn_Button_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
 private void button_Click(object sender, RoutedEventArgs e)
 {
     MainWindow main = new MainWindow(usernameBox.Text);
     Application.Current.Windows[0].Close();
     main.ShowDialog();
 }
Esempio n. 32
0
 public NewDirectory(MainWindow owner)
 {
     parent = owner;
     InitializeComponent();
 }
Esempio n. 33
0
 public Connect(MainWindow owner)
 {
     parent = owner;
     InitializeComponent();
 }