Exemple #1
0
        public LoginPage()
        {
            InitializeComponent();

            if (File.Exists("log.txt"))
            {
                string[] account = File.ReadAllLines("log.txt");

                textBox_Email.Text = account[0];

                textBox_Email.FontSize = 20;

                textBox_Email.PlaceHolder = "";

                PassBox.passbox.Password = account[1];

                PassBox.FontSize = 20;

                PassBox.PlaceHolder = "";

                IService1Callback callback = this as IService1Callback;

                InstanceContext context = new InstanceContext(callback);

                client = new Service1Client(context);
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            IService1Callback callback = this as IService1Callback;

            InstanceContext context = new InstanceContext(callback);

            client = new Service1Client(context);

            if (items_control.Items.Count > 0)
            {
                items_control.Items.Clear();
            }

            if (users.Count() > 0)
            {
                users.Clear();
            }

            var get_users = client.DefaultFilter(email);

            double user_lati = client.GetLatiTude(email);
            double user_long = client.GetLongiTude(email);

            List <ImageBrush> images = new List <ImageBrush>();

            foreach (var item in get_users)
            {
                var photos = client.GetPhotos(item);

                if (photos != null)
                {
                    foreach (var pic in photos)
                    {
                        ImageBrush image = new ImageBrush(new BitmapImage
                                                              (new Uri(pic.Photo, UriKind.RelativeOrAbsolute)));

                        images.Add(image);
                    }
                }

                double lati_ = client.GetLatiTude(item.Email);
                double long_ = client.GetLongiTude(item.Email);

                double distance = client.GetDistanceBetweenPoints(user_lati, user_long, lati_, long_);

                if (distance > 1000)
                {
                    distance = distance / 1000;
                }

                MergeControls(item, distance, images);

                users.Add(item);

                images.Clear();
            }
        }
        public CardsPage()
        {
            InitializeComponent();

            IService1Callback callback = this as IService1Callback;

            InstanceContext context = new InstanceContext(callback);

            client = new Service1Client(context);
        }
        public CardsPage(string email)
        {
            this.email = email;

            InitializeComponent();

            IService1Callback callback = this as IService1Callback;

            InstanceContext context = new InstanceContext(callback);

            client = new Service1Client(context);
        }
Exemple #5
0
        public PhotoGallery(List <Image> images)
        {
            InitializeComponent();

            listBox_Photos.ItemsSource = images;

            IService1Callback callback = this as IService1Callback;

            InstanceContext context = new InstanceContext(callback);

            client = new Service1Client(context);
        }
Exemple #6
0
        public void Login(string userName)
        {
            OperationContext  context  = OperationContext.Current;
            IService1Callback callback = context.GetCallbackChannel <IService1Callback>();
            User newUser = new User(userName, callback);

            CC.Users.Add(newUser);
            foreach (var v in CC.Users)
            {
                v.callback.ShowLogin(userName);
            }
        }
Exemple #7
0
        public void Login(string userName)
        {
            OperationContext  context  = OperationContext.Current;
            IService1Callback callback = context.GetCallbackChannel <IService1Callback>();
            User   newUser             = new User(userName, callback);
            string str = "";

            for (int i = 0; i < CC.Users.Count; i++)
            {
                str += CC.Users[i].UserName + "、";
            }
            newUser.callback.InitUsersInfo(str.TrimEnd('、'));
            CC.Users.Add(newUser);
            foreach (var user in CC.Users)
            {
                user.callback.ShowLogin(userName);
            }
        }
Exemple #8
0
        public MainWindow()
        {
            bool?value = addition.GetValue(@"SettingsSetted") as bool?;

            //Проверка на наличие флажка автозапуска
            if (value == null || value == false)
            {
                Settings stngs = new Settings();
                stngs.ApplyingSettings += Stngs_ApplyingSettings;
                if (stngs.ShowDialog() == true)
                {
                    addition.SetValue(@"SettingsSetted", true);
                }
            }
            value = addition.GetValue(@"DontSaveIpPort") as bool?;


            value = false;
            IP    = System.Net.IPAddress.Parse("192.168.1.103");
            Port  = 7777;

            callback = this as IService1Callback;
            //if (value != null)
            //{
            //	if (value == true)
            //		GetIpPort();
            //	else
            //	{
            //		System.Net.IPAddress.TryParse(addition.GetValue(@"IP").ToString(), out IP);
            //		Int32.TryParse(addition.GetValue(@"Port").ToString(), out Port);
            //		if (IP == null || Port == 0)
            //			GetIpPort();
            //	}
            //}
            //else
            //{
            //	GetIpPort();
            //}
            switcher = new RNA_Switcher();
            Connect();
            //InitializeComponent();
            //this.Visibility = Visibility.Collapsed;
        }
Exemple #9
0
        public bool Initialize(IService1Callback callbackHandler)
        {
            try
            {
                this.callbackHandler = callbackHandler;
                InstanceContext instanceContext = new InstanceContext(callbackHandler);
                EndpointAddress address         = new EndpointAddress(new Uri(Properties.Settings.Default.RemoteIP));

                NetTcpBinding tcpBinding = new NetTcpBinding(SecurityMode.None);
                ReliableSessionBindingElement reliableBe = new ReliableSessionBindingElement();
                reliableBe.Ordered                = true;
                tcpBinding.OpenTimeout            = new TimeSpan(24, 20, 31, 23);
                tcpBinding.CloseTimeout           = new TimeSpan(24, 20, 31, 23);
                tcpBinding.ReceiveTimeout         = new TimeSpan(24, 20, 31, 23);
                tcpBinding.SendTimeout            = new TimeSpan(24, 20, 31, 23);
                tcpBinding.MaxBufferSize          = 2147483647;
                tcpBinding.MaxReceivedMessageSize = 2147483647;

                OptionalReliableSession reliableSession = new OptionalReliableSession(reliableBe);
                tcpBinding.ReliableSession = reliableSession;
                tcpBinding.ReceiveTimeout  = new TimeSpan(24, 20, 31, 23);

                dupFactory = new DuplexChannelFactory <IService1>(instanceContext, tcpBinding, address);
                dupFactory.Open();

                wcfService = dupFactory.CreateChannel();
                wcfService.RegisterCallback();

                Thread workerThread = new Thread(DoWork);
                _shouldStop = true;
                workerThread.Start();
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }
Exemple #10
0
 public User(string userName, IService1Callback callback)
 {
     this.UserName = userName;
     this.callback = callback;
 }