示例#1
0
        private void btnForward_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                history = m_biz.HistForward();

                //Getting the coordinates from the history
                ZoomValue = history.zoom;
                acrossX   = history.x;
                downY     = history.y;

                //Loads the tile but doesn't record in the history
                LoadTile(false);
            }

            //If server is not running
            catch (CommunicationObjectFaultedException)
            {
                MessageBox.Show("Error: Cannot connect to the server. Please try again later!");
            }

            //If user haven't navigate yet to record history anf then tries to view history
            catch (NullReferenceException)
            {
                MessageBox.Show("Error: Please start navigating to record the history!");
            }
        }
示例#2
0
        //loads the image tile
        private void load_Image(bool addToHist)
        {
            byte[] bitmap;
            try
            {
                //calls load tile method from server
                bitmap = m_tmBiz.LoadTile(zoom, x, y);
                //open new memroy stream to convert to jpeg
                MemoryStream memStream = new MemoryStream(bitmap);
                //decodes memroy stream to a jpeg image
                JpegBitmapDecoder decoder     = new JpegBitmapDecoder(memStream, BitmapCreateOptions.None, BitmapCacheOption.None);
                BitmapFrame       bitmapFrame = decoder.Frames[0];
                //sets the image source to the frame
                imgTile.Source = bitmapFrame;
            }
            catch (System.ServiceModel.EndpointNotFoundException)
            {
                Console.WriteLine("Server is not on!");
            }
            catch (System.ServiceModel.CommunicationObjectFaultedException)
            {
                Console.WriteLine("Exception caught");
            }
            catch (Exception e2)
            {
                Console.WriteLine(e2);
            }

            if (addToHist)
            {
                //adds for browse history
                HistEntry hAdd = new HistEntry(x, y, zoom);
                try
                {
                    m_tmBiz.AddHistEntry(hAdd);
                }
                catch (Exception) { }
            }
        }
示例#3
0
 /// <summary>
 /// IvwHistory_SelectionChanged
 /// does nothing yet
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void IvwHistory_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     m_entry = (HistEntry)e.AddedItems[0];
 }
示例#4
0
 public DisplayHistory(BrowseHistory hist)
 {
     m_history = hist;
     m_entry   = null;
     InitializeComponent();
 }