Queen Elizabeth praised Canadians' commitment "to freedom, fairness and the rule of law" during a speech at the close of her last full day in Canada.

Prime Minister Stephen Harper hosted a state dinner for the Queen and Prince Philip at Toronto's Royal York hotel Monday evening, less than two hours after a power outage threatened the event. The hotel's emergency power supply kicked in before full power was restored and the dinner went ahead about 15 minutes behind schedule.

Before guests sat down to eat, the Queen gave a brief, bilingual speech in which she repeated earlier praise for Canada's development as a nation and her pride in being Queen of Canada.

"This vast, rich and varied country has inspired its own and attracted many others by its adherence to certain values," the Queen, her crown glistening under the dining room lights, told the guests.

"Some are enshrined in law, but I should imagine just as many are simply found in the hearts of ordinary Canadians. Commitment to freedom, fairness and the rule of law are commonly and rightly associated with this nation … So, although my visit here is drawing to a close, I shall continue to take the greatest pride in being your Queen now, and in the years to come."

Before the Queen spoke, Harper praised Her Majesty's commitment to her duties and thanked her for making her 22nd visit to Canada.

"It is said that the endurance of the Crown depends on magic. Observing your service to Canada throughout my lifetime, I believe the reality is simpler than that, and much more powerful," Harper said.

"The enduring strength of the Canadian Crown is the result of your hard work and devotion, and the affection and esteem in which you are held by Canadians as a consequence, is very real, and very deep."

Harper also announced that the customary official gift to the royal couple would be donations by the Canadian government to three charities: the True Patriot Love Foundation, the Royal Canadian Naval Benevolent Fund and the Tim Horton Children's Foundation.

The Queen also unveiled a new exhibit to be installed at the Hockey Hall of Fame commemorating Canada's gold medal victory in hockey at the 2010 Vancouver Olympics. Included in the exhibit is a memento to commemorate her 2002 trip to Vancouver, when she became the first monarch to open a hockey game by dropping the ceremonial first puck at a Canucks game.

"As Queen of Canada you share in the recent triumph of our Canadian Olympic hockey champions," Harper said. "And so we say that you are not only victorious, happy and glorious, you are also Canada's most valuable player."

The dinner capped off a very busy day for the royal couple. On Monday afternoon, the Queen donned 3-D glasses at a Toronto film studio during a tour of Canada's largest film and television production complex.

After a morning tour of Blackberry-maker Research in Motion's facilities in Waterloo, Ont., the Queen and Prince Philip spent time at Pinewood Toronto Studios, a 3-D movie and TV production facility.

During their tour, which included Ontario Premier Dalton McGuinty and Finance Minister Jim Flaherty, they watched a scene from a film being shot at the studio. The sight of the Queen in the requisite dark glasses set off a flurry of camera flashes.

The royal couple's afternoon schedule also included a lunch hosted by the Ontario government.

The Queen and Prince Philip began their day with a flight to Waterloo for the sole purpose of visiting the RIM facilities.

Word is that the Queen is a bit of a fan of the BlackBerry device, having been turned on to it by her son, Prince Andrew, a few years ago.

So, after the tour, McGuinty and BlackBerry founder Mike Lazaridis presented Her Majesty with the most current BlackBerry model -- the Bold 9700 -- that had been personalized just for her.

The BB featured a "wallpaper" of an image of children from Queen Elizabeth Public School in Kitchener, Ont., offering her flowers, as well as a pre-loaded message from the premier.

After the one-hour tour of the RIM campus, the royal couple flew back to Toronto for their tour of Pinewood.

The royal couple, who are in their mid-80s, endured heat and humidity Monday, as temperatures hit 33 Celsius in Toronto, but felt more like 43 Celsius with the humidity.

The city issued a heat alert, warning residents to stay out of the sun and seek out air-conditioned places.

Before the dinner, Prince Philip was at the hotel to hand out the Duke of Edinburgh Awards, which encourage youth to participate in community service and other areas. However, just as Ontario Lt.-Gov. David Onley was introducing Prince Philip, the blackout hit. The ceremony carried on under dim lighting after the emergency power supply kicked in.

The Queen and Prince Philip wrap up their Canadian tour Tuesday morning with a visit to the Ontario legislature followed by a walkabout, where she will get one final chance to meet with Canadians.

The royal couple will then fly to New York to visit Ground Zero and the United Nations headquarters.

On Sunday, the Queen and Prince Philip received a warm welcome from thousands of spectators at Woodbine racetrack, for the 151st running of the Queen's Plate, one of the continent's oldest horse races.

It was the Queen's fourth appearance at the race. She previously attended in 1959, 1973 and 1997. This year, Her Majesty made the winning presentations as Eurico Rosa Silva rode Big Red Mike to the $1-million prize.

Earlier, the royal couple attended Sunday service at St. James Cathedral in downtown Toronto, where hundreds of camera-wielding observers lined the streets to get a glimpse of the royal couple. About 700 people who obtained tickets also attended the service.

The Queen and Prince Philip arrived in Halifax early last week before moving on to Ottawa for Canada Day festivities, and Winnipeg.